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");
69 k_str_out(
const_cast<char *
>(msg),
len);
74 for (
size_t i = 0; i <
len; ++i) {
80 switch (this->
uart_) {
82 return LOG_STR(
"UART0");
84 return LOG_STR(
"UART1");
85#ifdef USE_LOGGER_USB_CDC
87 return LOG_STR(
"USB_CDC");
90 return LOG_STR(
"UNKNOWN");
void schedule_dump_config()
const LogString * get_uart_selection_()
void pre_setup()
Set up this component.
void write_msg_(const char *msg, size_t len)
Application App
Global storage of Application pointer - only one Application can exist.