Expand description
This is a no_std
driver for the TB6612FNG motor driver as can e.g. be found on the corresponding SparkFun module.
The motor driver itself supports two motors and has a standby pin which controls both motors at the same time.
The crate can be either used to control a single motor (using the Motor
struct directly) or
to control both motors (using the Tb6612fng
struct) - the latter also supports using the standby functionality.
When to use what
- You plan on using both motors and the standby feature: use
Tb6612fng
- You plan on using both motors without the standby feature: use two separate
Motor
s - You plan on using a single motor with the standby feature: use
Motor
and control the standby pin manually - You plan on using a single motor without the standby feature: use
Motor
Optional features
defmt
: you can enable thedefmt
feature to get adefmt::Format
implementation for all structs & enums in this crate and adefmt::debug
call for every speed change.
Structs
Represents a single motor (either motor A or motor B) hooked up to a TB6612FNG controller.
This is unaware of the standby pin. If you plan on using both motors and the standby feature then use the
Tb6612fng
struct instead.
See the crate-level comment for further details on when to use what.Represents a TB6612FNG controller.
Enums
Defines the possible drive commands.
Defines errors which can happen while trying to set a speed.