g
BLDCmotorDriver.h
- Committer:
- 18fmr36
- Date:
- 2020-03-06
- Revision:
- 5:ec87b823b7f8
- Parent:
- 4:f56d1fb53d9b
File content as of revision 5:ec87b823b7f8:
#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 c1, PinName c2, PinName c3,PinName Fault); void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope); void setDutyCycle(float dutyCycle); void coast(); float getDutyCycle(); float getCurrent(); int getSector(); void ispis(); protected: PwmOut GH_A, GH_B, GH_C; DigitalOut GL_A, GL_B, GL_C; // Low-side gates are never PWM driven InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20 InterruptIn H2; InterruptIn H3; AnalogIn C1,C2,C3; RateLimiter rl; Ticker ticker; float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime; void commutation(); int currentSector, _currentSector, previousSector, difference; DigitalOut Fault; int h1, h2, h3; float c1,c2,c3; //void adjustDutyCycle(); float e_th; };