Crate stepper_motion

Crate stepper_motion 

Source
Expand description

§stepper-motion

Configuration-driven stepper motor motion control with embedded-hal 1.0 support.

§Features

  • Configuration-driven: Define motors and trajectories in TOML files
  • embedded-hal 1.0: Uses OutputPin for STEP/DIR, DelayNs for timing
  • no_std compatible: Core library works without standard library
  • Asymmetric profiles: Independent acceleration and deceleration rates
  • Position tracking: Absolute position tracked at all times
  • Type-state safety: Compile-time motor state verification

§Quick Start

use stepper_motion::{StepperMotor, SystemConfig};

// Load configuration from TOML
let config: SystemConfig = stepper_motion::load_config("motion.toml")?;

// Create motor with embedded-hal pins
let mut motor = StepperMotor::builder()
    .from_config(&config, "x_axis")?
    .step_pin(step_pin)
    .dir_pin(dir_pin)
    .delay(delay)
    .build()?;

// Execute named trajectory
motor.execute("home")?;

§Feature Flags

  • std (default): Enables file I/O and TOML parsing
  • alloc: Enables heap allocation for no_std with allocator
  • defmt: Enables defmt logging for embedded targets

Re-exports§

pub use config::MotorConfig;
pub use config::SystemConfig;
pub use config::TrajectoryConfig;
pub use config::validate_config;
pub use error::Error;
pub use error::Result;
pub use motion::Direction;
pub use motion::MotionPhase;
pub use motion::MotionProfile;
pub use motor::state;
pub use motor::MotorSystem;
pub use motor::StepperMotor;
pub use trajectory::TrajectoryRegistry;
pub use config::load_config;
pub use config::units::Degrees;
pub use config::units::DegreesPerSec;
pub use config::units::DegreesPerSecSquared;
pub use config::units::Microsteps;
pub use config::units::Steps;

Modules§

config
Configuration module for stepper-motion.
error
Error types for stepper-motion library.
motion
Motion module for stepper-motion.
motor
Motor module for stepper-motion.
trajectory
Trajectory module for stepper-motion.