Initial commit: my SECS2 project
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#ifndef _BSP_UART_H_
|
||||
#define _BSP_UART_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "algo_queue.h"
|
||||
|
||||
typedef struct bsp_Uart_t bsp_Uart_t;
|
||||
|
||||
struct bsp_Uart_t
|
||||
{
|
||||
queue RxQueue; /*数据接收队列*/
|
||||
USART_TypeDef *Uart; /*串口*/
|
||||
|
||||
DMA_TypeDef *Tx_DMA; /*DMA*/
|
||||
DMA_TypeDef *Rx_DMA;
|
||||
u8 Tx_DMA_CH;
|
||||
u8 Rx_DMA_CH;
|
||||
vu8 Tx_DMA_CompleteFlag; /*DMA接受完成标志位*/
|
||||
|
||||
u8 *Tx_Addr; /*DMA搬运缓冲*/
|
||||
u8 *Rx_Addr;
|
||||
u16 Tx_DMA_Len;
|
||||
u16 Rx_DMA_Len;
|
||||
|
||||
u16 Rx_Len; /*接收到的数据长度*/
|
||||
u16 Rx_TimeCount; /*超时计数*/
|
||||
u16 Rx_TimeOver; /*超时时间*/
|
||||
u8 Rx_StartFlag; /*开始超时计数标志位*/
|
||||
|
||||
void (*Init)(bsp_Uart_t *); /*初始化*/
|
||||
void (*Send)(bsp_Uart_t *,u8 *,u16); /*串口发送函数*/
|
||||
|
||||
void (*Tx_DMA_TCInt)(bsp_Uart_t *); /*DMA发送完成中断*/
|
||||
|
||||
void (*Rx_IdleInt)(bsp_Uart_t *); /*空闲中断*/
|
||||
void (*Rx_TimeIncrementInt)(bsp_Uart_t *,u16); /*中断计数计数*/
|
||||
void (*Rx_DataAnalysis)(u8 *,u16,void *); /*数据解析*/
|
||||
void (*Rx_Task)(bsp_Uart_t *); /*串口接收任务*/
|
||||
|
||||
};
|
||||
|
||||
extern bsp_Uart_t COM_Uart1;
|
||||
extern bsp_Uart_t COM_Uart2;
|
||||
#endif
|
||||
Reference in New Issue
Block a user