diff options
| author | Marc Poulhiès <dkm@kataplop.net> | 2022-07-22 21:01:03 +0200 | 
|---|---|---|
| committer | Marc Poulhiès <dkm@kataplop.net> | 2022-07-22 21:06:23 +0200 | 
| commit | 8a136f62b4952549e2a02d908149bfc0da9d8f33 (patch) | |
| tree | 0931646928223d29ee44022d453b7a4ef9f8cf8a /firmware | |
| parent | ca0359a6299743c1a30ab914e2146395fe2527d6 (diff) | |
rust: Initial hold tap work
Currently not working (Tap action is never triggered unless some other
keys is tapped simultaneous).
Diffstat (limited to 'firmware')
| -rw-r--r-- | firmware/rust/src/main.rs | 39 | 
1 files changed, 33 insertions, 6 deletions
diff --git a/firmware/rust/src/main.rs b/firmware/rust/src/main.rs index 5212ab0..523ece9 100644 --- a/firmware/rust/src/main.rs +++ b/firmware/rust/src/main.rs @@ -5,6 +5,10 @@  use panic_halt as _;  use core::convert::Infallible; +use keyberon::action::{k, l, m, Action::*, HoldTapConfig}; +use keyberon::key_code::KeyCode::*; + +type Action = keyberon::action::Action<CustomActions>;  use keyberon::layout::Layout;  use keyberon::matrix::Matrix; @@ -31,7 +35,6 @@ use hal::{      stm32, timers,  }; -use keyberon::action::Action;  use keyberon::debounce::Debouncer;  use keyberon::key_code::KbHidReport;  use keyberon::key_code::KeyCode; @@ -81,13 +84,37 @@ pub static FD : CustomActions = CustomActions::FreqDown;  #[cfg(not(feature = "testmode"))]  #[rustfmt::skip] +const D_ALT: Action = HoldTap { +    timeout: 200, +    tap_hold_interval: 0, +    config: HoldTapConfig::Default, +    hold: &k(LAlt), +    tap: &k(D), +}; + +const K_ALT: Action = HoldTap { +    timeout: 1000, +    tap_hold_interval: 0, +    config: HoldTapConfig::Default, +    hold: &k(RAlt), +    tap: &k(K), +}; + +const F_L1: Action = HoldTap { +    timeout: 200, +    tap_hold_interval: 0, +    config: HoldTapConfig::Default, +    hold: &l(1), +    tap: &k(F), +}; +  pub static LAYERS: keyberon::layout::Layers<12, 5, 2, CustomActions> = keyberon::layout::layout! {      { -        [Kb1   Kb2 Kb3  Kb4    Kb5  Grave  Kb6  Kb7      Kb8   Kb9    Kb0    Minus] -        [Q     W   E    R      T    Tab    Y    U        I     O      P      LBracket] -        [A     S   D    F      G    BSpace H    J        K     L      SColon Quote] -        [Z     X   C    V      B    Enter  N    M        Comma Dot    Slash  Bslash  ] -        [LCtrl (1) LGui LShift LAlt Space  RAlt RBracket Equal Delete RShift RCtrl] +        [Kb1   Kb2 Kb3     Kb4    Kb5  Grave  Kb6  Kb7      Kb8     Kb9    Kb0    Minus] +        [Q     W   E       R      T    Tab    Y    U        I       O      P      LBracket] +        [A     S   D       F      G    BSpace H    J        K       L      SColon Quote] +        [Z     X   C       V      B    Enter  N    M        Comma   Dot    Slash  Bslash  ] +        [LCtrl (1) LGui    LShift LAlt Space  RAlt RBracket Equal   Delete RShift RCtrl]      }      {          [F1          F2      F3 F4  F5 F6     F7     F8   F9     F10   F11     F12]  | 
