Motacon_20200317
Dependents: HelloWorld_MotorKaisei
BLDCmotorDriver.h@7:fb9e3b508237, 2020-03-17 (annotated)
- Committer:
- MPPT51
- Date:
- Tue Mar 17 05:11:00 2020 +0000
- Revision:
- 7:fb9e3b508237
- Parent:
- 6:959e725b6be9
motorcon
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: |
mslovic | 3:a4b4a8e3f2a0 | 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 Fault); |
mslovic | 0:5602fba2a7f7 | 7 | void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope); |
mslovic | 0:5602fba2a7f7 | 8 | void setDutyCycle(float dutyCycle); |
MPPT51 | 7:fb9e3b508237 | 9 | void setDirection(float direction); //方向決定スイッチ |
mslovic | 0:5602fba2a7f7 | 10 | void coast(); |
mslovic | 0:5602fba2a7f7 | 11 | float getDutyCycle(); |
tbjazic | 1:786897114846 | 12 | int getSector(); |
mslovic | 3:a4b4a8e3f2a0 | 13 | void ispis(); |
mslovic | 3:a4b4a8e3f2a0 | 14 | |
mslovic | 0:5602fba2a7f7 | 15 | private: |
MPPT51 | 6:959e725b6be9 | 16 | PwmOut GL_A, GL_B, GL_C; |
MPPT51 | 6:959e725b6be9 | 17 | DigitalOut GH_A, GH_B, GH_C; // Low-side gates are never PWM driven |
tbjazic | 1:786897114846 | 18 | InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20 |
tbjazic | 1:786897114846 | 19 | InterruptIn H2; |
tbjazic | 1:786897114846 | 20 | InterruptIn H3; |
mslovic | 0:5602fba2a7f7 | 21 | RateLimiter rl; |
mslovic | 0:5602fba2a7f7 | 22 | Ticker ticker; |
mslovic | 0:5602fba2a7f7 | 23 | float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime; |
MPPT51 | 7:fb9e3b508237 | 24 | int direction; |
tbjazic | 1:786897114846 | 25 | void commutation(); |
mslovic | 3:a4b4a8e3f2a0 | 26 | int currentSector, _currentSector, previousSector, difference; |
mslovic | 3:a4b4a8e3f2a0 | 27 | DigitalOut Fault; |
mslovic | 3:a4b4a8e3f2a0 | 28 | int h1, h2, h3; |
mslovic | 3:a4b4a8e3f2a0 | 29 | //void adjustDutyCycle(); |
mslovic | 3:a4b4a8e3f2a0 | 30 | |
mslovic | 0:5602fba2a7f7 | 31 | }; |