fix:修复调光时间BUG
解决调光时间一样的情况下,调光亮与调光灭的实际调光时间不一致问题
This commit is contained in:
100
UART_Set.h
Normal file
100
UART_Set.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#ifndef _UART_SET_H
|
||||
#define _UART_SET_H
|
||||
#include "STC8xxxx.h"
|
||||
#define USART_CMD_QUEST 0x20
|
||||
#define USART_CMD_SET_BRIGHTNESS 0x21
|
||||
#define USART_CMD_SET_MODE 0x22
|
||||
#define USART_CMD_ALL_BRIGHTNESS 0x23
|
||||
#define USART_CMD_SWITCH_STATUS 0x24
|
||||
#define USART_CMD_DEBUG_SET 0x25 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>㹻<EFBFBD>Ҳ<EFBFBD><D2B2>ÿ<EFBFBD><C3BF>ƣ<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD><CEAA>
|
||||
#define Usart_CMD_Version 0x26
|
||||
|
||||
#define USART_TEST_MODE 0xE0
|
||||
#define USART_TEST_DATA 0xE1
|
||||
|
||||
#define USART_CMD_QUEST_A 0x30
|
||||
#define USART_CMD_SET_BRIGHTNESS_A 0x31
|
||||
#define USART_CMD_SET_MODE_A 0x32
|
||||
#define USART_CMD_ALL_BRIGHTNESS_A 0x33
|
||||
#define USART_CMD_SWITCH_STATUS_A 0x34
|
||||
#define USART_CMD_DEBUG_SET_A 0x35
|
||||
#define Usart_CMD_Version_A 0x36
|
||||
|
||||
#define USART_TEST_MODE_A 0xF0
|
||||
#define USART_TEST_DATA_A 0xF1
|
||||
|
||||
#define ADDR_RX 0x01 //C12_CH12<31>ĵ<EFBFBD>ַ
|
||||
#define DEV_TYPE 0x03
|
||||
|
||||
#define Version_High 0x13 //<2F><><EFBFBD><EFBFBD><EFBFBD>汾
|
||||
#define Version_Low 0x00
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UART_FMT_ADDR_TX = 0x00,
|
||||
UART_FMT_TYPE,
|
||||
UART_FMT_DEV_TYPE,
|
||||
UART_FMT_ADDR_RX,
|
||||
UART_FMT_LEN,
|
||||
UART_FMT_CKS,
|
||||
UART_FMT_CMD,
|
||||
} UART_FMT_e;
|
||||
|
||||
typedef struct Usart
|
||||
{
|
||||
u8 lastsn;
|
||||
u8 Sn;
|
||||
u8 ok_flag;
|
||||
u8 recv_buffer[32];
|
||||
}xdata G_Usart;
|
||||
|
||||
typedef struct answer
|
||||
{
|
||||
u8 short_answer[7];
|
||||
u8 long_answer[20];
|
||||
u8 long_answer_flag;
|
||||
u8 short_answer_flag;
|
||||
u8 version_answer_flag;
|
||||
u8 version_answer[9];
|
||||
}xdata G_answer;
|
||||
|
||||
//<2F><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݵĽṹ<C4BD><E1B9B9>
|
||||
/*
|
||||
* <20>ĸ<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʹ<EFBFBD>ܱ<EFBFBD>־λ
|
||||
* flag1ָ<31><D6B8><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>0x21
|
||||
* flag2ָ<32><D6B8><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>0x22
|
||||
* <20><><EFBFBD><EFBFBD><DFBB>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
u16 flag1[12];
|
||||
u16 flag2[12];
|
||||
|
||||
//0x21
|
||||
u16 gradual_time[12];
|
||||
u16 B_Ch[12];
|
||||
|
||||
//0x22
|
||||
u16 mode[12];
|
||||
u16 forward[12];
|
||||
u16 pwm_step[12];
|
||||
|
||||
//0x23
|
||||
u16 global_brightness;
|
||||
u16 B_max;
|
||||
u16 B_min;
|
||||
// u16 changeflag;
|
||||
|
||||
//0x24
|
||||
u16 key_status[12];
|
||||
}xdata S_recv;
|
||||
|
||||
extern S_recv s_recv;
|
||||
extern G_answer g_answer;
|
||||
extern G_Usart g_Usart;
|
||||
void Usart_Deal_Data(void);
|
||||
void Usart_judge_Data(void);
|
||||
void Usart_answer(void);
|
||||
u8 sumfunc(u8* answer,u8 len);
|
||||
extern u8 debug;
|
||||
#endif
|
||||
Reference in New Issue
Block a user