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-20
Revision:
1:ce44c89d1128
Parent:
0:b3a0656d2b6e

File content as of revision 1:ce44c89d1128:

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