20200821_motacon_ver4

Committer:
MPPT51
Date:
Fri Aug 21 08:29:01 2020 +0000
Revision:
6:51643d078474
Parent:
3:a4b4a8e3f2a0
20200821_motacon_ver4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mslovic 0:5602fba2a7f7 1 #include "mbed.h"
mslovic 0:5602fba2a7f7 2
mslovic 0:5602fba2a7f7 3 class BLDCmotorDriver {
mslovic 0:5602fba2a7f7 4 public:
mslovic 3:a4b4a8e3f2a0 5 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 6 void configure(float sampleTime, float switchingFrequency, float rampUpSlope, float rampDownSlope);
mslovic 0:5602fba2a7f7 7 void setDutyCycle(float dutyCycle);
MPPT51 6:51643d078474 8 void setDirection(float direction); //方向決定スイッチ
mslovic 0:5602fba2a7f7 9 void coast();
mslovic 0:5602fba2a7f7 10 float getDutyCycle();
tbjazic 1:786897114846 11 int getSector();
mslovic 3:a4b4a8e3f2a0 12 void ispis();
MPPT51 6:51643d078474 13 short HS_cnt; //short(min:-32768 max: 32767)で充分 //intとかshortのサイズについて:https://os.mbed.com/users/mbed714/notebook/integer-types-int-long-and-long-long/
MPPT51 6:51643d078474 14 bool HS_check; //0か1にしかならなkためboolで宣言
MPPT51 6:51643d078474 15 int HS_usec;
MPPT51 6:51643d078474 16 int rpm_a, rpm_b; //ホールセンサカウンタ(速度計測用)
mslovic 3:a4b4a8e3f2a0 17
mslovic 0:5602fba2a7f7 18 private:
MPPT51 6:51643d078474 19 PwmOut GL_A, GL_B, GL_C; //←ハイサイド・ローサイドの変更
MPPT51 6:51643d078474 20 DigitalOut GH_A, GH_B, GH_C; // Low-side gates are never PWM driven
tbjazic 1:786897114846 21 InterruptIn H1; // InterruptIn can be used on all pins except p19 and p20
tbjazic 1:786897114846 22 InterruptIn H2;
tbjazic 1:786897114846 23 InterruptIn H3;
MPPT51 6:51643d078474 24 Timer t; //回転数用大麻
mslovic 0:5602fba2a7f7 25 Ticker ticker;
mslovic 0:5602fba2a7f7 26 float switchingPeriod, dutyCycle, tempDutyCycle, sampleTime;
MPPT51 6:51643d078474 27 int direction;
tbjazic 1:786897114846 28 void commutation();
MPPT51 6:51643d078474 29 void H1rise(); //ホールセンサ1の立ち上がり時に飛ぶ関数(回転数計測用に使っている)
MPPT51 6:51643d078474 30 int currentSector, _currentSector;
mslovic 3:a4b4a8e3f2a0 31 DigitalOut Fault;
mslovic 3:a4b4a8e3f2a0 32 int h1, h2, h3;
MPPT51 6:51643d078474 33
MPPT51 6:51643d078474 34 int n;
mslovic 3:a4b4a8e3f2a0 35 //void adjustDutyCycle();
mslovic 3:a4b4a8e3f2a0 36
mslovic 0:5602fba2a7f7 37 };