SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
FOCDriver.h
Go to the documentation of this file.
1#ifndef FOCDRIVER_H
2#define FOCDRIVER_H
3
4#include "Arduino.h"
5
6
7enum PhaseState : uint8_t {
8 PHASE_OFF = 0, // both sides of the phase are off
9 PHASE_ON = 1, // both sides of the phase are driven with PWM, dead time is applied in 6-PWM mode
10 PHASE_HI = 2, // only the high side of the phase is driven with PWM (6-PWM mode only)
11 PHASE_LO = 3, // only the low side of the phase is driven with PWM (6-PWM mode only)
12};
13
14
21
22/**
23 * FOC driver class
24 */
26 public:
27
28 /** Initialise hardware */
29 virtual int init() = 0;
30 /** Enable hardware */
31 virtual void enable() = 0;
32 /** Disable hardware */
33 virtual void disable() = 0;
34
35 long pwm_frequency; //!< pwm frequency value in hertz
36 float voltage_power_supply; //!< power supply voltage
37 float voltage_limit; //!< limiting voltage set to the motor
38
39 bool initialized = false; //!< true if driver was successfully initialized
40 void* params = 0; //!< pointer to hardware specific parameters of driver
41
42 bool enable_active_high = true; //!< enable pin should be set to high to enable the driver (default is HIGH)
43
44 /** get the driver type*/
45 virtual DriverType type() = 0;
46};
47
48#endif
DriverType
Definition FOCDriver.h:15
@ BLDC
Definition FOCDriver.h:17
@ Hybrid
Definition FOCDriver.h:19
@ Stepper
Definition FOCDriver.h:18
@ UnknownDriver
Definition FOCDriver.h:16
PhaseState
Definition FOCDriver.h:7
@ PHASE_HI
Definition FOCDriver.h:10
@ PHASE_ON
Definition FOCDriver.h:9
@ PHASE_LO
Definition FOCDriver.h:11
@ PHASE_OFF
Definition FOCDriver.h:8
long pwm_frequency
pwm frequency value in hertz
Definition FOCDriver.h:35
virtual void enable()=0
virtual void disable()=0
float voltage_power_supply
power supply voltage
Definition FOCDriver.h:36
virtual DriverType type()=0
virtual int init()=0
bool initialized
true if driver was successfully initialized
Definition FOCDriver.h:39
float voltage_limit
limiting voltage set to the motor
Definition FOCDriver.h:37
bool enable_active_high
enable pin should be set to high to enable the driver (default is HIGH)
Definition FOCDriver.h:42
void * params
pointer to hardware specific parameters of driver
Definition FOCDriver.h:40