Skip to content

Instantly share code, notes, and snippets.

@carlosedp
Last active March 11, 2020 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosedp/bdc0c4e41a49c68a64ab8aab11521ad9 to your computer and use it in GitHub Desktop.
Save carlosedp/bdc0c4e41a49c68a64ab8aab11521ad9 to your computer and use it in GitHub Desktop.
Zephyr RTOS Console Echo Demo
#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