[][src]Struct pololu_smc::SimpleMotorController

pub struct SimpleMotorController<T> {
    pub device_number: u8,
    // some fields omitted
}

Represents a single physical motor controller.

The type parameter T should be a type that implements the appropriate traits for the desired communications interface.

Fields

device_number: u8

The device number of this controller, in order to separate different controllers using the same bus.

Implementations

impl<T> SimpleMotorController<T>[src]

pub fn new(interface: T, device_number: u8) -> SimpleMotorController<T>[src]

Constructs a new controller using a specific interface and device number.

impl<T> SimpleMotorController<T> where
    T: Write
[src]

pub fn send_command(&mut self, cmd: Command) -> Result<(), T::Error>[src]

Sends a given command to the controller. No response is provided.

impl<T> SimpleMotorController<T> where
    T: WriteRead
[src]

pub fn get_error_status(&mut self) -> Result<Errors, T::Error>[src]

Returns the errors that are currently stopping the motor

pub fn get_new_errors(&mut self) -> Result<Errors, T::Error>[src]

Like SimpleMotorController::get_error_status, but only returns the new errors that occurred after the last time this variable was read.

pub fn get_new_serial_errors(&mut self) -> Result<Errors, T::Error>[src]

Returns the new serial errors that occurred after the last time this variable was read.

pub fn get_limit_status(&mut self) -> Result<Limits, T::Error>[src]

Returns the things that are currently limiting the operation of the motor controller in some way.

pub fn get_rc_unlimited_raw(&mut self, ch: Channel) -> Result<u16, T::Error>[src]

Returns positive pulse width of signal on an RC channel. Unit: 0.25 μs. 0xFFFF if no valid signal detected.

pub fn get_rc_raw(&mut self, ch: Channel) -> Result<u16, T::Error>[src]

Returns positive pulse width of signal on an RC channel. Unit: 0.25 μs. 0xFFFF if no valid signal detected or if outside error max/error min channel calibration settings.

pub fn get_rc_scaled(&mut self, ch: Channel) -> Result<i16, T::Error>[src]

Returns scaled version of the RC raw value (based on RC channel calibration settings). 0 if the raw value is 0xFFFF, otherwise from -3200 to 3200.

pub fn get_analog_unlimited_raw(&mut self, ch: Channel) -> Result<u16, T::Error>[src]

Returns the 12-bit ADC reading of an analog channel. 0 (0 V) to 4095 (3.3 V). 0xFFFF if the input is disconnected.

pub fn get_analog_raw(&mut self, ch: Channel) -> Result<u16, T::Error>[src]

Returns the 12-bit ADC reading of an analog channel. 0 (0 V) to 4095 (3.3 V). 0xFFFF if the input is disconnected or outside of the error max/error min channel calibration settings.

pub fn get_analog_scaled(&mut self, ch: Channel) -> Result<i16, T::Error>[src]

Returns the scaled version of the analog raw value (based on analog channel calibration settings). 0 if the raw value is 0xFFFF, otherwise from -3200 to 3200.

pub fn get_target_speed(&mut self) -> Result<u16, T::Error>[src]

Returns motor target speed (-3200 to 3200).

pub fn get_speed(&mut self) -> Result<u16, T::Error>[src]

Returns current speed of the motor (-3200 to 3200).

pub fn get_brake_amount(&mut self) -> Result<BrakeAmount, T::Error>[src]

When speed is 0, the returnev value indicates whether the controller is braking or not.

pub fn get_input_voltage(&mut self) -> Result<u16, T::Error>[src]

Returns measured voltage on the VIN pin, in mV.

pub fn get_temperature_a(&mut self) -> Result<u16, T::Error>[src]

Returns board temperature in 0.1 °C, measured at a separate location from SimpleMotorController::get_temperature_b. Temperatures below freezing are reported as 0. Errors measuring temperature are reported as 3000.

pub fn get_temperature_b(&mut self) -> Result<u16, T::Error>[src]

Returns board temperature in 0.1 °C, measured at a separate location from SimpleMotorController::get_temperature_a. Temperatures below freezing are reported as 0. Errors measuring temperature are reported as 3000.

pub fn get_rc_period(&mut self) -> Result<u16, T::Error>[src]

If there is a valid signal on RC1, this returns the signal period in 0.1ms. Otherwise, this returns value 0.

pub fn get_baud_rate(&mut self) -> Result<u16, T::Error>[src]

Returns the value of the controller's baud rate register, in seconds per 72 000 000 bits.

pub fn get_uptime_low(&mut self) -> Result<u16, T::Error>[src]

Returns the two lower bytes of the number of milliseconds that have elapsed since the controller was last reset or powered up.

pub fn get_uptime_high(&mut self) -> Result<u16, T::Error>[src]

Returns the two upper bytes of the number of milliseconds that have elapsed since the controller was last reset or powered up.

pub fn get_uptime(&mut self) -> Result<u32, T::Error>[src]

Returns the number of milliseconds since the last reset, by combining the results of SimpleMotorController::get_uptime_low and SimpleMotorController::get_uptime_high.

pub fn get_max_speed(&mut self, dir: Direction) -> Result<u16, T::Error>[src]

Returns maximum allowed motor speed in direction dir, 0 to 3200.

pub fn get_max_acceleration(&mut self, dir: Direction) -> Result<u16, T::Error>[src]

Returns maximum allowed motor acceleration in direction dir, in Δspeed per update period. Value range 0 to 3200. 0 means no limit.

pub fn get_max_deceleration(&mut self, dir: Direction) -> Result<u16, T::Error>[src]

Returns maximum allowed motor deceleration from direction dir, in Δspeed per update period. Value range 0 to 3200. 0 means no limit.

pub fn get_brake_duration(&mut self, dir: Direction) -> Result<u16, T::Error>[src]

Returns time spent braking (at speed 0) in ms when transitioning from direction dir to the other.

pub fn get_starting_speed(&mut self, dir: Direction) -> Result<u16, T::Error>[src]

Returns minimum allowed motor speed in direction dir, 0 to 3200.

pub fn get_current_limit(&mut self) -> Result<u16, T::Error>[src]

Returns the hardware current limit currently being used. See section 5.2 in the official user's guide for instructions on how to interpret the units.

pub fn get_raw_current(&mut self) -> Result<u16, T::Error>[src]

Returns raw motor current measurement. See section 5.2 in the official user's guide for instructions on how to interpret the units.

pub fn get_current(&mut self) -> Result<u16, T::Error>[src]

Returns a measurement of the motor current in mA.

pub fn get_current_limiting_consecutive_count(
    &mut self
) -> Result<u16, T::Error>
[src]

Returns the number of consecutive 10ms time periods in which the hardware current limiting has activated.

pub fn get_current_limiting_occurence_count(&mut self) -> Result<u16, T::Error>[src]

Returns the number of 10 ms time periods in which the hardware current limit has activated since the last time this variable was read.

pub fn get_reset_flags(&mut self) -> Result<ResetSource, T::Error>[src]

Indicates the source of the last board reset.

pub fn set_motor_limit(
    &mut self,
    limit: MotorLimitKind,
    value: u16
) -> Result<MotorLimitResponse, T::Error>
[src]

Sends a command to temporarily set a certain motor limit to some value, until the board is reset.

pub fn get_firmware_version(&mut self) -> Result<FirmwareVersion, T::Error>[src]

Sends a command to read the firmware version and product id from the controller.

Auto Trait Implementations

impl<T> Send for SimpleMotorController<T> where
    T: Send

impl<T> Sync for SimpleMotorController<T> where
    T: Sync

impl<T> Unpin for SimpleMotorController<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.