7#include <zephyr/device.h>
8#include <zephyr/drivers/uart.h>
9#include <zephyr/sys/printk.h>
10#include <zephyr/usb/usb_device.h>
14static const char *
const TAG =
"logger";
16#ifdef USE_LOGGER_USB_CDC
21 static bool opened =
false;
23 uart_line_ctrl_get(this->
uart_dev_, UART_LINE_CTRL_DTR, &dtr);
39 static const struct device *uart_dev =
nullptr;
40 switch (this->
uart_) {
42 uart_dev = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(uart0));
45 uart_dev = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(uart1));
47#ifdef USE_LOGGER_USB_CDC
49 uart_dev = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(cdc_acm_uart0));
50 if (device_is_ready(uart_dev)) {
56 if (!device_is_ready(uart_dev)) {
63 ESP_LOGI(TAG,
"Log initialized");
71 printk(
"%.*s",
static_cast<int>(
len), msg);
76 for (uint16_t i = 0; i <
len; ++i) {
82 switch (this->
uart_) {
84 return LOG_STR(
"UART0");
86 return LOG_STR(
"UART1");
87#ifdef USE_LOGGER_USB_CDC
89 return LOG_STR(
"USB_CDC");
92 return LOG_STR(
"UNKNOWN");
void schedule_dump_config()
void write_msg_(const char *msg, uint16_t len)
const LogString * get_uart_selection_()
void pre_setup()
Set up this component.
Application App
Global storage of Application pointer - only one Application can exist.