資源簡(jiǎn)介
該代碼同時(shí)支持stm32 f1 系列 的 三路USART 通道, 全部采用 DMA 自動(dòng)收發(fā)數(shù)據(jù), 通過(guò)中斷返回判斷數(shù)據(jù)是否收發(fā)完成。 代碼已經(jīng)測(cè)試通過(guò)可以,可以直接使用。在移植使用時(shí)需要注意,IO口 / 波特率 等信息
代碼片段和文件信息
#include?“Hal_Dma_Usart/hal_usart_dma.h“
#include?“l(fā)iiot_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?數(shù)據(jù)結(jié)構(gòu)?*/
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???????????????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????21128??2019-04-18?14:43??hal_usart_dma.c
?????文件????????1632??2019-04-22?09:49??hal_usart_dma.h
評(píng)論
共有 條評(píng)論