Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /************************************************************************* 00002 * @file main.cpp 00003 * 00004 * @version 1.0 00005 * @date Feb 12, 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 00018 LPC_GPIO_TypeDef *jmGPIO[5] ={LPC_GPIO0,LPC_GPIO1,LPC_GPIO2,LPC_GPIO3,LPC_GPIO4}; 00019 00020 // CLIG-INCLUDE 00021 #include "jmLPC17xx_gpio.h" 00022 #include "jmMotor.h" 00023 #include "jmPulse.h" 00024 #include "jmStepper.h" 00025 #include "jmStepperAxis.h" 00026 #include "jmSwitch.h" 00027 00028 00029 // Initializations 00030 void Inits(){ 00031 InitCommandLineRingBuffer(); 00032 InitMessages(); 00033 cli_version(); 00034 00035 // CLIG-INIT 00036 MotorInit(); 00037 PulseInit(); 00038 StepperInit(); 00039 StepperAxisInit(); 00040 SwitchModuleReset(); 00041 00042 } 00043 00044 // EggTimer tickers for modules 00045 void eggTimers(){ 00046 int i; 00047 // CLIG-TIMER 00048 // Module jmMotor 00049 for(i=0;i<motorQty;i++)if(sMotor[i].eggTimer>0)sMotor[i].eggTimer--; 00050 // Module jmPulse 00051 for(i=0;i<pulseQty;i++)if(sPulse[i].eggTimer>0)sPulse[i].eggTimer--; 00052 // Module jmStepper 00053 for(i=0;i<stepperQty;i++)if(sStepper[i].eggTimer>0)sStepper[i].eggTimer--; 00054 // Module jmSwitch 00055 for(i=0;i<switchQty;i++)if(sSwitch[i].eggTimer>0)sSwitch[i].eggTimer--; 00056 00057 } 00058 00059 int main() { 00060 unsigned char c; 00061 Serial pc(USBTX, USBRX); // communication medium 00062 pc.baud(115200); // 115200 bauds, 8bits, 1 stop, no control flow 00063 Ticker tick; // enable system ticks 00064 tick.attach_us(&eggTimers,1000); // enable and select granularity for egg timers 00065 Inits(); // initialization 00066 00067 while(true){ 00068 if( pc.readable()){ // something to read ? 00069 c= pc.getc(); // read one char 00070 00071 if(Echo) printf("%c",c); // echo it ? 00072 00073 switch(c){ // process it 00074 00075 case 8 : DelChar(pLine); // remove last one 00076 break; 00077 case 10 : Insert(c,pLine); // end of line 00078 Interpret();// process line 00079 break; 00080 default : Insert(c,pLine); // insert char in command line buffer 00081 } 00082 } // if 00083 00084 // CLIG-SM 00085 MotorSM(); 00086 PulseSM(); 00087 StepperSM(); 00088 StepperAxisSM(); 00089 SwitchEdgeDetect(); 00090 00091 00092 }// while 00093 }// main 00094 00095 00096
Generated on Sat Jul 16 2022 00:01:14 by
1.7.2