g

Committer:
18fmr36
Date:
Fri Mar 06 05:56:10 2020 +0000
Revision:
5:ec87b823b7f8
Parent:
4:f56d1fb53d9b
hh

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mslovic 0:5602fba2a7f7 1 #include "mbed.h"
mslovic 0:5602fba2a7f7 2 #include "RateLimiter.h"
mslovic 0:5602fba2a7f7 3
mslovic 0:5602fba2a7f7 4 class BLDCmotorDriver {
mslovic 0:5602fba2a7f7 5 public:
18fmr36 5:ec87b823b7f8 6 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);
mslovic 0:5602fba2a7f7 7 void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope);
mslovic 0:5602fba2a7f7 8 void setDutyCycle(float dutyCycle);
mslovic 0:5602fba2a7f7 9 void coast();
mslovic 0:5602fba2a7f7 10 float getDutyCycle();
18fmr36 5:ec87b823b7f8 11 float getCurrent();
tbjazic 1:786897114846 12 int getSector();
mslovic 3:a4b4a8e3f2a0 13 void ispis();
18fmr36 5:ec87b823b7f8 14
mslovic 3:a4b4a8e3f2a0 15
avilei 4:f56d1fb53d9b 16 protected:
tbjazic 1:786897114846 17 PwmOut GH_A, GH_B, GH_C;
tbjazic 1:786897114846 18 DigitalOut GL_A, GL_B, GL_C; // Low-side gates are never PWM driven
tbjazic 1:786897114846 19 InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20
tbjazic 1:786897114846 20 InterruptIn H2;
tbjazic 1:786897114846 21 InterruptIn H3;
18fmr36 5:ec87b823b7f8 22 AnalogIn C1,C2,C3;
mslovic 0:5602fba2a7f7 23 RateLimiter rl;
mslovic 0:5602fba2a7f7 24 Ticker ticker;
mslovic 0:5602fba2a7f7 25 float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime;
tbjazic 1:786897114846 26 void commutation();
mslovic 3:a4b4a8e3f2a0 27 int currentSector, _currentSector, previousSector, difference;
mslovic 3:a4b4a8e3f2a0 28 DigitalOut Fault;
mslovic 3:a4b4a8e3f2a0 29 int h1, h2, h3;
18fmr36 5:ec87b823b7f8 30 float c1,c2,c3;
mslovic 3:a4b4a8e3f2a0 31 //void adjustDutyCycle();
18fmr36 5:ec87b823b7f8 32
18fmr36 5:ec87b823b7f8 33 float e_th;
mslovic 3:a4b4a8e3f2a0 34
mslovic 0:5602fba2a7f7 35 };