Crate pololu_smc

Source
Expand description

This crate provides a user-friendly driver for the Pololu Simple Motor Controller G2, for use on embedded hardware.

It uses traits from the embedded_hal crate in order to be independent from end user hardware. Currently only the I2C protocol is implemented.

This documentation is heavily based on the official user’s guide for the controller, published by Pololu. The aim is for this documentation to contain the basic information required to use the controller, but please consult the user’s guide in order to fully understand the capabilities and limitations of the hardware and the various protocols.

Example

 use pololu_smc::{SimpleMotorController, Command};

 // ...

 let mut controller = SimpleMotorController::new(interface, 0x12);

 let errors = controller.get_error_status()?;

 controller.send_command(Command::ExitSafeStart)?;
 controller.send_command(Command::MotorFwd{speed: 500})?;

Re-exports§

pub use command::Command;
pub use command::FirmwareVersion;
pub use command::MotorLimitKind;
pub use command::MotorLimitResponse;
pub use variable_types::BrakeAmount;
pub use variable_types::Errors;
pub use variable_types::Limits;
pub use variable_types::ResetSource;

Modules§

command
Defines types that handle sending commands to the controller.
variable_types
Defines the types that represent the values of non-trivial and non-numerical variables.

Structs§

SimpleMotorController
Represents a single physical motor controller.

Enums§

Channel
A channel of measurement, either RC or analog
Direction
A direction of movement