1 /* 2 * Copyright (c) 2017 Linaro Limited 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #include <zephyr/kernel.h> 7 #include <zephyr/console/console.h> 8 9 static const char prompt[] = "Start typing characters to see them echoed back\r\n"; 10 main(void)11int main(void) 12 { 13 console_init(); 14 15 printk("You should see another line with instructions below. If not,\n"); 16 printk("the (interrupt-driven) console device doesn't work as expected:\n"); 17 console_write(NULL, prompt, sizeof(prompt) - 1); 18 19 while (1) { 20 uint8_t c = console_getchar(); 21 22 console_putchar(c); 23 if (c == '\r') { 24 console_putchar('\n'); 25 } 26 } 27 return 0; 28 } 29