Jean Mercier / Mbed 2 deprecated jmGPIO

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*************************************************************************
00002  * @file         main.cpp
00003  *                  
00004  * @version      1.0
00005  * @date         Feb 11, 2011
00006 */
00007 
00008 #include "mbed.h"
00009 
00010 // Basic includes
00011 #include "jmInterpreter.h"
00012 #include "jmRingBuffer.h"
00013 #include "jmCommands.h"
00014 #include "jmMessages.h"
00015 #include "LPC17xx.h"
00016 
00017 LPC_GPIO_TypeDef *jmGPIO[5] ={LPC_GPIO0,LPC_GPIO1,LPC_GPIO2,LPC_GPIO3,LPC_GPIO4};
00018 
00019 // CLIG-INCLUDE
00020 #include "jmLPC17xx_gpio.h"
00021 
00022 
00023 // Initializations
00024 void Inits(){
00025    InitCommandLineRingBuffer();
00026    InitMessages();
00027    cli_version();
00028 
00029    // CLIG-INIT
00030 
00031 }
00032 
00033 // EggTimer tickers for modules
00034 void eggTimers(){
00035    int i;
00036    // CLIG-TIMER
00037 
00038 }
00039 
00040 int main() {
00041    unsigned char c;
00042    Serial pc(USBTX, USBRX);          // communication medium
00043    pc.baud(115200);                  // 115200 bauds, 8bits, 1 stop, no control flow
00044    Ticker tick;                      // enable system ticks
00045    tick.attach_us(&eggTimers,1000);  // enable and select granularity for egg timers
00046    Inits();                          // initialization
00047 
00048    while(true){
00049      if( pc.readable()){             // something to read ?
00050         c= pc.getc();                // read one char   
00051 
00052         if(Echo) printf("%c",c);     // echo it ?
00053 
00054         switch(c){                   // process it
00055 
00056           case  8 : DelChar(pLine);  // remove last one
00057                     break;
00058           case 10 : Insert(c,pLine); // end of line
00059                          Interpret();// process line 
00060                     break;
00061           default : Insert(c,pLine); // insert char in command line buffer
00062         }
00063      } // if
00064 
00065      // CLIG-SM
00066 
00067 
00068    }// while
00069 }// main
00070 
00071 
00072