Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
jmPulse.h
00001 /************************************************************************* 00002 * @file jmPulse.h 00003 * @brief Control pulse duration and repetition on digital mbed pins 00004 * Up to 8 pins can be controlled at the same time. 00005 * Single pulse or PWM like waveforms can be generated. 00006 * 00007 * @version 1.1 00008 * @date Feb 12, 2011 00009 */ 00010 00011 /* 00012 * Module Command Line Interface 00013 Format: command name (arg info)min..max values [optional argument] 00014 00015 pulse (pulse number)0..3 (pin number)0..432 (tOn)0..255 (tOff)0..255 (Cycles)[1..65535] 00016 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, 00017 then Return Message: GPPP0 id pin tOn tOff status 00018 00019 Ex: pulse 0 118 1 0 Set output Port1 Bit 18 High 00020 Ex: pulse 0 118 0 1 Reset output Port1 Bit 18 Low 00021 Ex: pulse 0 118 0 0 Toggle Port1 Bit 18 state 00022 00023 * Module Events 00024 On terminating pulse cycles, Return Message: GPPP0 id pin tOn tOff status 00025 00026 * Module Feedback and Help messages may be enabled/disabled by Command Lines. 00027 feedback (enable/disable)0..1 00028 help (enable/disable)0..1 00029 */ 00030 00031 #ifndef Pulsedef 00032 #define Pulsedef 1 00033 00034 #define pulseQty 8 // number of pins for pulse 00035 00036 #include "LPC17xx.h" 00037 00038 // Module Data Structure 00039 extern struct StructPulse{ 00040 uint16_t pin; 00041 uint8_t tOff; 00042 uint8_t tOn; 00043 uint8_t output; 00044 uint8_t state; 00045 uint16_t eggTimer; 00046 uint16_t cycles; 00047 uint32_t bitValue; 00048 LPC_GPIO_TypeDef * port; 00049 }sPulse[pulseQty]; 00050 00051 00052 #endif 00053 00054 // Module Prototypes 00055 void PulseInit(void); 00056 void cli_Pulse(void); 00057 void PulseSM(void); 00058 void SetPulseParam(uint8_t pulseNum, uint16_t pin, uint8_t tOn, uint8_t tOff, uint16_t cycles); 00059 void cli_GPPP0(void); 00060 void rGPPP0(unsigned int id); 00061 void cli_PulseStop(void); 00062 00063 //-------------------------- CLIG PLUGS -------------------- 00064 // CLIG-INCLUDE 00065 /* 00066 #include "jmPulse.h" 00067 */ 00068 00069 // CLIG-CMD 00070 /* 00071 pulse cli_Pulse(); 00072 pulseInit PulseInit(); 00073 pulseStop cli_PulseStop(); 00074 GPPP0 cli_GPPP0(); 00075 */ 00076 00077 // CLIG-INIT 00078 /* 00079 PulseInit(); 00080 */ 00081 00082 // CLIG-TIMER 00083 /* 00084 // Module jmPulse 00085 for(i=0;i<pulseQty;i++)if(sPulse[i].eggTimer>0)sPulse[i].eggTimer--; 00086 */ 00087 00088 // CLIG-SM 00089 /* 00090 PulseSM(); 00091 */ 00092
Generated on Sat Jul 16 2022 00:01:14 by
1.7.2