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 jmSwitch.h
jm 0:9112e09912db 3 * @brief Command Line Interface Module for reading switches
jm 0:9112e09912db 4 * Up to 8 switches can be defined on any digital mbed Pin.
jm 0:9112e09912db 5 * Provide debounce and edge detection
jm 0:9112e09912db 6 * @version 1.0
jm 0:9112e09912db 7 * @date Feb 2, 2011
jm 0:9112e09912db 8
jm 0:9112e09912db 9 Command Line Interface
jm 0:9112e09912db 10 Format: command name (arg info)min..max values [optional argument]
jm 0:9112e09912db 11 swRead (Switch id)0..3 Return Message: GPPS0 id pin debounce state
jm 0:9112e09912db 12 swInit (Switch id)0..7 (Pin number)0..432 (debounce interval)1..255
jm 0:9112e09912db 13 Initialize a Limit Switch Process and return Message: GPPS0 id pin debounce state
jm 0:9112e09912db 14 GPPS0 Return 8 Message: GPPS0 id pin debounce state
jm 0:9112e09912db 15
jm 0:9112e09912db 16 Module Events
jm 0:9112e09912db 17 On closing of switch, Return Message: GPPS0 id pin debounce state
jm 0:9112e09912db 18 On Opening of switch, Return Message: GPPS0 id pin debounce state
jm 0:9112e09912db 19 */
jm 0:9112e09912db 20
jm 0:9112e09912db 21 #ifndef jmSwitchDef
jm 0:9112e09912db 22 #define jmSwitchDef 1
jm 0:9112e09912db 23 #include "stdint.h"
jm 0:9112e09912db 24 #include "LPC17xx.h"
jm 0:9112e09912db 25
jm 0:9112e09912db 26 #define switchQty 8 // max switch qty
jm 0:9112e09912db 27
jm 0:9112e09912db 28 // Module Data Structure
jm 0:9112e09912db 29 extern struct StructSwitch{
jm 0:9112e09912db 30 uint16_t pin;
jm 0:9112e09912db 31 uint8_t debounce;
jm 0:9112e09912db 32 uint8_t state;
jm 0:9112e09912db 33 uint8_t eggTimer;
jm 0:9112e09912db 34 uint32_t bitValue;
jm 0:9112e09912db 35 LPC_GPIO_TypeDef *port;
jm 0:9112e09912db 36 }sSwitch[switchQty];
jm 0:9112e09912db 37 #endif
jm 0:9112e09912db 38
jm 0:9112e09912db 39 // Module Prototypes
jm 0:9112e09912db 40 void SwitchEdgeDetect(void);
jm 0:9112e09912db 41 void cli_SwitchInit(void);
jm 0:9112e09912db 42 void cli_SwitchRead(void);
jm 0:9112e09912db 43 void cli_GPPS0();
jm 0:9112e09912db 44 void rGPPS0(unsigned int id);
jm 0:9112e09912db 45 void SwitchModuleReset(void);
jm 0:9112e09912db 46
jm 0:9112e09912db 47 //-------------------------- CLIG PLUGS --------------------
jm 0:9112e09912db 48 // CLIG-INCLUDE
jm 0:9112e09912db 49 /*
jm 0:9112e09912db 50 #include "jmSwitch.h"
jm 0:9112e09912db 51
jm 0:9112e09912db 52 */
jm 0:9112e09912db 53
jm 0:9112e09912db 54 // CLIG-INIT
jm 0:9112e09912db 55 /*
jm 0:9112e09912db 56 SwitchModuleReset();
jm 0:9112e09912db 57 */
jm 0:9112e09912db 58
jm 0:9112e09912db 59 // CLIG-TIMER
jm 0:9112e09912db 60 /*
jm 0:9112e09912db 61 // Module jmSwitch
jm 0:9112e09912db 62 for(i=0;i<switchQty;i++)if(sSwitch[i].eggTimer>0)sSwitch[i].eggTimer--;
jm 0:9112e09912db 63 */
jm 0:9112e09912db 64
jm 0:9112e09912db 65 // CLIG-CMD
jm 0:9112e09912db 66 /*
jm 0:9112e09912db 67 swRead cli_SwitchRead();
jm 0:9112e09912db 68 swInit cli_SwitchInit();
jm 0:9112e09912db 69 GPPS0 cli_GPPS0();
jm 0:9112e09912db 70 */
jm 0:9112e09912db 71
jm 0:9112e09912db 72 // CLIG-SM
jm 0:9112e09912db 73 /*
jm 0:9112e09912db 74 SwitchEdgeDetect();
jm 0:9112e09912db 75 */
jm 0:9112e09912db 76
jm 0:9112e09912db 77 //-------------------------- END CLIG PLUGS --------------------