A PWM library for LPC1768 that enables the sending of n number of PWM impulses through registry editing of LPC1768.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TruePWM.h Source File

TruePWM.h

00001 /*--------------TruePWM.h----------*/
00002 /*
00003 _____          ____
00004   |    \    /     /   
00005   |     \  /     /    Mechatronics team 
00006   |      \/     /__   https://developer.mbed.org/teams/TVZ-Mechatronics-Team/
00007 
00008 Made by: Tomislav Pelko
00009 */
00010               
00011 /*TruePWM.h is a class for PWM signal generating trugh NXP LPC1768 registry editing*/
00012 /*It's main feature is a function that enables the sending of n number of PWM impulses*/
00013 /*Class still has limits in its use, especially in seting pulsewidth in a civil manner for any other pin than P26*/
00014 /*This is the first working version and there are no guarantees and I'm not resposible for any fualts*/
00015 
00016 #ifndef MBED_TRUEPWM_H
00017 #define MBED_TRUEPWM_H
00018 
00019 #include "mbed.h"
00020 #include <Ticker.h>
00021 #include "LPC17xx.h"
00022 
00023 class TruePWM {
00024      public:
00025      TruePWM(PinName);
00026 
00027     void stopPWM();
00028     void startPWM();
00029     void pulsewidth_us( uint32_t);
00030     void period_us( uint32_t);
00031     uint32_t getPeriod( void );
00032     uint32_t getPulsewidth();
00033     void nImpulse(int);            //Function for sending n number of pwm impulses 
00034     void setDuty(float);
00035     void pulsewidth_us_ind (uint32_t , char);
00036     
00037     
00038 private:  
00039     void initTruePWM();        //For initial setup
00040     Timeout t0;                //A timer is used to control the number of PWM impulses sent
00041     
00042     
00043 };
00044 
00045 #endif