g
Revision 5:ec87b823b7f8, committed 2020-03-06
- Comitter:
- 18fmr36
- Date:
- Fri Mar 06 05:56:10 2020 +0000
- Parent:
- 4:f56d1fb53d9b
- Commit message:
- hh
Changed in this revision
BLDCmotorDriver.cpp | Show annotated file Show diff for this revision Revisions of this file |
BLDCmotorDriver.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f56d1fb53d9b -r ec87b823b7f8 BLDCmotorDriver.cpp --- a/BLDCmotorDriver.cpp Wed Oct 12 08:16:28 2016 +0000 +++ b/BLDCmotorDriver.cpp Fri Mar 06 05:56:10 2020 +0000 @@ -1,9 +1,9 @@ #include "BLDCmotorDriver.h" BLDCmotorDriver::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) : + PinName pH1, PinName pH2, PinName pH3,PinName pC1, PinName pC2, PinName pC3, PinName pFault) : GH_A(pGH_A), GH_B(pGH_B), GH_C(pGH_C), GL_A(pGL_A), GL_B(pGL_B), GL_C(pGL_C), - H1(pH1), H2(pH2), H3(pH3), Fault(LED1){ + H1(pH1), H2(pH2), H3(pH3),C1(pC1),C2(pC2),C3(pC3),Fault(LED1){ sampleTime = 1e-3; switchingPeriod = 1.0 / 20e3;
diff -r f56d1fb53d9b -r ec87b823b7f8 BLDCmotorDriver.h --- a/BLDCmotorDriver.h Wed Oct 12 08:16:28 2016 +0000 +++ b/BLDCmotorDriver.h Fri Mar 06 05:56:10 2020 +0000 @@ -3,13 +3,15 @@ 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 Fault); + 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 c1, PinName c2, PinName c3,PinName Fault); void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope); void setDutyCycle(float dutyCycle); void coast(); float getDutyCycle(); + float getCurrent(); int getSector(); void ispis(); + protected: PwmOut GH_A, GH_B, GH_C; @@ -17,6 +19,7 @@ InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20 InterruptIn H2; InterruptIn H3; + AnalogIn C1,C2,C3; RateLimiter rl; Ticker ticker; float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime; @@ -24,6 +27,9 @@ int currentSector, _currentSector, previousSector, difference; DigitalOut Fault; int h1, h2, h3; + float c1,c2,c3; //void adjustDutyCycle(); + + float e_th; }; \ No newline at end of file