Add initial board, HAL, and executor modules
This commit is contained in:
1 parent
3b9e129c88
commit
0b2eebe76d
82 files changed
+20611
No files matched your search
@@ -0,0 +1,54 @@
|
||||
#ifndef STEPPER_DRIVER_H
|
||||
#define STEPPER_DRIVER_H
|
||||
|
||||
#include <cstdint>
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* @brief Abstract base class for stepper motor driver chips.
|
||||
*
|
||||
* This interface abstracts the low-level control of the stepper motor driver,
|
||||
* such as enabling/disabling, setting direction, sleep mode, and microstepping configuration.
|
||||
* It does NOT handle step generation (that is handled by the StepperMotor class using GPTimer).
|
||||
*/
|
||||
class StepperDriver
|
||||
{
|
||||
public:
|
||||
virtual ~StepperDriver() = default;
|
||||
|
||||
/**
|
||||
* @brief Initialize the driver hardware (GPIOs, IO Expander, etc.)
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
virtual esp_err_t Init() = 0;
|
||||
|
||||
/**
|
||||
* @brief Enable or disable the motor driver output.
|
||||
* @param enable true to enable, false to disable
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
virtual esp_err_t Enable(bool enable) = 0;
|
||||
|
||||
/**
|
||||
* @brief Set the motor direction.
|
||||
* @param dir true for one direction (e.g. UP/CW), false for the other (e.g. DOWN/CCW)
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
virtual esp_err_t SetDirection(bool dir) = 0;
|
||||
|
||||
/**
|
||||
* @brief Set the motor driver to sleep mode to save power.
|
||||
* @param sleep true to sleep, false to wake up
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
virtual esp_err_t Sleep(bool sleep) = 0;
|
||||
|
||||
/**
|
||||
* @brief Set microstepping mode.
|
||||
* @param microsteps Microstepping value (e.g., 1, 2, 4, 8, 16, 32, etc.)
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
virtual esp_err_t SetMicrosteps(int microsteps) = 0;
|
||||
};
|
||||
|
||||
#endif // STEPPER_DRIVER_H
|
||||
Reference in new issue
Block a user