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 jmMotor.h
jm 0:9112e09912db 3 * @brief Control motor drive, direction and repetition on mbed DIP5 to 30.
jm 0:9112e09912db 4 * Up to 4 motors can be controlled at the same time.
jm 0:9112e09912db 5 *
jm 0:9112e09912db 6 * @version 1.0
jm 0:9112e09912db 7 * @date Feb 12, 2011
jm 0:9112e09912db 8 */
jm 0:9112e09912db 9
jm 0:9112e09912db 10 /*
jm 0:9112e09912db 11 * Module Command Line Interface
jm 0:9112e09912db 12 Format: command name (arg info)min..max values [optional argument]
jm 0:9112e09912db 13
jm 0:9112e09912db 14 motor (Motor ID)0..3 (Direction Pin)0..432 (Drive Pin)0..432 (Rotation cw/ccw)0..1 (tOn)0..255 (tOff)0..255 (Cycles)[1..65535]
jm 0:9112e09912db 15
jm 0:9112e09912db 16 * Module Events
jm 0:9112e09912db 17 On terminating cycles, send Message: GPPMT id dirPin drivePinB tOn tOff status
jm 0:9112e09912db 18
jm 0:9112e09912db 19 * Module Feedback and Help messages may be enabled/disabled by Command Lines.
jm 0:9112e09912db 20 feedback (enable/disable)0..1
jm 0:9112e09912db 21 help (enable/disable)0..1
jm 0:9112e09912db 22 */
jm 0:9112e09912db 23
jm 0:9112e09912db 24 #ifndef Motordef
jm 0:9112e09912db 25 #define Motordef 1
jm 0:9112e09912db 26
jm 0:9112e09912db 27 #define motorQty 4 // max number of motor
jm 0:9112e09912db 28
jm 0:9112e09912db 29 #include "LPC17xx.h"
jm 0:9112e09912db 30
jm 0:9112e09912db 31 // Module Data Structure
jm 0:9112e09912db 32 extern struct StructMotor{
jm 0:9112e09912db 33 uint8_t active;
jm 0:9112e09912db 34 uint8_t direction;
jm 0:9112e09912db 35 uint8_t tOff;
jm 0:9112e09912db 36 uint8_t tOn;
jm 0:9112e09912db 37 uint8_t state;
jm 0:9112e09912db 38 uint16_t dirPin;
jm 0:9112e09912db 39 uint16_t drivePin;
jm 0:9112e09912db 40 uint16_t eggTimer;
jm 0:9112e09912db 41 uint16_t cycles;
jm 0:9112e09912db 42 uint32_t dirBitValue;
jm 0:9112e09912db 43 LPC_GPIO_TypeDef * dirPort;
jm 0:9112e09912db 44 uint32_t driveBitValue;
jm 0:9112e09912db 45 LPC_GPIO_TypeDef * drivePort;
jm 0:9112e09912db 46 }sMotor[motorQty];
jm 0:9112e09912db 47 #endif
jm 0:9112e09912db 48
jm 0:9112e09912db 49 // Module Prototypes
jm 0:9112e09912db 50 void cli_Motor(void);
jm 0:9112e09912db 51 void MotorInit(void);
jm 0:9112e09912db 52 void MotorSM(void);
jm 0:9112e09912db 53 void cli_MotorSpeed(void);
jm 0:9112e09912db 54 void cli_GPPMT(void);
jm 0:9112e09912db 55 void rGPPMT(unsigned int id);
jm 0:9112e09912db 56
jm 0:9112e09912db 57 //-------------------------- CLIG PLUGS --------------------
jm 0:9112e09912db 58 // CLIG-INCLUDE
jm 0:9112e09912db 59 /*
jm 0:9112e09912db 60 #include "jmMotor.h"
jm 0:9112e09912db 61 */
jm 0:9112e09912db 62
jm 0:9112e09912db 63 // CLIG-CMD
jm 0:9112e09912db 64 /*
jm 0:9112e09912db 65 motor cli_Motor();
jm 0:9112e09912db 66 GPPMT cli_GPPMT();
jm 0:9112e09912db 67 motorSpeed cli_MotorSpeed();
jm 0:9112e09912db 68 */
jm 0:9112e09912db 69
jm 0:9112e09912db 70 // CLIG-INIT
jm 0:9112e09912db 71 /*
jm 0:9112e09912db 72 MotorInit();
jm 0:9112e09912db 73 */
jm 0:9112e09912db 74
jm 0:9112e09912db 75 // CLIG-TIMER
jm 0:9112e09912db 76 /*
jm 0:9112e09912db 77 // Module jmMotor
jm 0:9112e09912db 78 for(i=0;i<motorQty;i++)if(sMotor[i].eggTimer>0)sMotor[i].eggTimer--;
jm 0:9112e09912db 79 */
jm 0:9112e09912db 80
jm 0:9112e09912db 81 // CLIG-SM
jm 0:9112e09912db 82 /*
jm 0:9112e09912db 83 MotorSM();
jm 0:9112e09912db 84 */
jm 0:9112e09912db 85