Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
driver.hpp
Go to the documentation of this file.
1/**
2 * @file driver.hpp
3 * @brief UART driver interface: baud-rate constants for MCU UART drivers
4 * @ingroup hal
5 *
6 * MCU UART drivers implement this static interface, which
7 * uart_requirements.hpp checks at compile time:
8 *
9 * @code
10 * static void init(const sbl::UartHandle& handle); // or bool
11 * static void init_rx(const sbl::UartHandle& handle); // or bool
12 * static void write_byte(uint8_t byte);
13 * static void write(const uint8_t* data, size_t len);
14 * static void write_string(const char* str);
15 * static bool available();
16 * static uint8_t read_byte();
17 * @endcode
18 *
19 * Optional: try_write_byte(uint8_t) -> bool and
20 * try_write_string(const char*) -> size_t, which do not spin on a full
21 * TX path.
22 */
23
24#ifndef SBL_HW_HAL_UART_DRIVER_HPP_
25#define SBL_HW_HAL_UART_DRIVER_HPP_
26
27#include <cstdint>
28#include <cstddef>
29
30namespace sbl {
31
32/**
33 * @brief Standard baud rates for UART communication
34 */
35namespace uart {
36constexpr uint32_t BAUD_9600 = 9600; /**< 9600 baud */
37constexpr uint32_t BAUD_19200 = 19200; /**< 19200 baud */
38constexpr uint32_t BAUD_38400 = 38400; /**< 38400 baud */
39constexpr uint32_t BAUD_57600 = 57600; /**< 57600 baud */
40constexpr uint32_t BAUD_115200 = 115200;/**< 115200 baud */
41constexpr uint32_t BAUD_230400 = 230400;/**< 230400 baud */
42constexpr uint32_t BAUD_460800 = 460800;/**< 460800 baud */
43constexpr uint32_t BAUD_921600 = 921600;/**< 921600 baud */
44constexpr uint32_t BAUD_MIDI = 31250; /**< MIDI: 31250 baud */
45} // namespace uart
46
47} // namespace sbl
48
49#endif // SBL_HW_HAL_UART_DRIVER_HPP_
constexpr uint32_t BAUD_9600
Definition driver.hpp:36
constexpr uint32_t BAUD_460800
Definition driver.hpp:42
constexpr uint32_t BAUD_19200
Definition driver.hpp:37
constexpr uint32_t BAUD_115200
Definition driver.hpp:40
constexpr uint32_t BAUD_230400
Definition driver.hpp:41
constexpr uint32_t BAUD_921600
Definition driver.hpp:43
constexpr uint32_t BAUD_MIDI
Definition driver.hpp:44
constexpr uint32_t BAUD_57600
Definition driver.hpp:39
constexpr uint32_t BAUD_38400
Definition driver.hpp:38
Root namespace for all Sound Byte Libs code.