-
Notifications
You must be signed in to change notification settings - Fork 691
Expand file tree
/
Copy pathBLDCDriver3PWM.h
More file actions
64 lines (56 loc) · 1.86 KB
/
BLDCDriver3PWM.h
File metadata and controls
64 lines (56 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef BLDCDriver3PWM_h
#define BLDCDriver3PWM_h
#include "../common/base_classes/BLDCDriver.h"
#include "../common/foc_utils.h"
#include "../common/time_utils.h"
#include "../common/defaults.h"
#include "hardware_api.h"
/**
3 pwm bldc driver class
*/
class BLDCDriver3PWM: public BLDCDriver
{
public:
/**
BLDCDriver class constructor
@param phA A phase pwm pin
@param phB B phase pwm pin
@param phC C phase pwm pin
@param en1 enable pin (optional input)
@param en2 enable pin (optional input)
@param en3 enable pin (optional input)
*/
BLDCDriver3PWM(int phA,int phB,int phC, int en1 = NOT_SET, int en2 = NOT_SET, int en3 = NOT_SET);
/** Motor hardware init function */
virtual int init() override;
/** Motor disable function */
virtual void disable() override;
/** Motor enable function */
virtual void enable() override;
// hardware variables
int pwmA; //!< phase A pwm pin number
int pwmB; //!< phase B pwm pin number
int pwmC; //!< phase C pwm pin number
int enableA_pin; //!< enable pin number
int enableB_pin; //!< enable pin number
int enableC_pin; //!< enable pin number
/**
* Set phase voltages to the hardware
*
* @param Ua - phase A voltage
* @param Ub - phase B voltage
* @param Uc - phase C voltage
*/
virtual void setPwm(float Ua, float Ub, float Uc) override;
/**
* Set phase voltages to the hardware
* > Only possible is the driver has separate enable pins for all phases!
*
* @param sc - phase A state : active / disabled ( high impedance )
* @param sb - phase B state : active / disabled ( high impedance )
* @param sa - phase C state : active / disabled ( high impedance )
*/
virtual void setPhaseState(PhaseState sa, PhaseState sb, PhaseState sc) override;
private:
};
#endif