Aruna
|
#include <Stepper.h>
Public Member Functions | |
Stepper (uint8_t *pins, size_t pins_count, movement::axis_mask_t axis, bool active_high) | |
Stepper motor. More... | |
void | set_speed (int16_t speed) |
Set speed of the stepper motor. More... | |
void | do_steps (int32_t steps) |
Do an x number of steps. More... | |
~Stepper () | |
destructor. More... | |
![]() | |
Actuator (axis_mask_t axis=axis_mask_t::NONE) | |
Actuator object, used by the movement module for vehicle movement. More... | |
virtual | ~Actuator () |
err_t | set_axis (axis_mask_t new_axis) |
Set the axis that this Actuator is capable in moving in. More... | |
axis_mask_t | get_axis () |
get the movement modes that this driver supports. More... | |
err_t | set (axis_mask_t axisMask, int16_t speed) |
Set the speed of the motors directly. More... | |
uint16_t | get_speed () |
Get the current speed of Actuator. More... | |
Private Member Functions | |
err_t | init_pins () |
initialize the pins for output More... | |
err_t | clear_pins () |
reset the pins back to initial state (run when program is finished) More... | |
virtual err_t | init_pin (uint8_t pin_nr)=0 |
init single pin as output More... | |
virtual err_t | set_pin (uint8_t pin_nr, bool value)=0 |
set pin level high or low More... | |
virtual err_t | clear_pin (uint8_t pin_nr) |
clear single pin after program is finished More... | |
err_t | do_step (movement::axis_mask_t direction) |
Do a single step in a direction. More... | |
uint8_t | get_pin (movement::axis_mask_t direction, uint8_t n=0) |
pop pin from circular array buffer. More... | |
void | timer_task () |
task to set the next phase on time. More... | |
err_t | _set (movement::axis_mask_t axisMask, int16_t speed) override |
Implementation of axis movement, this function is called from set(...) . More... | |
Static Private Member Functions | |
static void | _timer_task_wrapper (void *_this) |
wrapper for timer_task(), as FreeRTOS only wants to create tasks from static functions More... | |
Private Attributes | |
SemaphoreHandle_t | asked_set_mutex = NULL |
uint16_t | asked_speed |
movement::axis_mask_t | asked_direction |
size_t | active_pin_index = 0 |
TaskHandle_t | timer_task_handle |
const uint8_t * | pins |
const size_t | pins_count = 0 |
const bool | active_high |
log::channel_t * | log |
Additional Inherited Members | |
![]() | |
err_t | startup_error = err_t::NOT_STARTED |
error when constructing gets put here, read before usage. More... | |
![]() | |
static double | convert_range (uint16_t input, float range_max=100.f, float range_min=0.f) |
Convert uint16 to a new range. More... | |
Stepper::Stepper | ( | uint8_t * | pins, |
size_t | pins_count, | ||
movement::axis_mask_t | axis, | ||
bool | active_high | ||
) |
Stepper motor.
pins,pointer | GPIO number array, used in order for phase shifting |
pins_count,number | of entries in pins |
axis,axis | mask to work on |
active_high,should | the current phase be high and other low or current phase low and other pins high |
Definition at line 28 of file Stepper.cpp.
Stepper::~Stepper | ( | ) |
destructor.
Definition at line 46 of file Stepper.cpp.
|
overrideprivatevirtual |
Implementation of axis movement, this function is called from set(...)
.
Only gets called when axisMask match axis of Actuator.
axisMask | axis (can be multiple) to set speed to. |
speed | desired speed. |
Implements aruna::movement::Actuator.
Definition at line 9 of file Stepper.cpp.
|
staticprivate |
wrapper for timer_task(), as FreeRTOS only wants to create tasks from static functions
_this | current object to timer_task() can be called |
Definition at line 101 of file Stepper.cpp.
|
inlineprivatevirtual |
clear single pin after program is finished
pin_nr | pin to clear |
Reimplemented in aruna::driver::ESP32_Stepper.
Definition at line 62 of file Stepper.h.
|
private |
reset the pins back to initial state (run when program is finished)
Definition at line 117 of file Stepper.cpp.
|
private |
Do a single step in a direction.
direction | PLUS or MINUS |
Definition at line 15 of file Stepper.cpp.
void Stepper::do_steps | ( | int32_t | steps | ) |
Do an x number of steps.
steps | amount of steps to take |
Definition at line 138 of file Stepper.cpp.
|
private |
pop pin from circular array buffer.
direction,direction | to pop |
n,offset | of current active pin, default 0 |
Definition at line 51 of file Stepper.cpp.
|
privatepure virtual |
init single pin as output
pin_nr,pin | to initialize |
Implemented in aruna::driver::ESP32_Stepper.
|
private |
initialize the pins for output
Definition at line 106 of file Stepper.cpp.
|
privatepure virtual |
set pin level high or low
pin_nr,pin | to set |
value,bool. | true for high, false for low |
Implemented in aruna::driver::ESP32_Stepper.
void Stepper::set_speed | ( | int16_t | speed | ) |
Set speed of the stepper motor.
speed | use minus to go the other way. |
Definition at line 128 of file Stepper.cpp.
|
private |
task to set the next phase on time.
Definition at line 64 of file Stepper.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |