Struct deoxy::Motor
[−]
[src]
pub struct Motor { /* fields omitted */ }
A Motor
represents a hardware motor.
Motors are given all the necessary configuration information to manage their own position and communication and provide a high-level interface to accomplish related tasks.
Methods
impl Motor
[src]
fn new(pin: u8, period: Duration, range: MotorRange) -> Self
[src]
Constructs a new motor on the given pin which has the given period.
range
takes the format (minimum, maximum)
.
fn min(&self) -> Duration
[src]
The minimum usable pulse width, as specified upon creation.
Examples
use std::time::Duration; use deoxy::Motor; let motor = Motor::new(0, Duration::from_millis(20), (Duration::new(0, 900_000), Duration::new(0, 1_200_000))); assert_eq!(motor.min(), Duration::new(0, 900_000));
fn max(&self) -> Duration
[src]
The maximum usable pulse width, as specified upon creation.
Examples
use std::time::Duration; use deoxy::Motor; let motor = Motor::new(0, Duration::from_millis(20), (Duration::new(0, 900_000), Duration::new(0, 1_200_000))); assert_eq!(motor.max(), Duration::new(0, 1_200_000));
fn set_neutral(&mut self) -> Result<(), MotorError>
[src]
Sets the pulse width to the center of the possible range, bringing it to the neutral position.
fn set_pulse_width(&mut self, pulse_width: Duration) -> Result<(), MotorError>
[src]
Attempts to set the pulse width to the given duration.