Henk Meewis / Mbed 2 deprecated frdm_echo

Dependencies:   mbed

main.cpp

Committer:
silverpanda
Date:
2014-04-14
Revision:
7:19da09fe546b
Parent:
6:78a965b2d2df

File content as of revision 7:19da09fe546b:

// Print "Hello World" to the PC

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

Ticker *scanTicker;
Shell *usbSerialShell;
LEDColors *ledColors;

bool scanUSBSerialRxFlag;

void at10msTick()
{
    scanUSBSerialRxFlag = true;
    ledColors->tick10ms();
}
//-----------------------------------------------------------------------------

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 = new Ticker();
    scanTicker->attach(&at10msTick, 0.01);
    scanUSBSerialRxFlag = false;
    
    ledColors = new LEDColors();
}
//-----------------------------------------------------------------------------

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