1 unstable release
Uses new Rust 2024
| 0.1.0 | Dec 14, 2025 |
|---|
#584 in Hardware support
22KB
380 lines
unishock
Rust crate to interface with various shocker devices including PiShock and OpenShock.
Currently this crate only supports serial communication for PiShock hubs and nothing else. Other ways to interact with the devices and OpenShock support is planned.
All functionality supported by the PiShock serial port protocol is implemented.
Examples
Beep a connected PiShock shocker:
let ports = PiShockHub::available_ports()?;
let port = ports.first().expect("no PiShock hubs found");
let mut hub = PiShockHub::connect(port, Duration::MAX)?;
let shocker_id = 1337; // From the hub info/website.
let duration = 100; // In milliseconds.
hub.beep(shocker_id, duration)?;
Retrieve current PiShock hub state:
let ports = PiShockHub::available_ports()?;
let port = ports.first().expect("no PiShock hubs found");
let mut hub = PiShockHub::connect(port, Duration::MAX)?;
println!("{:#?}", hub.info()?);
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in unishock by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~2–14MB
~125K SLoC