From 753b4e8fb11ed149cd03270f9ab0d43a572c1147 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Fri, 16 Jun 2023 00:41:13 +0200 Subject: [PATCH] fixup! refactor(core): unify touch and button handling, enable usage of both in one model --- core/embed/rust/src/ui/event.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/embed/rust/src/ui/event.rs b/core/embed/rust/src/ui/event.rs index 879c8072e27..0bb6bc7b0f1 100644 --- a/core/embed/rust/src/ui/event.rs +++ b/core/embed/rust/src/ui/event.rs @@ -21,12 +21,12 @@ pub enum ButtonEvent { impl ButtonEvent { pub fn new(event: u32, button: u32) -> Result { - let button = match button & 0xFF { + let button = match button { 0 => PhysicalButton::Left, 1 => PhysicalButton::Right, _ => return Err(error::Error::OutOfRange), }; - let result = match event { + let result = match event & 0xFF { 1 => Self::ButtonPressed(button), 2 => Self::ButtonReleased(button), _ => return Err(error::Error::OutOfRange),