20200821_motacon_ver4
BLDCmotorDriver.h@1:786897114846, 2015-05-24 (annotated)
- Committer:
- tbjazic
- Date:
- Sun May 24 06:46:25 2015 +0000
- Revision:
- 1:786897114846
- Parent:
- 0:5602fba2a7f7
- Child:
- 3:a4b4a8e3f2a0
InterruptIn pins added instead of DigitalOut pins for Hall sensors, some changes in variables and function names, added adjustDutyCycle member function. Commutation function still needs to be fixed.
Who changed what in which revision?
User | Revision | Line number | New 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: |
tbjazic | 1:786897114846 | 6 | 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); |
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(); |
tbjazic | 1:786897114846 | 11 | int getSector(); |
mslovic | 0:5602fba2a7f7 | 12 | private: |
tbjazic | 1:786897114846 | 13 | PwmOut GH_A, GH_B, GH_C; |
tbjazic | 1:786897114846 | 14 | DigitalOut GL_A, GL_B, GL_C; // Low-side gates are never PWM driven |
tbjazic | 1:786897114846 | 15 | InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20 |
tbjazic | 1:786897114846 | 16 | InterruptIn H2; |
tbjazic | 1:786897114846 | 17 | InterruptIn H3; |
tbjazic | 1:786897114846 | 18 | DigitalOut fault; |
mslovic | 0:5602fba2a7f7 | 19 | RateLimiter rl; |
mslovic | 0:5602fba2a7f7 | 20 | Ticker ticker; |
mslovic | 0:5602fba2a7f7 | 21 | float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime; |
tbjazic | 1:786897114846 | 22 | void commutation(); |
tbjazic | 1:786897114846 | 23 | void adjustDutyCycle(); |
tbjazic | 1:786897114846 | 24 | int currentSector, previousSector; |
mslovic | 0:5602fba2a7f7 | 25 | }; |