#include <motor_driver.h>
|
void | Handler () |
| Motor Driver class handler, communicates with driver and is responsible for reading latest motion request, cancellationof request, and acting upon it i.e. moving the motor and stopping it when stall is detected, or motor reached destination or stop is requested or timer limit is reached. More...
|
|
bool | EnableDriver (bool enable) |
| Enable Motor Driver Give argument as true for enabling, false for disabling the driver. More...
|
|
void | InitializeDriver () |
| Sets needed parameters for the driver. More...
|
|
void | StartMotor () |
| Responsible for starting the motor, i.e. setups the driver and sets required velocity of motor. More...
|
|
void | StopMotor () |
| Responsible for stopping the motor, i.e. disables the driver and sets velocity of motor to zero. More...
|
|
void | StartHandler () |
| Starts handler thread. More...
|
|
void | ResetSteps () |
| Reset the current steps of motor. More...
|
|
◆ MotorDriver() [1/2]
MotorDriver::MotorDriver |
( |
std::shared_ptr< Logging > & |
logging | ) |
|
Initializes motor drive TMC2209, and required pins.
◆ MotorDriver() [2/2]
Initializes motor drive TMC2209, and required pins.
◆ ~MotorDriver()
MotorDriver::~MotorDriver |
( |
| ) |
|
Cleans and disables motor driver.
◆ CancelCurrentRequest()
bool MotorDriver::CancelCurrentRequest |
( |
| ) |
|
Cancels current request.
- Returns
- true: Cancellation successful
-
false: otherwise
◆ EnableDriver()
bool MotorDriver::EnableDriver |
( |
bool |
enable | ) |
|
|
private |
Enable Motor Driver Give argument as true for enabling, false for disabling the driver.
- Returns
- true : if successful
-
false : otherwise
◆ FulfillRequest()
This is the primary contact function for external requests, it will handle all requests from the controller or anywhere else, run the thread for supplying steps.
- Returns
- true : request accepted
-
false : rejected
◆ GetPercentage()
int MotorDriver::GetPercentage |
( |
| ) |
|
Returns the current percentage of motor.
- Returns
- current percentage
◆ GetStatus()
Returns the status of the motor driver, by checking if the motor is running or the driver is in fault, or the motor is available for next request.
- Returns
- CONFIG_SET::DRIVER_STATUS
◆ GetSteps()
int MotorDriver::GetSteps |
( |
| ) |
|
Returns the current steps of motor.
- Returns
- current_steps
◆ Handler()
void MotorDriver::Handler |
( |
| ) |
|
|
private |
Motor Driver class handler, communicates with driver and is responsible for reading latest motion request, cancellationof request, and acting upon it i.e. moving the motor and stopping it when stall is detected, or motor reached destination or stop is requested or timer limit is reached.
◆ InitializeDriver()
void MotorDriver::InitializeDriver |
( |
| ) |
|
|
private |
Sets needed parameters for the driver.
◆ InterruptForIndex()
void IRAM_ATTR MotorDriver::InterruptForIndex |
( |
| ) |
|
|
static |
Runs on a timer, supplies step and direction signal to motor driver.
◆ ResetSteps()
void MotorDriver::ResetSteps |
( |
| ) |
|
|
private |
Reset the current steps of motor.
◆ StartHandler()
void MotorDriver::StartHandler |
( |
| ) |
|
|
private |
◆ StartMotor()
void MotorDriver::StartMotor |
( |
| ) |
|
|
private |
Responsible for starting the motor, i.e. setups the driver and sets required velocity of motor.
◆ StopHandler()
void MotorDriver::StopHandler |
( |
| ) |
|
◆ StopMotor()
void MotorDriver::StopMotor |
( |
| ) |
|
|
private |
Responsible for stopping the motor, i.e. disables the driver and sets velocity of motor to zero.
◆ UpdateCalibParams()
Updates calibration parameters to be used by motor driver.
◆ blind_traversal_requested_
bool MotorDriver::blind_traversal_requested_ = false |
|
private |
◆ calib_params_
◆ current_step_
int MotorDriver::current_step_ = 0 |
|
staticprivate |
◆ direction_
bool MotorDriver::direction_ = false |
|
staticprivate |
◆ driver_status_
◆ expected_step_
int MotorDriver::expected_step_ = 0 |
|
private |
◆ full_rot_step_count_
◆ handler_thread_
std::unique_ptr<std::thread> MotorDriver::handler_thread_ {nullptr} |
|
private |
◆ is_motor_running_
bool MotorDriver::is_motor_running_ = false |
|
private |
◆ keep_handler_running_
bool MotorDriver::keep_handler_running_ = false |
|
private |
◆ last_motor_start_time_sec_
std::time_t MotorDriver::last_motor_start_time_sec_ = std::time(nullptr) |
|
private |
◆ logger_
std::shared_ptr<Logging> MotorDriver::logger_ |
|
private |
◆ step_timer_
hw_timer_t* MotorDriver::step_timer_ = NULL |
|
private |
◆ stop_requested_
bool MotorDriver::stop_requested_ = false |
|
private |
The documentation for this class was generated from the following files: