20200821_motacon_ver4
Diff: BLDCmotorDriver.h
- Revision:
- 1:786897114846
- Parent:
- 0:5602fba2a7f7
- Child:
- 3:a4b4a8e3f2a0
diff -r 5602fba2a7f7 -r 786897114846 BLDCmotorDriver.h --- a/BLDCmotorDriver.h Fri May 22 22:43:39 2015 +0000 +++ b/BLDCmotorDriver.h Sun May 24 06:46:25 2015 +0000 @@ -3,21 +3,23 @@ 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); + BLDCmotorDriver(PinName pGH_A, PinName pGH_B, PinName pGH_C, PinName pGL_A, PinName pGL_B, PinName pGL_C, PinName pH1, PinName pH2, PinName pH3, PinName pfault); void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope); void setDutyCycle(float dutyCycle); void coast(); float getDutyCycle(); - int HallRead(); + int getSector(); private: - DigitalIn H1; - DigitalIn H2; - DigitalIn H3; - PwmOut GH_A, GL_A, GH_B, GL_B, GH_C, GL_C; + 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; + DigitalOut fault; RateLimiter rl; Ticker ticker; float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime; - void komutacijaBLDC(); - int sektor; - DigitalOut Led1; + void commutation(); + void adjustDutyCycle(); + int currentSector, previousSector; }; \ No newline at end of file