Henk Meewis / Mbed 2 deprecated frdm_echo

Dependencies:   mbed

main.cpp

Committer:
silverpanda
Date:
2014-04-14
Revision:
5:03b7c237c4c4
Parent:
4:dfb672184380
Child:
6:78a965b2d2df

File content as of revision 5:03b7c237c4c4:

// Print "Hello World" to the PC

#include "mbed.h"
#include "shell.h"

Ticker messageTicker, scanTicker;
bool scanUSBSerialRxFlag;
Shell *usbSerialShell;

void setScanUSBSerialRxFlag()
{
    scanUSBSerialRxFlag = true;
}
//-----------------------------------------------------------------------------

void initMain()
{
    // increase the baud rate for the USB serial port
    usbSerialShell = new Shell(115200);
    
    // send greeting with first cursor
    usbSerialShell->sendHelloWorld();
    
    // start polling for characters
    scanTicker.attach(&setScanUSBSerialRxFlag, 0.01);
    scanUSBSerialRxFlag = false;
}
//-----------------------------------------------------------------------------

int main() {
    initMain();
    
    while(true) {
        
        // check the flag 
        if(scanUSBSerialRxFlag) {
            usbSerialShell->scanUSBSerialRx();
            scanUSBSerialRxFlag = false;
        }
        
        // give the main loop some time
        wait(0.02);
    }
}
//-----------------------------------------------------------------------------