1 /*
2  * Copyright (c) 2016 Intel Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/kernel.h>
8 #include <zephyr/sys/printk.h>
9 #include <zephyr/usb/usb_device.h>
10 #include <zephyr/drivers/uart.h>
11 
12 BUILD_ASSERT(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart),
13 	     "Console device is not ACM CDC UART device");
14 
main(void)15 int main(void)
16 {
17 	const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
18 	uint32_t dtr = 0;
19 
20 	if (usb_enable(NULL)) {
21 		return 0;
22 	}
23 
24 	/* Poll if the DTR flag was set */
25 	while (!dtr) {
26 		uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
27 		/* Give CPU resources to low priority threads. */
28 		k_sleep(K_MSEC(100));
29 	}
30 
31 	while (1) {
32 		printk("Hello World! %s\n", CONFIG_ARCH);
33 		k_sleep(K_SECONDS(1));
34 	}
35 }
36