fix:修复调光时间BUG
解决调光时间一样的情况下,调光亮与调光灭的实际调光时间不一致问题
This commit is contained in:
138
UART.h
Normal file
138
UART.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* --- STC MCU Limited ------------------------------------------------*/
|
||||
/* --- STC 1T Series MCU Demo Programme -------------------------------*/
|
||||
/* --- Mobile: (86)13922805190 ----------------------------------------*/
|
||||
/* --- Fax: 86-0513-55012956,55012947,55012969 ------------------------*/
|
||||
/* --- Tel: 86-0513-55012928,55012929,55012966 ------------------------*/
|
||||
/* --- Web: www.STCMCU.com --------------------------------------------*/
|
||||
/* --- Web: www.STCMCUDATA.com ---------------------------------------*/
|
||||
/* --- QQ: 800003751 -------------------------------------------------*/
|
||||
/* <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô˴<C3B4><CBB4><EFBFBD>,<2C><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>STC<54><43><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> */
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __UART_H
|
||||
#define __UART_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define UART1 1
|
||||
//#define UART2 2
|
||||
#define UART3 3
|
||||
//#define UART4 4
|
||||
|
||||
#ifdef UART1
|
||||
#define COM_TX1_Lenth 32
|
||||
#define COM_RX1_Lenth 32
|
||||
#endif
|
||||
#ifdef UART2
|
||||
#define COM_TX2_Lenth 128
|
||||
#define COM_RX2_Lenth 128
|
||||
#endif
|
||||
#ifdef UART3
|
||||
#define COM_TX3_Lenth 32 //32<33><32><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define COM_RX3_Lenth 32
|
||||
#endif
|
||||
#ifdef UART4
|
||||
#define COM_TX4_Lenth 128
|
||||
#define COM_RX4_Lenth 128
|
||||
#endif
|
||||
|
||||
#define UART_ShiftRight 0 //ͬ<><CDAC><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
#define UART_8bit_BRTx (1<<6) //8λ<38><CEBB><EFBFBD><EFBFBD>,<2C>ɱ䲨<C9B1><E4B2A8><EFBFBD><EFBFBD>
|
||||
#define UART_9bit (2<<6) //9λ<39><CEBB><EFBFBD><EFBFBD>,<2C>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define UART_9bit_BRTx (3<<6) //9λ<39><CEBB><EFBFBD><EFBFBD>,<2C>ɱ䲨<C9B1><E4B2A8><EFBFBD><EFBFBD>
|
||||
|
||||
#define UART1_SW_P30_P31 0
|
||||
#define UART1_SW_P36_P37 (1<<6)
|
||||
#define UART1_SW_P16_P17 (2<<6)
|
||||
#define UART1_SW_P43_P44 (3<<6)
|
||||
#define UART2_SW_P10_P11 0
|
||||
#define UART2_SW_P46_P47 1
|
||||
#define UART3_SW_P00_P01 0
|
||||
#define UART3_SW_P50_P51 2
|
||||
#define UART4_SW_P02_P03 0
|
||||
#define UART4_SW_P52_P53 4
|
||||
|
||||
|
||||
#define TimeOutSet1 5
|
||||
#define TimeOutSet2 5
|
||||
#define TimeOutSet3 5
|
||||
#define TimeOutSet4 5
|
||||
|
||||
#define BRT_Timer1 1
|
||||
#define BRT_Timer2 2
|
||||
#define BRT_Timer3 3
|
||||
#define BRT_Timer4 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 id; //<2F><><EFBFBD>ں<EFBFBD>
|
||||
|
||||
u8 TX_read; //<2F><><EFBFBD>Ͷ<EFBFBD>ָ<EFBFBD><D6B8>
|
||||
u8 TX_write; //<2F><><EFBFBD><EFBFBD>дָ<D0B4><D6B8>
|
||||
u8 B_TX_busy; //æ<><C3A6>־
|
||||
|
||||
u8 RX_Cnt; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֽڼ<D6BD><DABC><EFBFBD>
|
||||
u8 RX_TimeOut; //<2F><><EFBFBD>ճ<EFBFBD>ʱ
|
||||
u8 B_RX_OK; //<2F><><EFBFBD>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>
|
||||
} COMx_Define;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 UART_Mode; //ģʽ, UART_ShiftRight,UART_8bit_BRTx,UART_9bit,UART_9bit_BRTx
|
||||
u8 UART_BRT_Use; //ʹ<>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>, BRT_Timer1,BRT_Timer2
|
||||
u32 UART_BaudRate; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, ENABLE,DISABLE
|
||||
u8 Morecommunicate; //<2F><><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD>, ENABLE,DISABLE
|
||||
u8 UART_RxEnable; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, ENABLE,DISABLE
|
||||
u8 BaudRateDouble; //<2F><><EFBFBD><EFBFBD><EFBFBD>ʼӱ<CABC>, ENABLE,DISABLE
|
||||
u8 UART_Interrupt; //<2F>жϿ<D0B6><CFBF><EFBFBD>, ENABLE,DISABLE
|
||||
u8 UART_Priority; //<2F><><EFBFBD>ȼ<EFBFBD>, Priority_0,Priority_1,Priority_2,Priority_3
|
||||
u8 UART_P_SW; //<2F>л<EFBFBD><D0BB>˿<EFBFBD>, UART1_SW_P30_P31,UART1_SW_P36_P37,UART1_SW_P16_P17,UART1_SW_P43_P44
|
||||
} COMx_InitDefine;
|
||||
|
||||
#ifdef UART1
|
||||
extern COMx_Define COM1;
|
||||
extern u8 xdata TX1_Buffer[COM_TX1_Lenth]; //<2F><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>
|
||||
extern u8 xdata RX1_Buffer[COM_RX1_Lenth]; //<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
#endif
|
||||
#ifdef UART2
|
||||
extern COMx_Define COM2;
|
||||
extern u8 xdata TX2_Buffer[COM_TX2_Lenth]; //<2F><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>
|
||||
extern u8 xdata RX2_Buffer[COM_RX2_Lenth]; //<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
#endif
|
||||
#ifdef UART3
|
||||
extern COMx_Define COM3;
|
||||
extern u8 xdata TX3_Buffer[COM_TX3_Lenth]; //<2F><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>
|
||||
extern u8 xdata RX3_Buffer[COM_RX3_Lenth]; //<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
#endif
|
||||
#ifdef UART4
|
||||
extern COMx_Define COM4;
|
||||
extern u8 xdata TX4_Buffer[COM_TX4_Lenth]; //<2F><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>
|
||||
extern u8 xdata RX4_Buffer[COM_RX4_Lenth]; //<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
#endif
|
||||
|
||||
u8 UART_Configuration(u8 UARTx, COMx_InitDefine *COMx);
|
||||
#ifdef UART1
|
||||
void TX1_write2buff(u8 dat); //д<>뷢<EFBFBD>ͻ<EFBFBD><CDBB>壬ָ<E5A3AC><D6B8>+1
|
||||
void PrintString1(u8 *puts);
|
||||
void Printbuffer1(u8 *puts,u8 len);
|
||||
#endif
|
||||
#ifdef UART2
|
||||
void TX2_write2buff(u8 dat); //д<>뷢<EFBFBD>ͻ<EFBFBD><CDBB>壬ָ<E5A3AC><D6B8>+1
|
||||
void PrintString2(u8 *puts);
|
||||
#endif
|
||||
#ifdef UART3
|
||||
void TX3_write2buff(u8 dat); //д<>뷢<EFBFBD>ͻ<EFBFBD><CDBB>壬ָ<E5A3AC><D6B8>+1
|
||||
void PrintString3(u8 *puts);
|
||||
void Printbuffer3(u8 *puts,u8 len);
|
||||
#endif
|
||||
#ifdef UART4
|
||||
void TX4_write2buff(u8 dat); //д<>뷢<EFBFBD>ͻ<EFBFBD><CDBB>壬ָ<E5A3AC><D6B8>+1
|
||||
void PrintString4(u8 *puts);
|
||||
#endif
|
||||
|
||||
void UART3_config(void);
|
||||
extern u8 recv_start_flag;
|
||||
extern u32 recv_time;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user