forked from simplefoc/Arduino-FOC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStepperDriver8PWM.h
More file actions
68 lines (58 loc) · 2.12 KB
/
StepperDriver8PWM.h
File metadata and controls
68 lines (58 loc) · 2.12 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
65
66
67
68
#ifndef STEPPER_DRIVER_4PWM_h
#define STEPPER_DRIVER_4PWM_h
#include "../common/base_classes/StepperDriver.h"
#include "../common/foc_utils.h"
#include "../common/time_utils.h"
#include "../common/defaults.h"
#include "hardware_api.h"
/**
8 pwm stepper driver class
*/
class StepperDriver8PWM : public StepperDriver {
public:
/**
StepperMotor class constructor
@param ph1A 1A phase pwm pin
@param ph1B 1B phase pwm pin
@param ph2A 2A phase pwm pin
@param ph2B 2B phase pwm pin
@param ph3A 3A phase pwm pin
@param ph3B 3B phase pwm pin
@param ph4A 4A phase pwm pin
@param ph4B 4B phase pwm pin
@param en1 enable pin phase 1 (optional input)
@param en2 enable pin phase 2 (optional input)
@param en3 enable pin phase 3 (optional input)
@param en4 enable pin phase 4 (optional input)
*/
StepperDriver8PWM(int ph1A, int ph1B, int ph2A, int ph2B, int ph3A, int ph3B, int ph4A, int ph4B, int en1 = NOT_SET, int en2 = NOT_SET, int en3 = NOT_SET, int en4 = NOT_SET);
/** Motor hardware init function */
int init() override;
/** Motor disable function */
void disable() override;
/** Motor enable function */
void enable() override;
float dead_zone; //!< a percentage of dead-time(zone) (both high and low side in low) for each pwm cycle [0,1]
// hardware variables
int pwm1A; //!< phase 1A pwm pin number
int pwm1B; //!< phase 1B pwm pin number
int pwm2A; //!< phase 2A pwm pin number
int pwm2B; //!< phase 2B pwm pin number
int pwm3A; //!< phase 3A pwm pin number
int pwm3B; //!< phase 3B pwm pin number
int pwm4A; //!< phase 4A pwm pin number
int pwm4B; //!< phase 4B pwm pin number
int enable_pin1; //!< enable pin number phase 1
int enable_pin2; //!< enable pin number phase 2
int enable_pin3; //!< enable pin number phase 3
int enable_pin4; //!< enable pin number phase 4
/**
* Set phase voltages to the harware
*
* @param Ua phase A voltage
* @param Ub phase B voltage
*/
void setPwm(float Ua, float Ub) override;
private:
};
#endif