Skip to content

Commit

Permalink
Merge pull request #51 from KaiseiYokoyama/dev/0.5.0-alpha
Browse files Browse the repository at this point in the history
Dev/0.5.0 alpha
  • Loading branch information
KaiseiYokoyama authored May 19, 2020
2 parents 69372db + 37c9256 commit 4097d50
Show file tree
Hide file tree
Showing 15 changed files with 2,189 additions and 2,142 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "joycon-rs"
version = "0.4.5"
version = "0.5.0-alpha"
authors = ["Kaisei Yokoyama <[email protected]>"]
repository = "https://github.com/KaiseiYokoyama/joycon-rs"
edition = "2018"
description = " a framework for dealing with Nintendo Switch Joy-Con on Rust easily and efficiently"
readme = "README.md"
keywords = ["nintendo_switch", "joycon", "gamedev", "hid"]
keywords = ["nintendo_switch", "joycon", "gamedev", "hid", "bluetooth"]
license = "Apache-2.0"
exclude = ["/images/*"]

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<a href="https://kaiseiyokoyama.github.io/blog/tags/joycon-rs-v0.3.1/">ドキュメント</a>
</h3>

A framework for dealing with Nintendo Switch Joy-Con on Rust easily and efficiently.
A framework for dealing with Nintendo Switch Joy-Con on Rust easily and efficiently via Bluetooth.

`Joycon-rs` provides utility to find communicate with, and operate Joy-Con.
Please see the documentation comments for detailed instructions on how to use it.

Joycon-rs is in development and is still incomplete.
Please be aware the update will include breaking changes for the time being. Pardon out dust!
Joycon-rs is in development and is still incomplete.
Please be aware the update will include breaking changes for the time being. Pardon out dust!

## Setup
On macOS or Windows, there are no preparation.
Expand Down
7 changes: 4 additions & 3 deletions examples/player_lights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ fn main() -> JoyConResult<()> {
driver.set_player_lights(&lights_status.light_up, &lights_status.flash)?;

// Get player lights
let lights_status_received = driver.get_player_lights()?.extra.reply;

assert_eq!(lights_status_received, lights_status);
if let SubCommandReply::Checked(reply) = driver.get_player_lights()? {
let lights_status_received = reply.extra.reply;
assert_eq!(lights_status_received, lights_status);
}

Ok(())
})?;
Expand Down
4 changes: 2 additions & 2 deletions src/joycon/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ impl JoyConDevice {

pub fn check_type_of_device(device_info: &DeviceInfo) -> JoyConResult<JoyConDeviceType> {
if device_info.vendor_id() != JoyConDevice::VENDOR_ID {
Err(JoyConDeviceError::InvalidVendorID(device_info.vendor_id()))?;
return Err(JoyConDeviceError::InvalidVendorID(device_info.vendor_id()).into());
}

match device_info.product_id() {
JoyConDevice::PRODUCT_ID_JOYCON_L => Ok(JoyConDeviceType::JoyConL),
JoyConDevice::PRODUCT_ID_JOYCON_R => Ok(JoyConDeviceType::JoyConR),
JoyConDevice::PRODUCT_ID_PROCON => Ok(JoyConDeviceType::ProCon),
other => Err(JoyConDeviceError::InvalidProductID(other))?,
other => Err(JoyConDeviceError::InvalidProductID(other).into()),
}
}

Expand Down
Loading

0 comments on commit 4097d50

Please sign in to comment.