Last active
March 11, 2020 20:11
-
-
Save carlosedp/bdc0c4e41a49c68a64ab8aab11521ad9 to your computer and use it in GitHub Desktop.
Zephyr RTOS Console Echo Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <zephyr.h> | |
#include <version.h> | |
#include <string.h> | |
#include <sys/printk.h> | |
#include <console/console.h> | |
void main(void) | |
{ | |
printk("Hello! I'm running Zephyr %s on %s, a %s board.\n\n ", KERNEL_VERSION_STRING, CONFIG_BOARD, CONFIG_ARCH); | |
console_getline_init(); | |
printk("Enter a line finishing with Enter:\n"); | |
while (1) | |
{ | |
printk("> "); | |
char *s = console_getline(); | |
printk("Typed line: %s\n", s); | |
printk("Last char was: 0x%x\n", s[strlen(s) - 1]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment