20200821_motacon_ver4
Diff: BLDCmotorDriver.h
- Revision:
- 2:7aae78b85e1d
- Parent:
- 0:5602fba2a7f7
--- a/BLDCmotorDriver.h Fri May 22 22:43:39 2015 +0000 +++ b/BLDCmotorDriver.h Mon Jun 01 13:40:39 2015 +0000 @@ -3,21 +3,27 @@ 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 GH_A, PinName GL_A, PinName GH_B, PinName GL_B, PinName GH_C, PinName GL_C, PinName h1, PinName h2, PinName h3, PinName Fault); void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope); void setDutyCycle(float dutyCycle); void coast(); float getDutyCycle(); - int HallRead(); + int getSector(); + void ispis(); + 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; RateLimiter rl; Ticker ticker; float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime; - void komutacijaBLDC(); - int sektor; - DigitalOut Led1; + void commutation(); + int currentSector, _currentSector, previousSector, difference; + DigitalOut Fault; + int h1, h2, h3; + //void adjustDutyCycle(); + }; \ No newline at end of file