SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
BLDCDriver6PWM.h
Go to the documentation of this file.
1#ifndef BLDCDriver6PWM_h
2#define BLDCDriver6PWM_h
3
4#include "../common/base_classes/BLDCDriver.h"
5#include "../common/foc_utils.h"
6#include "../common/time_utils.h"
7#include "../common/defaults.h"
8#include "hardware_api.h"
9
10/**
11 6 pwm bldc driver class
12*/
14{
15 public:
16 /**
17 BLDCDriver class constructor
18 @param phA_h A phase pwm pin
19 @param phA_l A phase pwm pin
20 @param phB_h B phase pwm pin
21 @param phB_l A phase pwm pin
22 @param phC_h C phase pwm pin
23 @param phC_l A phase pwm pin
24 @param en enable pin (optional input)
25 */
26 BLDCDriver6PWM(int phA_h,int phA_l,int phB_h,int phB_l,int phC_h,int phC_l, int en = NOT_SET);
27
28 /** Motor hardware init function */
29 int init() override;
30 /** Motor disable function */
31 void disable() override;
32 /** Motor enable function */
33 void enable() override;
34
35 // hardware variables
36 int pwmA_h,pwmA_l; //!< phase A pwm pin number
37 int pwmB_h,pwmB_l; //!< phase B pwm pin number
38 int pwmC_h,pwmC_l; //!< phase C pwm pin number
39 int enable_pin; //!< enable pin number
40
41 float dead_zone; //!< a percentage of dead-time(zone) (both high and low side in low) for each pwm cycle [0,1]
42
43 PhaseState phase_state[3]; //!< phase state (active / disabled)
44
45
46 /**
47 * Set phase voltages to the harware
48 *
49 * @param Ua - phase A voltage
50 * @param Ub - phase B voltage
51 * @param Uc - phase C voltage
52 */
53 void setPwm(float Ua, float Ub, float Uc) override;
54
55 /**
56 * Set phase voltages to the harware
57 *
58 * @param sc - phase A state : active / disabled ( high impedance )
59 * @param sb - phase B state : active / disabled ( high impedance )
60 * @param sa - phase C state : active / disabled ( high impedance )
61 */
62 virtual void setPhaseState(PhaseState sa, PhaseState sb, PhaseState sc) override;
63
64 private:
65
66};
67
68
69#endif
PhaseState
Definition FOCDriver.h:7
void disable() override
int init() override
int pwmB_l
phase B pwm pin number
float dead_zone
a percentage of dead-time(zone) (both high and low side in low) for each pwm cycle [0,...
int pwmA_l
phase A pwm pin number
int enable_pin
enable pin number
virtual void setPhaseState(PhaseState sa, PhaseState sb, PhaseState sc) override
void enable() override
void setPwm(float Ua, float Ub, float Uc) override
PhaseState phase_state[3]
phase state (active / disabled)
int pwmC_l
phase C pwm pin number
#define NOT_SET
Definition foc_utils.h:34