| 52 | } |
| 53 | impl<M1: OnOff, M2: Action, M3: Action> OneShot<M1, M2, M3> { |
| 54 | pub fn new( |
| 55 | trigger1: impl AcceptsKeycode, |
| 56 | trigger2: impl AcceptsKeycode, |
| 57 | callbacks: M1, |
| 58 | on_double_tap_trigger1: M2, |
| 59 | on_double_tap_trigger2: M3, |
| 60 | held_timeout: u16, |
| 61 | released_timeout: u16, |
| 62 | ) -> OneShot<M1, M2, M3> { |
| 63 | ONESHOT_TRIGGERS.write().push(trigger1.to_u32()); |
| 64 | ONESHOT_TRIGGERS.write().push(trigger2.to_u32()); |
| 65 | OneShot { |
| 66 | trigger1: trigger1.to_u32(), |
| 67 | trigger2: trigger2.to_u32(), |
| 68 | callbacks, |
| 69 | on_double_tap_trigger1, |
| 70 | on_double_tap_trigger2, |
| 71 | status: OneShotStatus::Off, |
| 72 | held_timeout, |
| 73 | released_timeout, |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | impl<T: USBKeyOut, M1: OnOff, M2: Action, M3: Action> ProcessKeys<T> for OneShot<M1, M2, M3> { |
| 78 | fn process_keys(&mut self, events: &mut Vec<(Event, EventStatus)>, output: &mut T) -> HandlerResult { |