資源簡介
該代碼同時支持stm32 f1 系列 的 三路USART 通道, 全部采用 DMA 自動收發數據, 通過中斷返回判斷數據是否收發完成。 代碼已經測試通過可以,可以直接使用。在移植使用時需要注意,IO口 / 波特率 等信息
代碼片段和文件信息
#include?“Hal_Dma_Usart/hal_usart_dma.h“
#include?“liiot_net_device.h“
#include?“sys_timer.h“
#include?
static?uint32_t?(*hal_usart_dma_get_sys_tick)(void);
typedef?struct
{
????USART_TypeDef???????????*usart_port;
????DMA_Channel_TypeDef?????*usart_send_dma_chnl;
????DMA_Channel_TypeDef?????*usart_recv_dma_chnl;???
}_usart_dma_chnl;
static?_usart_dma_chnl?usart_dma_chnl[UART_PORT_INDEX]?=?{
????USART1?DMA1_Channel4?DMA1_Channel5
????USART2?DMA1_Channel7?DMA1_Channel6
????USART3?DMA1_Channel2?DMA1_Channel2
};
/*?UART?數據結構?*/
typedef?struct
{
#if?LIIOT_CONV_HOST_MAX
????liiot_convergence_host_t????usart_host_net;
#endif????
????_usart_dma_chnl?????????????*usart_chnl;
????bool????????????????????????usart_tx_flg;
????bool???????????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????21128??2019-04-18?14:43??hal_usart_dma.c
?????文件????????1632??2019-04-22?09:49??hal_usart_dma.h
- 上一篇:wk2114串口拓展芯片驅動
- 下一篇:VFP上傳文件到web服務器
評論
共有 條評論