pub struct Nunchuk<I2C, DELAY> { /* private fields */ }Implementations§
Source§impl<I2C, ERR, DELAY> Nunchuk<I2C, DELAY>
impl<I2C, ERR, DELAY> Nunchuk<I2C, DELAY>
Sourcepub fn new(
i2cdev: I2C,
delay: DELAY,
) -> Result<Nunchuk<I2C, DELAY>, BlockingImplError<ERR>>
pub fn new( i2cdev: I2C, delay: DELAY, ) -> Result<Nunchuk<I2C, DELAY>, BlockingImplError<ERR>>
Create a new Wii Nunchuk
Sourcepub fn destroy(self) -> (I2C, DELAY)
pub fn destroy(self) -> (I2C, DELAY)
Destroy this driver, recovering the i2c bus and delay used to create it
Sourcepub fn update_calibration(&mut self) -> Result<(), BlockingImplError<ERR>>
pub fn update_calibration(&mut self) -> Result<(), BlockingImplError<ERR>>
Update the stored calibration for this controller
Since each device will have different tolerances, we take a snapshot of some analog data to use as the “baseline” center.
Sourcepub fn init(&mut self) -> Result<(), BlockingImplError<ERR>>
pub fn init(&mut self) -> Result<(), BlockingImplError<ERR>>
Send the init sequence to the Nunchuk
Sourcepub fn identify_controller(
&mut self,
) -> Result<Option<ControllerType>, BlockingImplError<ERR>>
pub fn identify_controller( &mut self, ) -> Result<Option<ControllerType>, BlockingImplError<ERR>>
Determine the controller type based on the type ID of the extension controller
Sourcepub fn read_uncalibrated(
&mut self,
) -> Result<NunchukReading, BlockingImplError<ERR>>
pub fn read_uncalibrated( &mut self, ) -> Result<NunchukReading, BlockingImplError<ERR>>
Do a read, and return button and axis values without applying calibration
Sourcepub fn read(
&mut self,
) -> Result<NunchukReadingCalibrated, BlockingImplError<ERR>>
pub fn read( &mut self, ) -> Result<NunchukReadingCalibrated, BlockingImplError<ERR>>
Do a read, and return button and axis values relative to calibration
Auto Trait Implementations§
impl<I2C, DELAY> Freeze for Nunchuk<I2C, DELAY>
impl<I2C, DELAY> RefUnwindSafe for Nunchuk<I2C, DELAY>where
I2C: RefUnwindSafe,
DELAY: RefUnwindSafe,
impl<I2C, DELAY> Send for Nunchuk<I2C, DELAY>
impl<I2C, DELAY> Sync for Nunchuk<I2C, DELAY>
impl<I2C, DELAY> Unpin for Nunchuk<I2C, DELAY>
impl<I2C, DELAY> UnwindSafe for Nunchuk<I2C, DELAY>where
I2C: UnwindSafe,
DELAY: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more