/** * @file bsp_uart.h * @brief UART1 communication driver (DMA + IDLE interrupt for MQTT) */ #ifndef __BSP_UART_H #define __BSP_UART_H #include "main.h" #include #include #define UART1_RX_BUF_SIZE 256 /* Exported functions prototypes */ void BSP_UART1_Init(void); /** * @brief Send data via UART1 (blocking) */ uint16_t BSP_UART1_Send(uint8_t *data, uint16_t len); /** * @brief Send string via UART1 (blocking) */ uint16_t BSP_UART1_SendString(const char *str); /** * @brief Get received data length */ uint16_t BSP_UART1_GetRxLen(void); /** * @brief Read data from rx buffer */ uint16_t BSP_UART1_Read(uint8_t *buf, uint16_t len); /** * @brief Clear rx buffer (restart DMA) */ void BSP_UART1_ClearRxBuf(void); /** * @brief Check if data received */ bool BSP_UART1_IsDataReceived(void); /** * @brief Process received data (call in main loop) */ void BSP_UART1_Process(void); /** * @brief IDLE interrupt handler (call from ISR) */ void BSP_UART1_IDLE_IRQHandler(void); #endif