Skip to content

Commit

Permalink
SimpleJoyConDriver enables vibration and IMU initially
Browse files Browse the repository at this point in the history
for Pro Controller
  • Loading branch information
KaiseiYokoyama committed Jun 5, 2020
1 parent a07cd01 commit ecfce8e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "joycon-rs"
version = "0.5.5"
version = "0.5.6"
authors = ["Kaisei Yokoyama <[email protected]>"]
repository = "https://github.com/KaiseiYokoyama/joycon-rs"
edition = "2018"
Expand Down
4 changes: 2 additions & 2 deletions src/joycon/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ pub trait JoyConDriver {
/// Initialize Joy-Con's status
fn reset(&mut self) -> JoyConResult<()> {
// disable IMU (6-Axis sensor)
self.send_sub_command(SubCommand::EnableIMU, &[0x00])?;
self.send_sub_command(SubCommand::EnableIMU, &[0x01])?;
// disable vibration
self.send_sub_command(SubCommand::EnableVibration, &[0x00])?;
self.send_sub_command(SubCommand::EnableVibration, &[0x01])?;

Ok(())
}
Expand Down
6 changes: 5 additions & 1 deletion src/joycon/driver/simple_joycon_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ impl SimpleJoyConDriver {
// joycon.set_blocking_mode(true);
// joycon.set_blocking_mode(false);

let mut enabled_features = HashSet::new();
enabled_features.insert(JoyConFeature::IMUFeature(IMUConfig::default()));
enabled_features.insert(JoyConFeature::Vibration);

let mut driver = Self {
joycon: Arc::clone(joycon),
rotation: Rotation::Portrait,
rumble: (None, None),
enabled_features: HashSet::new(),
enabled_features,
valid_reply: {
let device = match joycon.lock() {
Ok(j) => j,
Expand Down

0 comments on commit ecfce8e

Please sign in to comment.