Sound Byte Libs 1ee2ca6
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
handle.hpp
Go to the documentation of this file.
1/**
2 * @file handle.hpp
3 * @brief UART handle type for hardware abstraction
4 * @ingroup hal
5 *
6 * Canonical definition of UartHandle - the primary way to reference
7 * UART peripherals in SBL. Used by drivers, generated hardware configs,
8 * and user code.
9 */
10
11#ifndef SBL_HAL_UART_HANDLE_HPP_
12#define SBL_HAL_UART_HANDLE_HPP_
13
14#include <cstdint>
15
16namespace sbl {
17
18/**
19 * @brief UART peripheral handle
20 *
21 * Represents a UART configuration as resolved from hardware manifests.
22 * Includes peripheral number, pin mappings, and default baud rate.
23 *
24 * Examples:
25 * - STM32H7 USART1 on PA9/PA10: UartHandle{1, 0, 9, 7, 0, 10, 7, 115200}
26 * - RP2040 UART0 on GPIO0/GPIO1: UartHandle{0, 0, 0, 0, 0, 1, 0, 115200}
27 */
28struct UartHandle {
29 uint32_t peripheral; ///< UART peripheral number (e.g., 1 for USART1)
30 uint32_t tx_port; ///< TX GPIO port number
31 uint32_t tx_pin; ///< TX GPIO pin number
32 uint32_t tx_af; ///< TX alternate function (STM32), 0 for simpler MCUs
33 uint32_t rx_port; ///< RX GPIO port number
34 uint32_t rx_pin; ///< RX GPIO pin number
35 uint32_t rx_af; ///< RX alternate function (STM32), 0 for simpler MCUs
36 uint32_t baud; ///< Default baud rate
37};
38
39} // namespace sbl
40
41#endif // SBL_HAL_UART_HANDLE_HPP_
Root namespace for all Sound Byte Libs functionality.
Definition aliases.hpp:24
UART peripheral handle.
Definition handle.hpp:28
uint32_t tx_af
TX alternate function (STM32), 0 for simpler MCUs.
Definition handle.hpp:32
uint32_t tx_pin
TX GPIO pin number.
Definition handle.hpp:31
uint32_t rx_af
RX alternate function (STM32), 0 for simpler MCUs.
Definition handle.hpp:35
uint32_t rx_pin
RX GPIO pin number.
Definition handle.hpp:34
uint32_t tx_port
TX GPIO port number.
Definition handle.hpp:30
uint32_t baud
Default baud rate.
Definition handle.hpp:36
uint32_t rx_port
RX GPIO port number.
Definition handle.hpp:33
uint32_t peripheral
UART peripheral number (e.g., 1 for USART1)
Definition handle.hpp:29