Crate g29

source ·
Expand description

§G29 Driver

This library provides a Rust interface for Logitech G29 wheel/pedal and force feedback control. It utilizes the hidapi crate to interact with the G29 hardware.

§Usage

use g29::{G29, G29Driver};

fn main() {
    // Create a new G29 instance
    let mut g29 = G29::new();
    // set force feedback for G29 controller - make sure to set the Logitech to PS3 Mode
    g29.g29.lock().unwrap().force_feedback_constant(0.6);
    // Start the reading thread to continuously read input from the G29 device
    g29.start_pumping();
    loop {
          println!("steering = {:?}", g29.g29.lock().unwrap().get_state());
     }
}

§Example

Interacting with the driver without starting a thread to set force feedback.

use g29::G29Driver;

fn main() {
    // Create a new G29 driver instance
    let mut g29 = G29Driver::new();

    // Reset the G29 device, including steering wheel calibration
    g29.reset();

    // Example: Set autocenter with a strength of 0.5 and a rate of 0.05
    g29.set_autocenter(0.5, 0.05);

    // Other operations and configurations can be performed here
}

Structs§

  • The G29 struct represents the G29 device and provides methods for controlling and interacting with it.
  • ! The G29Driver struct is the underlying driver for the G29 device, managing communication and state.