From fac9b529e9fc327b60eee83ac64c3998a3ba77cd Mon Sep 17 00:00:00 2001 From: rrr-marble Date: Tue, 12 Oct 2021 17:04:08 +0300 Subject: [PATCH] add: more pedals --- src/main.rs | 4 ++++ src/pedals.rs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/main.rs b/src/main.rs index ff43332..2fbf38b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,6 +110,10 @@ fn create_device() -> Result {{ let code = Key::$key.code(); @@ -32,5 +40,53 @@ pub fn pedals() -> Vec { key: Key::KEY_KP8, action: Box::new(|tx| mash!(BTN_LEFT, 19, 26, tx)), }, + Pedal { + key: Key::KEY_KP3, + action: Box::new(|tx| mash!(KEY_T, 27, 30, tx)), + }, + Pedal { + key: Key::KEY_KP1, + action: Box::new(|tx| mash!(KEY_Y, 30, 44, tx)), + }, + Pedal { + // pew-pew N1RRW + key: Key::KEY_KP6, + action: Box::new(|tx| { + // N1 + tx.send(InputEvent::new(EventType::KEY, Key::BTN_LEFT.code(), 1)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(20)); + + tx.send(InputEvent::new(EventType::KEY, Key::BTN_LEFT.code(), 0)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(300)); + + // R + tx.send(InputEvent::new(EventType::KEY, Key::KEY_R.code(), 1)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(20)); + + tx.send(InputEvent::new(EventType::KEY, Key::KEY_R.code(), 0)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(20)); + + // R W + tx.send(InputEvent::new(EventType::KEY, Key::KEY_R.code(), 1)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(20)); + + tx.send(InputEvent::new(EventType::KEY, Key::KEY_W.code(), 1)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(20)); + + tx.send(InputEvent::new(EventType::KEY, Key::KEY_R.code(), 0)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(20)); + + tx.send(InputEvent::new(EventType::KEY, Key::KEY_W.code(), 0)) + .unwrap(); + std::thread::sleep(std::time::Duration::from_millis(20)); + }), + }, ] }