Jean Mercier / Mbed 2 deprecated jmMotor

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers jmMotor.h Source File

jmMotor.h

00001 /*************************************************************************
00002  * @file    jmMotor.h
00003  * @brief   Control motor drive, direction and repetition on mbed DIP5 to 30.
00004  *          Up to 4 motors can be controlled at the same time.
00005  *             
00006  * @version 1.0
00007  * @date    Feb 12, 2011
00008  */
00009 
00010 /*
00011    * Module Command Line Interface 
00012      Format: command name (arg info)min..max values [optional argument]
00013    
00014      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]
00015 
00016    * Module Events
00017          On terminating cycles, send Message: GPPMT id dirPin drivePinB 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 Motordef
00025   #define Motordef 1
00026 
00027   #define motorQty 4 // max number of motor
00028   
00029   #include "LPC17xx.h"
00030 
00031   // Module Data Structure
00032   extern struct StructMotor{
00033      uint8_t active; 
00034      uint8_t direction; 
00035      uint8_t tOff;       
00036      uint8_t tOn;
00037      uint8_t state;
00038      uint16_t dirPin;
00039      uint16_t drivePin;
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   }sMotor[motorQty]; 
00047 #endif
00048 
00049 // Module Prototypes
00050 void cli_Motor(void);
00051 void MotorInit(void);
00052 void MotorSM(void);
00053 void cli_MotorSpeed(void);
00054 void cli_GPPMT(void);
00055 void rGPPMT(unsigned int id);
00056 
00057 //-------------------------- CLIG PLUGS --------------------
00058 // CLIG-INCLUDE
00059 /*
00060 #include "jmMotor.h"
00061 */
00062 
00063 // CLIG-CMD
00064 /*
00065 motor cli_Motor();
00066 GPPMT cli_GPPMT();
00067 motorSpeed cli_MotorSpeed();
00068 */
00069 
00070 // CLIG-INIT
00071 /*
00072    MotorInit();
00073 */
00074 
00075 // CLIG-TIMER
00076 /*
00077    // Module jmMotor
00078    for(i=0;i<motorQty;i++)if(sMotor[i].eggTimer>0)sMotor[i].eggTimer--;
00079 */
00080 
00081 // CLIG-SM
00082 /*
00083      MotorSM();
00084 */
00085