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!
Setup
On macOS or Windows, there are no preparation.
On linux,
Usage
First, add dependency to Cargo.toml
[]
= "*"
Then, use
prelude on .rs
file.
use *;
Perfect! Now you have Joycon-rs available in code.
Receive reports
For starters, let's take a simple signal from JoyCon.
If you use more than one JoyCon, mspc
can be very helpful.
use *;
let = channel;
let _output = spawn;
let manager = get_instance;
let = ;
managed_devices.into_iter
.chain
.flat_map
.
.unwrap;
Set player lights
Then, lets deal with player lights.
use ;
let = channel;
let _output = spawn;
let manager = get_instance;
let = ;
managed_devices.into_iter
.chain
.flat_map
.
.unwrap;
Rumble
use *;
use TryInto;
use Deref;
use JoyConFeature;
More Examples
Here.
Features
You can use Joycon-rs
for...
- Manage Joy-Cons
- Connection / Disconnection / Reconnection
- Send / Receive raw packets (u8 array) to / from Joy-Con
- Receive input to Joy-Con
- Deal with LED (Player lights)
- Vibration (Rumble)
- HOME Light
- Read Joy-Con / Pro Controller color
- Read factory / user calibration data
Planning
- Receive NFC/IR data
- Deal with Pro Controller
License
Licensed under Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
Contribution
We gladly accept contributions via GitHub pull requests. If you find a bug in the library, it would be appreciated if you could report it in detail to Issues so that it can be reproduced.