pub struct Tb6612fng<MAIN1, MAIN2, MAPWM, MBIN1, MBIN2, MBPWM, STBY> {
    pub motor_a: Motor<MAIN1, MAIN2, MAPWM>,
    pub motor_b: Motor<MBIN1, MBIN2, MBPWM>,
    /* private fields */
}
Expand description

Represents a TB6612FNG controller.

Use the Motor struct directly if you only have one motor. See the crate-level comment for further details on when to use what.

Fields

motor_a: Motor<MAIN1, MAIN2, MAPWM>

The first motor, labelled as ‘A’ on the chip

motor_b: Motor<MBIN1, MBIN2, MBPWM>

The second motor, labelled as ‘B’ on the chip

Implementations

Instantiate a new Tb6612fng with the defined pins. This also automatically enables the two PWM pins. The initial state of the motors will be stopped.

Usage example:

use tb6612fng::Tb6612fng;

let controller = Tb6612fng::new(
    motor_a_in1,
    motor_a_in2,
    motor_a_pwm,
    motor_b_in1,
    motor_b_in2,
    motor_b_pwm,
    standby,
);

Enable standby. This ignores any other setting currently done on the motors and puts them into standby.

Note that this does not change any commands on the motors, i.e. the PWM signal will continue and once Tb6612fng::disable_standby is called the motor will pick up where it left off (unless the command was changed in-between).

Disable standby. Note that the last active commands on the motors will resume.

Trait Implementations

Formats the value using the given formatter. Read more
Writes the defmt representation of self to fmt.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.