Jean Mercier / Mbed 2 deprecated jmBridge
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers jmBridge.h Source File

jmBridge.h

00001 /*************************************************************************
00002  * @file    jmBridge.h
00003  * @brief   Bridge control on mbed DIP5 to 30.
00004  *          Up to 4Bridges can be controlled at the same time.
00005  *             
00006  * @version 1.0
00007  * @date    Feb 18, 2011
00008  */
00009 
00010 /*
00011    * Module Command Line Interface 
00012      Format: command name (arg info)min..max values [optional argument]
00013    
00014      bridge (Bridge ID)0..3 (PinA)0..432 (PinB)0..432 (Direction)0..1 (tOn)0..255 (tOff)0..255 (Cycles)[1..65535]
00015 
00016    * Module Events
00017          On terminating cycles, send Message: GPPBR id PinA PinB tOn tOff status
00018 
00019    *  Module Feedback and Help messages may be enabled/disabled by Command Lines.
00020          feedback (enable/disable)0..1
00021          help (enable/disable)0..1
00022 */
00023 
00024 #ifndef Bridgedef
00025   #define Bridgedef 1
00026 
00027   #define bridgeQty 4 // max number of Bridge
00028   
00029   #include "LPC17xx.h"
00030 
00031   // Module Data Structure
00032   extern struct StructBridge{
00033      uint8_t active; 
00034      uint8_t direction; 
00035      uint8_t tOff;       
00036      uint8_t tOn;
00037      uint8_t state;
00038      uint16_t pinA;
00039      uint16_t pinB;
00040      uint16_t eggTimer;
00041      uint16_t cycles;
00042      uint32_t dirBitValue;
00043      LPC_GPIO_TypeDef * dirPort;
00044      uint32_t driveBitValue;
00045      LPC_GPIO_TypeDef * drivePort;
00046   }sBridge[bridgeQty];
00047 
00048 #endif
00049 
00050 // Module Prototypes
00051 void cli_Bridge(void);
00052 void BridgeInit(void);
00053 void BridgeSM(void);
00054 void cli_BridgeDC(void);
00055 void cli_GPPBD(void);
00056 void rGPPBD(unsigned int id);
00057 
00058 //-------------------------- CLIG PLUGS --------------------
00059 // CLIG-INCLUDE
00060 /*
00061 #include "jmBridge.h"
00062 */
00063 
00064 // CLIG-CMD
00065 /*
00066 bridge cli_Bridge();
00067 GPPBD cli_GPPBD();
00068 bridgeDC cli_BridgeDC();
00069 */
00070 
00071 // CLIG-INIT
00072 /*
00073    BridgeInit();
00074 */
00075 
00076 // CLIG-TIMER
00077 /*
00078    // Module jmBridge
00079    for(i=0;i<bridgeQty;i++)if(sBridge[i].eggTimer>0)sBridge[i].eggTimer--;
00080 */
00081 
00082 // CLIG-SM
00083 /*
00084      BridgeSM();
00085 */
00086