Library for driving a 3-phase brushless DC motor.
Dependents: BLDC_mainProgram STMF302R8_MotorDrive HelloWorld_IHM07M1
BLDCmotorDriver.h
00001 #include "mbed.h" 00002 #include "RateLimiter.h" 00003 00004 class BLDCmotorDriver { 00005 public: 00006 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); 00007 void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope); 00008 void setDutyCycle(float dutyCycle); 00009 void coast(); 00010 float getDutyCycle(); 00011 int getSector(); 00012 void ispis(); 00013 00014 protected: 00015 PwmOut GH_A, GH_B, GH_C; 00016 DigitalOut GL_A, GL_B, GL_C; // Low-side gates are never PWM driven 00017 InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20 00018 InterruptIn H2; 00019 InterruptIn H3; 00020 RateLimiter rl; 00021 Ticker ticker; 00022 float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime; 00023 void commutation(); 00024 int currentSector, _currentSector, previousSector, difference; 00025 DigitalOut Fault; 00026 int h1, h2, h3; 00027 //void adjustDutyCycle(); 00028 00029 };
Generated on Sat Jul 16 2022 18:54:56 by 1.7.2