SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
StepperDriver4PWM.h
Go to the documentation of this file.
1#ifndef STEPPER_DRIVER_4PWM_h
2#define STEPPER_DRIVER_4PWM_h
3
4#include "../common/base_classes/StepperDriver.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 4 pwm stepper driver class
12*/
14{
15 public:
16 /**
17 StepperMotor class constructor
18 @param ph1A 1A phase pwm pin
19 @param ph1B 1B phase pwm pin
20 @param ph2A 2A phase pwm pin
21 @param ph2B 2B phase pwm pin
22 @param en1 enable pin phase 1 (optional input)
23 @param en2 enable pin phase 2 (optional input)
24 */
25 StepperDriver4PWM(int ph1A,int ph1B,int ph2A,int ph2B, int en1 = NOT_SET, int en2 = NOT_SET);
26
27 /** Motor hardware init function */
28 int init() override;
29 /** Motor disable function */
30 void disable() override;
31 /** Motor enable function */
32 void enable() override;
33
34 // hardware variables
35 int pwm1A; //!< phase 1A pwm pin number
36 int pwm1B; //!< phase 1B pwm pin number
37 int pwm2A; //!< phase 2A pwm pin number
38 int pwm2B; //!< phase 2B pwm pin number
39 int enable_pin1; //!< enable pin number phase 1
40 int enable_pin2; //!< enable pin number phase 2
41
42 /**
43 * Set phase voltages to the harware
44 *
45 * @param Ua phase A voltage
46 * @param Ub phase B voltage
47 */
48 void setPwm(float Ua, float Ub) override;
49
50
51 /**
52 * Set phase voltages to the hardware.
53 * > Only possible is the driver has separate enable pins for both phases!
54 *
55 * @param sa phase A state : active / disabled ( high impedance )
56 * @param sb phase B state : active / disabled ( high impedance )
57 */
58 virtual void setPhaseState(PhaseState sa, PhaseState sb) override;
59
60 private:
61
62};
63
64
65#endif
PhaseState
Definition FOCDriver.h:7
int pwm1B
phase 1B pwm pin number
void setPwm(float Ua, float Ub) override
int pwm1A
phase 1A pwm pin number
int enable_pin2
enable pin number phase 2
virtual void setPhaseState(PhaseState sa, PhaseState sb) override
void disable() override
int pwm2A
phase 2A pwm pin number
int pwm2B
phase 2B pwm pin number
void enable() override
int enable_pin1
enable pin number phase 1
#define NOT_SET
Definition foc_utils.h:34