Trait joycon_rs::joycon::JoyConDriver[][src]

pub trait JoyConDriver {
    const ACK_TRY: usize;
Show 18 methods fn valid_reply(&self) -> bool;
fn set_valid_reply(&mut self, valid: bool);
fn write(&self, data: &[u8]) -> JoyConResult<usize>;
fn read(&self, buf: &mut [u8]) -> JoyConResult<usize>;
fn read_timeout(&self, buf: &mut [u8], timeout: i32) -> JoyConResult<usize>;
fn global_packet_number(&self) -> u8;
fn increase_global_packet_number(&mut self);
fn set_rumble_status(
        &mut self,
        rumble_l_r: (Option<Rumble>, Option<Rumble>)
    );
fn get_rumble_status(&self) -> (Option<Rumble>, Option<Rumble>);
fn enable_feature(&mut self, feature: JoyConFeature) -> JoyConResult<()>;
fn enabled_features(&self) -> &HashSet<JoyConFeature>;
fn devices(&self) -> Vec<Arc<Mutex<JoyConDevice>>>; fn rumble(
        &mut self,
        rumble_l_r: (Option<Rumble>, Option<Rumble>)
    ) -> JoyConResult<usize> { ... }
fn send_command_raw(
        &mut self,
        command: u8,
        sub_command: u8,
        data: &[u8]
    ) -> JoyConResult<usize> { ... }
fn send_sub_command_raw(
        &mut self,
        sub_command: u8,
        data: &[u8]
    ) -> JoyConResult<SubCommandReply<[u8; 362]>> { ... }
fn send_command(
        &mut self,
        command: Command,
        sub_command: SubCommand,
        data: &[u8]
    ) -> JoyConResult<usize> { ... }
fn send_sub_command(
        &mut self,
        sub_command: SubCommand,
        data: &[u8]
    ) -> JoyConResult<SubCommandReply<[u8; 362]>> { ... }
fn reset(&mut self) -> JoyConResult<()> { ... }
}

Associated Constants

If a sub-command is sent and no ACK packet is returned, tread again for the number of times of this value.

Required methods

If true, driver does not read and check reply of sub-command.

Send command to Joy-Con

Read reply from Joy-Con

  • timeout - milli seconds

Get global packet number

Increase global packet number. Increment by 1 for each packet sent. It loops in 0x0 - 0xF range.

Set rumble status.

Get rumble status.

Enable Joy-Con’s feature. ex. IMU(6-Axis sensor), Vibration(Rumble)

Get Enabled features.

Get Joy-Con devices deal with.

Provided methods

Set rumble status and send rumble command to JoyCon. If Joy-Con’s rumble feature isn’t activated, activate it.

Send command, sub-command, and data (sub-command’s arguments) with u8 integers This returns ACK packet for the command or Error.

Send sub-command, and data (sub-command’s arguments) with u8 integers This returns ACK packet for the command or Error.

Notice

If you are using non-blocking mode, it is more likely to fail to validate the sub command reply.

Send command, sub-command, and data (sub-command’s arguments) with Command and SubCommand This returns ACK packet for the command or Error.

Notice

If you are using non-blocking mode, it is more likely to fail to validate the sub command reply.

Send sub-command, and data (sub-command’s arguments) with Command and SubCommand This returns ACK packet for the command or Error.

Initialize Joy-Con’s status

Implementors