修改驱动程序
This commit is contained in:
1 parent
063c3fcc07
commit
a69c1a58d6
39 files changed
+1627
-641
No files matched your search
+54
-24
@@ -2,43 +2,73 @@
|
||||
#define _UART_BOARD_H
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
typedef enum UartId_t
|
||||
{
|
||||
LpUart1,
|
||||
LpUart2,
|
||||
Uart1,
|
||||
Uart2,
|
||||
Uart3,
|
||||
Uart4,
|
||||
Uart5,
|
||||
Uart6,
|
||||
}UartId_t;
|
||||
G0_LPUART1,
|
||||
G0_LPUART2,
|
||||
G0_UART1,
|
||||
G0_UART2,
|
||||
G0_UART3,
|
||||
G0_UART4,
|
||||
G0_UART5,
|
||||
G0_UART6,
|
||||
G0_UARTM
|
||||
} UartId_t;
|
||||
|
||||
|
||||
typedef enum UartPara_t{
|
||||
_8N1,
|
||||
_8E1,
|
||||
_8O1,
|
||||
_7O1,
|
||||
_7E1,
|
||||
_7N1,
|
||||
}UartPara_t;
|
||||
#define PARITY_EVEN_MASK 0X02
|
||||
#define PARITY_ODD_MASK 0x04
|
||||
#define PARITY_NONE_MASK 0x00
|
||||
#define DATA8_MASK 0X00
|
||||
#define DATA7_MASK 0X01
|
||||
|
||||
typedef struct UartDrv_t
|
||||
|
||||
#define PARITY_DATA_8N1 (DATA8_MASK | PARITY_NONE_MASK) // 00H
|
||||
#define PARITY_DATA_7N1 (DATA7_MASK | PARITY_NONE_MASK) // 01H
|
||||
#define PARITY_DATA_8E1 (DATA8_MASK | PARITY_EVEN_MASK) // 02H
|
||||
#define PARITY_DATA_7E1 (DATA7_MASK | PARITY_EVEN_MASK) // 03H
|
||||
#define PARITY_DATA_8O1 (DATA8_MASK | PARITY_ODD_MASK) // 04H
|
||||
#define PARITY_DATA_7O1 (DATA7_MASK | PARITY_ODD_MASK) // 05H
|
||||
|
||||
typedef struct UartDrv_t
|
||||
{
|
||||
UartId_t Id;// 串口号
|
||||
uint32_t BaudRate;// 波特率
|
||||
UartPara_t Para; // 数据位
|
||||
uint32_t DataParity; // 数据位
|
||||
char * rx_buffer;
|
||||
uint16_t rx_size;
|
||||
uint32_t rx_ready;// 接受完成等待处理
|
||||
}UartDrv_t;
|
||||
void (*rxdone) (void); // 接受完成回调函数
|
||||
uint32_t rx_timer;
|
||||
} UartDrv_t;
|
||||
|
||||
|
||||
|
||||
extern UartDrv_t g_DebugDrv ;
|
||||
extern UartDrv_t g_U4851Drv ;
|
||||
extern UartDrv_t g_U4852Drv ;
|
||||
extern UartDrv_t g_U4853Drv ;
|
||||
extern UartDrv_t g_ViewDrv ;
|
||||
extern UartDrv_t g_ETH1Drv ;
|
||||
extern UartDrv_t g_ETH2Drv ;
|
||||
extern UartDrv_t g_GSMDrv ;
|
||||
extern UartDrv_t g_LoRaDrv ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// function
|
||||
|
||||
|
||||
extern void MX_UART_TickHandle (void);
|
||||
extern void MX_UART_Init (UartDrv_t *drv);
|
||||
extern void MX_UART_IRQHandle (void);
|
||||
extern void MX_UART_Clear (UartDrv_t * drv);
|
||||
extern void MX_UART_PutChar (UartDrv_t * drv, char ch);
|
||||
extern void MX_UART_PutBuffer (UartDrv_t * drv, char *buff, int size);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user