Struct Classic

Source
pub struct Classic<I2C, Delay> { /* private fields */ }

Implementations§

Source§

impl<I2C, Delay> Classic<I2C, Delay>
where I2C: I2c, Delay: DelayNs,

Source

pub fn new(i2cdev: I2C, delay: Delay) -> Self

Create a new Wii Classic Controller

Source

pub fn destroy(self) -> (I2C, Delay)

Destroy this driver, recovering the i2c bus and delay used to create it

Source

pub async fn update_calibration(&mut self) -> Result<(), AsyncImplError>

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.

Source

pub async fn init(&mut self) -> Result<(), AsyncImplError>

Send the init sequence to the controller and calibrate it

Source

pub async fn read(&mut self) -> Result<ClassicReadingCalibrated, AsyncImplError>

Do a read, and report axis values relative to calibration

Source

pub async fn enable_hires(&mut self) -> Result<(), AsyncImplError>

Switch the driver from standard to hi-resolution reporting

This enables the controllers high-resolution report data mode, which returns each analogue axis as a u8, rather than packing smaller integers in a structure. If your controllers supports this mode, you should use it. It is much better.

Source

pub async fn identify_controller( &mut self, ) -> Result<Option<ControllerType>, AsyncImplError>

Determine the controller type based on the type ID of the extension controller

Trait Implementations§

Source§

impl<I2C: Debug, Delay: Debug> Debug for Classic<I2C, Delay>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I2C: Default, Delay: Default> Default for Classic<I2C, Delay>

Source§

fn default() -> Classic<I2C, Delay>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I2C, Delay> Freeze for Classic<I2C, Delay>
where I2C: Freeze, Delay: Freeze,

§

impl<I2C, Delay> RefUnwindSafe for Classic<I2C, Delay>
where I2C: RefUnwindSafe, Delay: RefUnwindSafe,

§

impl<I2C, Delay> Send for Classic<I2C, Delay>
where I2C: Send, Delay: Send,

§

impl<I2C, Delay> Sync for Classic<I2C, Delay>
where I2C: Sync, Delay: Sync,

§

impl<I2C, Delay> Unpin for Classic<I2C, Delay>
where I2C: Unpin, Delay: Unpin,

§

impl<I2C, Delay> UnwindSafe for Classic<I2C, Delay>
where I2C: UnwindSafe, Delay: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.