20200821_motacon_ver4

Committer:
mslovic
Date:
Mon Jun 01 13:40:39 2015 +0000
Revision:
2:7aae78b85e1d
Parent:
0:5602fba2a7f7
First working version

Who changed what in which revision?

UserRevisionLine numberNew 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 2:7aae78b85e1d 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);
mslovic 0:5602fba2a7f7 9 void coast();
mslovic 0:5602fba2a7f7 10 float getDutyCycle();
mslovic 2:7aae78b85e1d 11 int getSector();
mslovic 2:7aae78b85e1d 12 void ispis();
mslovic 2:7aae78b85e1d 13
mslovic 0:5602fba2a7f7 14 private:
mslovic 2:7aae78b85e1d 15 PwmOut GH_A, GH_B, GH_C;
mslovic 2:7aae78b85e1d 16 DigitalOut GL_A, GL_B, GL_C; // Low-side gates are never PWM driven
mslovic 2:7aae78b85e1d 17 InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20
mslovic 2:7aae78b85e1d 18 InterruptIn H2;
mslovic 2:7aae78b85e1d 19 InterruptIn H3;
mslovic 0:5602fba2a7f7 20 RateLimiter rl;
mslovic 0:5602fba2a7f7 21 Ticker ticker;
mslovic 0:5602fba2a7f7 22 float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime;
mslovic 2:7aae78b85e1d 23 void commutation();
mslovic 2:7aae78b85e1d 24 int currentSector, _currentSector, previousSector, difference;
mslovic 2:7aae78b85e1d 25 DigitalOut Fault;
mslovic 2:7aae78b85e1d 26 int h1, h2, h3;
mslovic 2:7aae78b85e1d 27 //void adjustDutyCycle();
mslovic 2:7aae78b85e1d 28
mslovic 0:5602fba2a7f7 29 };