Class OpenSkyhawk::StepperMotor
ClassList > OpenSkyhawk > StepperMotor
Non-blocking instrument-gauge stepper driven through PinRef coils.
#include <StepperMotor.h>
Inherits the following classes: OpenSkyhawk::MotorDriver
Public Functions
| Type | Name |
|---|---|
| StepperMotor (PinRef c1, PinRef c2, PinRef c3, PinRef c4, const StepperConfig & cfg, PinRef homeSense=PinRef(), PinRef sleepEn=PinRef()) Construct a stepper over four coil pins. |
|
| virtual void | configure () override coils OUTPUT, ~SLEEP HIGH, sensor INPUT, energise. |
| virtual void | home () override blocking homing (STALL or SENSOR), then park. |
| bool | homed () const True once homing has completed successfully (false if a SENSOR seek aborted). |
| virtual void | moveTo (int32_t pos) override retarget (clamp/wrap + deadband); non-blocking. |
| virtual int32_t | position () override const current step (wrapped to 0..stepsPerRev if wrap). |
| virtual void | update () override step toward target if due; auto-recal. |
Public Functions inherited from OpenSkyhawk::MotorDriver
| Type | Name |
|---|---|
| virtual void | configure () = 0 Configure pins / drive hardware. Call once from the owner's configure() . |
| virtual void | home () = 0 Establish the zero reference (mechanical stop, home sensor, or absolute read). |
| virtual void | moveTo (int32_t pos) = 0 Set the target position in driver-native units. Non-blocking. |
| virtual int32_t | position () const = 0 Current position in driver-native units. |
| virtual void | update () = 0 Advance one step/increment toward the target if due. Call every loop(). |
| virtual | ~MotorDriver () = default |
Public Functions Documentation
function StepperMotor
Construct a stepper over four coil pins.
OpenSkyhawk::StepperMotor::StepperMotor (
PinRef c1,
PinRef c2,
PinRef c3,
PinRef c4,
const StepperConfig & cfg,
PinRef homeSense=PinRef (),
PinRef sleepEn=PinRef ()
)
Parameters:
c1..c4Coil PinRefs (GPIO or MCP23017). Swap two to reverse direction.cfgPer-instance configuration (copied; cfg.accel must outlive this).homeSenseHome-sensor PinRef for HomeMode::SENSOR (NC default for STALL).sleepEnOptional driver ~SLEEP/enable PinRef, driven HIGH in configure().
function configure
coils OUTPUT, ~SLEEP HIGH, sensor INPUT, energise.
virtual void OpenSkyhawk::StepperMotor::configure () override
Implements OpenSkyhawk::MotorDriver::configure
function home
blocking homing (STALL or SENSOR), then park.
virtual void OpenSkyhawk::StepperMotor::home () override
Implements OpenSkyhawk::MotorDriver::home
function homed
True once homing has completed successfully (false if a SENSOR seek aborted).
inline bool OpenSkyhawk::StepperMotor::homed () const
function moveTo
retarget (clamp/wrap + deadband); non-blocking.
virtual void OpenSkyhawk::StepperMotor::moveTo (
int32_t pos
) override
Implements OpenSkyhawk::MotorDriver::moveTo
function position
current step (wrapped to 0..stepsPerRev if wrap).
virtual int32_t OpenSkyhawk::StepperMotor::position () override const
Implements OpenSkyhawk::MotorDriver::position
function update
step toward target if due; auto-recal.
virtual void OpenSkyhawk::StepperMotor::update () override
Implements OpenSkyhawk::MotorDriver::update
The documentation for this class was generated from the following file Firmware/Libraries/PanelGroup/Drivers/StepperMotor/StepperMotor.h