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

TruePWM.h

Committer:
mcmrk
Date:
2016-10-27
Revision:
2:881243185b6a
Parent:
1:ce44c89d1128

File content as of revision 2:881243185b6a:

/*--------------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