zephyr/samples/subsys/usb/console/src/main.c
Johann Fischer 5914131852 samples: usb: clean up legacy USB CDC ACM console sample
Remove the configuration for the new USB device stack, as there is now a
separate sample that demonstrates how to use it with Kconfig option
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-02-12 02:22:18 +01:00

36 lines
778 B
C

/*
* Copyright (c) 2016 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/usb/usb_device.h>
#include <zephyr/drivers/uart.h>
BUILD_ASSERT(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart),
"Console device is not ACM CDC UART device");
int main(void)
{
const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;
if (usb_enable(NULL)) {
return 0;
}
/* Poll if the DTR flag was set */
while (!dtr) {
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
/* Give CPU resources to low priority threads. */
k_sleep(K_MSEC(100));
}
while (1) {
printk("Hello World! %s\n", CONFIG_ARCH);
k_sleep(K_SECONDS(1));
}
}