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
log_output.hpp
Go to the documentation of this file.
1/**
2 * @file log_output.hpp
3 * @brief Log sinks over the debug UART
4 * @ingroup hal
5 *
6 * Sinks for the logger and the fault handlers (the sink contract is in
7 * <sbl/common/log/sink.hpp>): a type with `static void write(const char*)`.
8 * They sit here, with the driver they write through, so that common/log
9 * includes nothing above it.
10 */
11
12#ifndef SBL_HW_HAL_UART_LOG_OUTPUT_HPP_
13#define SBL_HW_HAL_UART_LOG_OUTPUT_HPP_
14
15#include <sbl/hw/driver/uart.hpp>
16
17namespace sbl::uart {
18
19/** Writes to Uart<0>, the debug UART, through its TX ring buffer. */
20struct LogOutput {
21 static void write(const char* str) { sbl::driver::Uart<>::write_string(str); }
22};
23
24/**
25 * Writes to the debug UART by polling: no ring buffer, and it works with
26 * interrupts off. The sink for fault and panic handlers (SBL_FAULT_OUTPUT).
27 */
29 static void write(const char* str) { sbl::driver::Uart<>::write_string_polling(str); }
30};
31
32} // namespace sbl::uart
33
34#endif // SBL_HW_HAL_UART_LOG_OUTPUT_HPP_
Standard baud rates for UART communication.
Definition driver.hpp:35