Crates.io | lib-g29 |
lib.rs | lib-g29 |
version | 1.0.1 |
source | src |
created_at | 2024-04-03 20:45:39.970059 |
updated_at | 2024-04-18 17:23:38.562943 |
description | A library for interfacing with the Logitech G29 racing wheel |
homepage | |
repository | https://github.com/EzraEllette/g29 |
max_upload_size | |
id | 1195543 |
size | 59,539 |
Rust crate for using the logitech G29 steering wheel with force feedback. More Force Feedback options coming soon.
Thanks to @nightmode for their NodeJS library that I frequently referenced. logitech-g29
use lib_g29::{Options, G29, events::Event};
fn main() {
let g29 = G29::connect(Options::default());
g29.register_event_handler(
Event::PlaystationButtonReleased,
playstation_button_released_handler,
);
g29.register_event_handler(Event::Throttle, throttle_handler);
g29.register_event_handler(Event::Brake, brake_handler);
g29.register_event_handler(Event::Clutch, clutch_handler);
while g29.connected() {}
}
fn playstation_button_released_handler(g29: &mut G29) {
g29.disconnect();
println!("Playstation button released");
}
fn throttle_handler(g29: &mut G29) {
println!("Throttle: {}", g29.throttle());
}
fn brake_handler(g29: &mut G29) {
println!("Brake: {}", g29.brake());
}
fn clutch_handler(g29: &mut G29) {
println!("Clutch: {}", g29.clutch());
}