Major UART communication improvement

- the UART communication is improved based on UART Idle line detection interrupt
- an Rx ring buffer is used to manage the UART incoming data
- both Tx and Rx are efficiently handled using DMA
- fixed #1

Other:
- minor visual improvements
This commit is contained in:
EmanuelFeru
2020-06-21 23:09:27 +02:00
parent 9edd22b6b7
commit ee6ab3a886
9 changed files with 273 additions and 185 deletions

View File

@@ -23,7 +23,7 @@
#include "stm32f1xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "util.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -267,7 +267,10 @@ void USART2_IRQHandler(void)
/* USER CODE END USART2_IRQn 0 */
HAL_UART_IRQHandler(&huart2);
/* USER CODE BEGIN USART2_IRQn 1 */
if(RESET != __HAL_UART_GET_IT_SOURCE(&huart2, UART_IT_IDLE)) { // Check for IDLE line interrupt
__HAL_UART_CLEAR_IDLEFLAG(&huart2); // Clear IDLE line flag (otherwise it will continue to enter interrupt)
usart_rx_check(); // Check for data to process
}
/* USER CODE END USART2_IRQn 1 */
}