Command all jmCLIG modules from serial port

Committer:
jm
Date:
Sat Feb 12 16:50:25 2011 +0000
Revision:
0:9112e09912db
jmAll Command Line Interface Module

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jm 0:9112e09912db 1 /*************************************************************************
jm 0:9112e09912db 2 * @file jmPulse.h
jm 0:9112e09912db 3 * @brief Control pulse duration and repetition on digital mbed pins
jm 0:9112e09912db 4 * Up to 8 pins can be controlled at the same time.
jm 0:9112e09912db 5 * Single pulse or PWM like waveforms can be generated.
jm 0:9112e09912db 6 *
jm 0:9112e09912db 7 * @version 1.1
jm 0:9112e09912db 8 * @date Feb 12, 2011
jm 0:9112e09912db 9 */
jm 0:9112e09912db 10
jm 0:9112e09912db 11 /*
jm 0:9112e09912db 12 * Module Command Line Interface
jm 0:9112e09912db 13 Format: command name (arg info)min..max values [optional argument]
jm 0:9112e09912db 14
jm 0:9112e09912db 15 pulse (pulse number)0..3 (pin number)0..432 (tOn)0..255 (tOff)0..255 (Cycles)[1..65535]
jm 0:9112e09912db 16 Ex: pulse 0 118 5 10 20 Pulse Port1 Bit 18 High for 5 tick units, then Low for 10 ticks and repeat 20 times,
jm 0:9112e09912db 17 then Return Message: GPPP0 id pin tOn tOff status
jm 0:9112e09912db 18
jm 0:9112e09912db 19 Ex: pulse 0 118 1 0 Set output Port1 Bit 18 High
jm 0:9112e09912db 20 Ex: pulse 0 118 0 1 Reset output Port1 Bit 18 Low
jm 0:9112e09912db 21 Ex: pulse 0 118 0 0 Toggle Port1 Bit 18 state
jm 0:9112e09912db 22
jm 0:9112e09912db 23 * Module Events
jm 0:9112e09912db 24 On terminating pulse cycles, Return Message: GPPP0 id pin tOn tOff status
jm 0:9112e09912db 25
jm 0:9112e09912db 26 * Module Feedback and Help messages may be enabled/disabled by Command Lines.
jm 0:9112e09912db 27 feedback (enable/disable)0..1
jm 0:9112e09912db 28 help (enable/disable)0..1
jm 0:9112e09912db 29 */
jm 0:9112e09912db 30
jm 0:9112e09912db 31 #ifndef Pulsedef
jm 0:9112e09912db 32 #define Pulsedef 1
jm 0:9112e09912db 33
jm 0:9112e09912db 34 #define pulseQty 8 // number of pins for pulse
jm 0:9112e09912db 35
jm 0:9112e09912db 36 #include "LPC17xx.h"
jm 0:9112e09912db 37
jm 0:9112e09912db 38 // Module Data Structure
jm 0:9112e09912db 39 extern struct StructPulse{
jm 0:9112e09912db 40 uint16_t pin;
jm 0:9112e09912db 41 uint8_t tOff;
jm 0:9112e09912db 42 uint8_t tOn;
jm 0:9112e09912db 43 uint8_t output;
jm 0:9112e09912db 44 uint8_t state;
jm 0:9112e09912db 45 uint16_t eggTimer;
jm 0:9112e09912db 46 uint16_t cycles;
jm 0:9112e09912db 47 uint32_t bitValue;
jm 0:9112e09912db 48 LPC_GPIO_TypeDef * port;
jm 0:9112e09912db 49 }sPulse[pulseQty];
jm 0:9112e09912db 50
jm 0:9112e09912db 51
jm 0:9112e09912db 52 #endif
jm 0:9112e09912db 53
jm 0:9112e09912db 54 // Module Prototypes
jm 0:9112e09912db 55 void PulseInit(void);
jm 0:9112e09912db 56 void cli_Pulse(void);
jm 0:9112e09912db 57 void PulseSM(void);
jm 0:9112e09912db 58 void SetPulseParam(uint8_t pulseNum, uint16_t pin, uint8_t tOn, uint8_t tOff, uint16_t cycles);
jm 0:9112e09912db 59 void cli_GPPP0(void);
jm 0:9112e09912db 60 void rGPPP0(unsigned int id);
jm 0:9112e09912db 61 void cli_PulseStop(void);
jm 0:9112e09912db 62
jm 0:9112e09912db 63 //-------------------------- CLIG PLUGS --------------------
jm 0:9112e09912db 64 // CLIG-INCLUDE
jm 0:9112e09912db 65 /*
jm 0:9112e09912db 66 #include "jmPulse.h"
jm 0:9112e09912db 67 */
jm 0:9112e09912db 68
jm 0:9112e09912db 69 // CLIG-CMD
jm 0:9112e09912db 70 /*
jm 0:9112e09912db 71 pulse cli_Pulse();
jm 0:9112e09912db 72 pulseInit PulseInit();
jm 0:9112e09912db 73 pulseStop cli_PulseStop();
jm 0:9112e09912db 74 GPPP0 cli_GPPP0();
jm 0:9112e09912db 75 */
jm 0:9112e09912db 76
jm 0:9112e09912db 77 // CLIG-INIT
jm 0:9112e09912db 78 /*
jm 0:9112e09912db 79 PulseInit();
jm 0:9112e09912db 80 */
jm 0:9112e09912db 81
jm 0:9112e09912db 82 // CLIG-TIMER
jm 0:9112e09912db 83 /*
jm 0:9112e09912db 84 // Module jmPulse
jm 0:9112e09912db 85 for(i=0;i<pulseQty;i++)if(sPulse[i].eggTimer>0)sPulse[i].eggTimer--;
jm 0:9112e09912db 86 */
jm 0:9112e09912db 87
jm 0:9112e09912db 88 // CLIG-SM
jm 0:9112e09912db 89 /*
jm 0:9112e09912db 90 PulseSM();
jm 0:9112e09912db 91 */
jm 0:9112e09912db 92