Struct ev3dev_lang_rust::Ev3Button [−][src]
pub struct Ev3Button { /* fields omitted */ }
Expand description
Ev3 brick button handler. Opens the corresponding /dev/input
file handlers.
This implementation depends on the availability of the EVIOCGKEY ioctl to be able to read the button state buffer. See Linux kernel source in /include/uapi/linux/input.h for details.
use ev3dev_lang_rust::Ev3Button;
use std::thread;
use std::time::Duration;
let button = Ev3Button::new()?;
loop {
button.process();
println!("Is 'up' pressed: {}", button.is_up());
println!("Pressed buttons: {:?}", button.get_pressed_buttons());
thread::sleep(Duration::from_millis(100));
}
Implementations
Ev3 brick button handler. Opens the corresponding /dev/input
file handlers.
Check for currenly pressed buttons. If the new state differs from the old state, call the appropriate button event handlers.
Get all pressed buttons by name.
Check if ‘backspace’ button is pressed.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Ev3Button
impl !UnwindSafe for Ev3Button
Blanket Implementations
Mutably borrows from an owned value. Read more