Struct Classic

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

Implementations§

Source§

impl<T, E, DELAY> Classic<T, DELAY>
where T: I2c<SevenBitAddress, Error = E>, DELAY: DelayNs,

Source

pub fn new( i2cdev: T, delay: DELAY, ) -> Result<Classic<T, DELAY>, BlockingImplError<E>>

Create a new Wii Classic Controller

Source

pub fn destroy(self) -> (T, DELAY)

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

Source

pub fn update_calibration(&mut self) -> Result<(), BlockingImplError<E>>

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 fn init(&mut self) -> Result<(), BlockingImplError<E>>

Send the init sequence to the controller

Source

pub fn enable_hires(&mut self) -> Result<(), BlockingImplError<E>>

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 fn identify_controller( &mut self, ) -> Result<Option<ControllerType>, BlockingImplError<E>>

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

Source

pub fn read_uncalibrated( &mut self, ) -> Result<ClassicReading, BlockingImplError<E>>

Do a read, and return button and axis values without applying calibration

Source

pub fn read(&mut self) -> Result<ClassicReadingCalibrated, BlockingImplError<E>>

Do a read, and return button and axis values relative to calibration

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
Source§

impl<I2C, DELAY> Format for Classic<I2C, DELAY>
where Interface<I2C, DELAY>: Format, CalibrationData: Format,

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.

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.