本文共 603 字,大约阅读时间需要 2 分钟。
串口接收初始化完毕,准备接收数据。以下是串口DMA接收函数的实现:
void recWIFI(void){ if(Uart3_Seriadef.ReciveSta) { Uart3_Seriadef.ReciveSta = 0; //清空接收标志位 }} void sendByte(uint8_t s){ uint8_t send[1] = {0}; send[0] = s; HAL_UART_Transmit(&huart3, send, 1, 1000);} void sendDtring(char * c){ while(*c){ sendByte(*c++); }} void sendFigre(uint16_t F , uint8_t B){ if(B >= 5) sendByte('0' + F/10000 % 10); if(B >= 4) sendByte('0' + F/1000 % 10); if(B >= 3) sendByte('0' + F/100 % 10); if(B >= 2) sendByte('0' + F/10 % 10); sendByte('0' + F/1 % 10);} 这些函数实现了串口数据的发送和接收功能,适用于串口通信场景。
转载地址:http://cbrq.baihongyu.com/