CQ_KIT_Ver1_5

BLDCmotorDriver.h

Committer:
mslovic
Date:
2015-05-22
Revision:
0:5602fba2a7f7
Child:
1:786897114846
Child:
2:7aae78b85e1d

File content as of revision 0:5602fba2a7f7:

#include "mbed.h"
#include "RateLimiter.h"

class BLDCmotorDriver {
    public:
        BLDCmotorDriver(PinName GH_A, PinName GL_A, PinName GH_B, PinName GL_B, PinName GH_C, PinName GL_C, PinName h1, PinName h2, PinName h3, PinName Led1);    
        void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope);
        void setDutyCycle(float dutyCycle);
        void coast();
        float getDutyCycle();
        int HallRead();
    private:
        DigitalIn H1;
        DigitalIn H2;
        DigitalIn H3;
        PwmOut GH_A, GL_A, GH_B, GL_B, GH_C, GL_C;
        RateLimiter rl;
        Ticker ticker;
        float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime;
        void komutacijaBLDC();
        int sektor;
        DigitalOut Led1;      
};