The simplified Example No.1 on mbed LPC1768.

Dependencies:   mbed MicroShell

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "microshell.h"
00003 #include "msconf.h"
00004 
00005 Serial pc(USBTX, USBRX);
00006 
00007 static void utx(char c)
00008 {
00009     pc.putc(c);
00010 }
00011 
00012 static char urx(void)
00013 {
00014     return pc.getc();
00015 }
00016 
00017 static void action_hook(MSCORE_ACTION action)
00018 {
00019 }
00020 
00021 int main(void)
00022 {
00023     char buf[MSCONF_MAX_INPUT_LENGTH];
00024     MICROSHELL ms;
00025 
00026     puts(
00027             "\r\n\r\n"
00028             "======================================\r\n"
00029             " MicroShell Simple Example for LPC824 \r\n"
00030             "======================================\r\n"
00031             );
00032     puts(" Type 'help' for a list of commands.\r\n");
00033 
00034     microshell_init(&ms, utx, urx, action_hook);
00035 
00036     while (1) {
00037         puts("MicroShell>");
00038         microshell_getline(&ms, buf, sizeof(buf));
00039     }
00040 
00041     return 0;
00042 }