ME 507 Romi++
Cylindrical Differential Drive Robot created for ME 507 at Cal Poly in Spring 2025
|
UART DMA with idle line detection handler. More...
#include "stm32f4xx_hal.h"
Go to the source code of this file.
Macros | |
#define | BUFFER_SIZE 64 |
Maximum receive buffer size for UART DMA. |
Functions | |
void | UART_DMA_IDLE_Init (UART_HandleTypeDef *huart) |
Initializes UART DMA reception with idle line detection. | |
void | UART_DMA_IDLE_IRQHandler (UART_HandleTypeDef *huart) |
UART interrupt handler for idle line detection. |
Variables | |
uint8_t | rx_buffer [BUFFER_SIZE] |
UART DMA receive buffer shared with command parser or control logic. | |
uint8_t | buffer_index |
Current write index into the rx_buffer. | |
volatile uint8_t | command_ready |
Flag set when a full command is received and ready to parse. |
UART DMA with idle line detection handler.
Provides support for non-blocking UART reception using DMA with idle line interrupt to detect end-of-packet or message termination.
void UART_DMA_IDLE_Init | ( | UART_HandleTypeDef * | huart | ) |
Initializes UART DMA reception with idle line detection.
huart | Pointer to UART handle configured for DMA RX. |
Initializes UART DMA reception with idle line detection.
huart | Pointer to the UART handle to configure. |
Starts the DMA reception and enables UART idle line detection to trigger when a message has ended. Assumes a '\r
' terminated protocol.
void UART_DMA_IDLE_IRQHandler | ( | UART_HandleTypeDef * | huart | ) |
UART interrupt handler for idle line detection.
huart | Pointer to UART handle triggering the interrupt. |
Should be called from the HAL_UART_IRQHandler.
UART interrupt handler for idle line detection.
huart | Pointer to the UART handle triggering the interrupt. |
Stops DMA temporarily, calculates received length, and checks for a complete command (terminated by "\r\n"). If found, sets command_ready.
|
extern |
Current write index into the rx_buffer.
Current write index into the rx_buffer.
|
extern |
Flag set when a full command is received and ready to parse.
Flag set when a full command is received and ready to parse.
|
extern |
UART DMA receive buffer shared with command parser or control logic.
UART DMA receive buffer shared with command parser or control logic.