A PWM library for LPC1768 that enables the sending of n number of PWM impulses through registry editing of LPC1768.
Diff: TruePWM.h
- Revision:
- 0:b3a0656d2b6e
- Child:
- 1:ce44c89d1128
diff -r 000000000000 -r b3a0656d2b6e TruePWM.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TruePWM.h Mon Nov 30 02:41:40 2015 +0000 @@ -0,0 +1,45 @@ +/*--------------TruePWM.h----------*/ +/* +_____ ____ + | \ / / + | \ / / Mechatronics team + | \/ /__ https://developer.mbed.org/teams/TVZ-Mechatronics-Team/ + +Made by: Tomislav Pelko +*/ + +/*TruePWM.h is a class for PWM signal generating trugh NXP LPC1768 registry editing*/ +/*It's main feature is a function that enables the sending of n number of PWM impulses*/ +/*Class still has limits in its use, especially in seting pulsewidth in a civil manner for any other pin than P26*/ +/*This is the first working version and there are no guarantees and I'm not resposible for any fualts*/ + +#ifndef MBED_TRUEPWM_H +#define MBED_TRUEPWM_H + +#include "mbed.h" +#include <Ticker.h> +#include "LPC17xx.h" + +class TruePWM { + public: + TruePWM(PinName); + + void stopPWM(); + void startPWM(); + void pulsewidth_us( uint32_t); + void period_us( uint32_t); + uint32_t getPeriod( void ); + uint32_t getPulsewidth(); + void nImpulse(int); //Function for sending n number of pwm impulses + void setDuty(float); + void pulsewidth_us_ind (uint32_t , char); // + + +private: + void initTruePWM(); //For initial setup + Timeout t0; //A timer is used to control the number of PWM impulses sent + + +}; + +#endif \ No newline at end of file