Struct joycon::JoyCon

source ·
pub struct JoyCon {
    pub max_raw_gyro: i16,
    pub max_raw_accel: i16,
    /* private fields */
}

Fields§

§max_raw_gyro: i16§max_raw_accel: i16

Implementations§

source§

impl JoyCon

source

pub fn new(device: HidDevice, info: DeviceInfo) -> Result<JoyCon>

source

pub fn supports_ir(&self) -> bool

source

pub fn send(&mut self, report: &mut OutputReport) -> Result<()>

source

pub fn recv(&mut self) -> Result<InputReport>

source

pub fn set_rumble(&mut self, rumble: RumbleData) -> Result<()>

source

pub fn tick(&mut self) -> Result<Report>

source

pub fn load_calibration(&mut self) -> Result<()>

source

pub fn get_dev_info(&mut self) -> Result<DeviceInfo>

source

pub fn set_home_light(&mut self, home_light: HomeLight) -> Result<()>

source

pub fn set_player_light(&mut self, player_lights: PlayerLights) -> Result<()>

source

pub fn call_subcmd_wait<S: Into<SubcommandRequest> + Debug>( &mut self, subcmd: S ) -> Result<SubcommandReply>

source

pub fn read_spi<S: SPI>(&mut self) -> Result<S>

source

pub fn read_spi_raw(&mut self, range: SPIRange) -> Result<[u8; 29]>

source

pub fn write_spi<S: SPI + Into<SPIWriteRequest> + Debug>( &mut self, value: S ) -> Result<bool>

source

pub unsafe fn write_spi_raw( &mut self, range: SPIRange, data: &[u8] ) -> Result<bool>

source§

impl JoyCon

MCU handling (infrared camera and NFC reader)

source

pub fn enable_ir(&mut self, resolution: Resolution) -> Result<()>

source

pub fn disable_mcu(&mut self) -> Result<()>

source

pub fn enable_pulserate(&mut self) -> Result<()>

source

pub fn set_ir_image_mode(&mut self, ir_mode: MCUIRMode, frags: u8) -> Result<()>

source

pub fn get_ir_registers(&mut self) -> Result<Vec<Register>>

source

pub fn set_ir_registers(&mut self, regs: &[Register]) -> Result<()>

source

pub fn change_ir_resolution(&mut self, resolution: Resolution) -> Result<()>

source§

impl JoyCon

IMU handling (gyroscope and accelerometer)

source

pub fn enable_imu(&mut self) -> Result<()>

source

pub fn set_imu_sens(&mut self) -> Result<()>

source§

impl JoyCon

Ringcon handling

source

pub fn enable_ringcon(&mut self) -> Result<()>

source

pub fn disable_ringcon(&mut self) -> Result<()>

source

pub fn mcu_wait_not_busy(&mut self) -> Result<()>

Trait Implementations§

source§

impl Debug for JoyCon

source§

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

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

impl GamepadDevice for JoyCon

source§

fn recv(&mut self) -> Result<Report>

source§

fn as_any(&mut self) -> &mut dyn Any

Auto Trait Implementations§

§

impl Freeze for JoyCon

§

impl RefUnwindSafe for JoyCon

§

impl Send for JoyCon

§

impl !Sync for JoyCon

§

impl Unpin for JoyCon

§

impl UnwindSafe for JoyCon

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more