mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-20 13:38:11 +00:00
TEST: button
This commit is contained in:
parent
61defd6905
commit
56b06786ff
@ -2,7 +2,7 @@ mod render;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
trezorhal::usb::usb_configured,
|
trezorhal::{ble::start_advertising, usb::usb_configured},
|
||||||
ui::{
|
ui::{
|
||||||
component::{Component, Event, EventCtx, Pad, TimerToken},
|
component::{Component, Event, EventCtx, Pad, TimerToken},
|
||||||
display::{self, tjpgd::jpeg_info, toif::Icon, Color, Font},
|
display::{self, tjpgd::jpeg_info, toif::Icon, Color, Font},
|
||||||
@ -21,6 +21,8 @@ use crate::{
|
|||||||
tjpgd::{jpeg_test, BufferInput},
|
tjpgd::{jpeg_test, BufferInput},
|
||||||
toif::Toif,
|
toif::Toif,
|
||||||
},
|
},
|
||||||
|
display::{tjpgd::BufferInput, toif::Toif},
|
||||||
|
event::{ButtonEvent, PhysicalButton},
|
||||||
model_tt::component::homescreen::render::{
|
model_tt::component::homescreen::render::{
|
||||||
HomescreenJpeg, HomescreenToif, HOMESCREEN_TOIF_SIZE,
|
HomescreenJpeg, HomescreenToif, HOMESCREEN_TOIF_SIZE,
|
||||||
},
|
},
|
||||||
@ -185,10 +187,19 @@ where
|
|||||||
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
||||||
Self::event_usb(self, ctx, event);
|
Self::event_usb(self, ctx, event);
|
||||||
if self.hold_to_lock {
|
if self.hold_to_lock {
|
||||||
Self::event_hold(self, ctx, event).then_some(HomescreenMsg::Dismissed)
|
if Self::event_hold(self, ctx, event) {
|
||||||
|
return Some(HomescreenMsg::Dismissed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Event::Button(ButtonEvent::ButtonPressed(PhysicalButton::Power)) = event {
|
||||||
|
start_advertising(false);
|
||||||
|
None
|
||||||
|
//Some(HomescreenMsg::Dismissed)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn paint(&mut self) {
|
fn paint(&mut self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user