pub struct AdiGyro { /* private fields */ }
Expand description
A struct which represents a V5 ADI port configured to be an ADI gyro.
Implementations
sourceimpl AdiGyro
impl AdiGyro
sourcepub unsafe fn new(
adi_port: u8,
multiplier: f64,
extender_port: u8
) -> Result<Self, AdiGyroError>
pub unsafe fn new(
adi_port: u8,
multiplier: f64,
extender_port: u8
) -> Result<Self, AdiGyroError>
Initializes a gyroscope on the given port. If the given port has not previously been configured as a gyro, then this function starts a 1300 ms calibration period.
Safety
This function is unsafe because it allows the user to create multiple
mutable references to the same ADI gyro. You likely want to
implement Robot::new()
instead.
sourcepub fn reset(&mut self) -> Result<(), AdiGyroError>
pub fn reset(&mut self) -> Result<(), AdiGyroError>
Resets the gyroscope value to zero.
sourcepub fn get(&self) -> Result<f64, AdiGyroError>
pub fn get(&self) -> Result<f64, AdiGyroError>
Gets the current gyro angle in tenths of a degree. Unless a multiplier is applied to the gyro, the return value will be a whole number representing the number of degrees of rotation times 10. There are 360 degrees in a circle, thus the gyro will return 3600 for one whole rotation.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for AdiGyro
impl Send for AdiGyro
impl Sync for AdiGyro
impl Unpin for AdiGyro
impl UnwindSafe for AdiGyro
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more