| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /*
- * uart_rcv.c
- *
- * Created on: 2022年4月20日
- * Author: dell
- */
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include "onechip_include_header.h"
- uint8_t g_wifi_rx_buf[WIFI_RX_BUF_SIZE];
- uint8_t g_wifi_rx_len;
- void esp_receive_Rec_IDLE(UART_HandleTypeDef *huart)
- {
- if ((__HAL_UART_GET_FLAG(huart, UART_FLAG_IDLE) != RESET))
- {
- __HAL_UART_CLEAR_IDLEFLAG(huart);
- g_wifi_rx_len = WIFI_RX_BUF_SIZE - __HAL_DMA_GET_COUNTER(huart->hdmarx);
- HAL_UART_DMAStop(huart);
- HAL_UART_Receive_DMA(huart, g_wifi_rx_buf, WIFI_RX_BUF_SIZE);
- }
- }
- void wifi_receive_clear(void){
- memset(g_wifi_rx_buf,0,WIFI_RX_BUF_SIZE);
- g_wifi_rx_len = 0;
- }
- void esp_receive_Rec_Start(UART_HandleTypeDef *huart){
- __HAL_UART_CLEAR_IDLEFLAG(huart);
- memset((char *)g_wifi_rx_buf,0,WIFI_RX_BUF_SIZE);
- HAL_UART_Receive_DMA(huart, g_wifi_rx_buf, WIFI_RX_BUF_SIZE);
- __HAL_UART_ENABLE_IT(huart, UART_IT_IDLE);
- }
|