mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-06 08:08:45 +00:00
feat(eckhart): control LED from Homescreen
This commit is contained in:
parent
4179276c79
commit
aa1f577221
@ -3,6 +3,7 @@ use crate::{
|
|||||||
io::BinaryData,
|
io::BinaryData,
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
|
trezorhal::rgb_led,
|
||||||
ui::{
|
ui::{
|
||||||
component::{text::TextStyle, Component, Event, EventCtx, Label, Never},
|
component::{text::TextStyle, Component, Event, EventCtx, Label, Never},
|
||||||
display::{image::ImageInfo, Color},
|
display::{image::ImageInfo, Color},
|
||||||
@ -166,6 +167,13 @@ impl Homescreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for Homescreen {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
// Turn off the LED when homescreen is destroyed
|
||||||
|
rgb_led::set_color(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Component for Homescreen {
|
impl Component for Homescreen {
|
||||||
type Msg = HomescreenMsg;
|
type Msg = HomescreenMsg;
|
||||||
|
|
||||||
@ -221,6 +229,11 @@ impl Component for Homescreen {
|
|||||||
self.hint.render(target);
|
self.hint.render(target);
|
||||||
self.action_bar.render(target);
|
self.action_bar.render(target);
|
||||||
self.htc_anim.render(target);
|
self.htc_anim.render(target);
|
||||||
|
if let Some(rgb_led) = self.led_color {
|
||||||
|
rgb_led::set_color(rgb_led.to_u32());
|
||||||
|
} else {
|
||||||
|
rgb_led::set_color(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user