Braayy / joystick_rust

Simple linux joystick-api library in rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

joystick_rust

Simple linux joystick-api library in rust

Usage

  let mut reader = JoystickReader::new("/dev/input/js0");

  loop {
    // or read_event_now() if you want a non blocking read
    match reader.read_event() {
      Ok(event) => println!("Event: {:?}", event),
      Err(error) => eprintln!("Error: {:?}", error),
    }
  }

JoystickReader::read_event() returns an Result<JoystickEvent, JoystickError>. JoystickEvent is an enum with two variants:

  • Analog - for analog events
  • Button - for button events

About

Simple linux joystick-api library in rust

License:MIT License


Languages

Language:Rust 100.0%