CQ_KIT_Ver1_5
Dependencies: mbed RateLimiter BLDCmotorDriverCQ_KIT_Ver1_5
Diff: X_NUCLEO_IHM07M1/SPN7Driver.cpp
- Revision:
- 4:3f63eed73ad1
- Parent:
- 3:4c71d3475814
- Child:
- 5:3290e8857120
diff -r 4c71d3475814 -r 3f63eed73ad1 X_NUCLEO_IHM07M1/SPN7Driver.cpp --- a/X_NUCLEO_IHM07M1/SPN7Driver.cpp Thu Oct 13 15:48:50 2016 +0000 +++ b/X_NUCLEO_IHM07M1/SPN7Driver.cpp Fri Oct 14 13:45:35 2016 +0000 @@ -72,6 +72,15 @@ H3.fall(this, &SPN7Driver::commutation); } +void SPN7Driver::setDutyCycle(float dc) { + if (dc >= -1 && dc <= 1) { + ticker.attach(this, &SPN7Driver::commutation, sampleTime); + tempDutyCycle = dc; + } else { + coast(); + } +} + // 6-step phase commutation void SPN7Driver::commutation() {