Compare commits

..

No commits in common. 'b2649b00853af7b7fdb7e1104f33a0402a11c531' and '1e3e7f808b623366a6fcfad855be6490e6f1d879' have entirely different histories.

@ -8,22 +8,13 @@ use crate::ui::event::ButtonEvent;
use crate::ui::event::TouchEvent;
use crate::ui::{
component::{Component, Event, EventCtx, Never},
constant::SCREEN,
display,
geometry::Rect,
};
use num_traits::ToPrimitive;
pub trait SimplifiedFeatures {
fn fadein() {}
fn fadeout() {}
const SCREEN: Rect;
}
#[cfg(all(feature = "model_tr", not(feature = "model_tt")))]
pub type ModelFeatures = crate::ui::model_tr::ModelTRFeatures;
#[cfg(feature = "model_tt")]
pub type ModelFeatures = crate::ui::model_tt::ModelTTFeatures;
#[cfg(feature = "backlight")]
use crate::ui::model::theme::{BACKLIGHT_DIM, BACKLIGHT_NORMAL};
pub trait ReturnToC {
fn return_to_c(self) -> u32;
@ -74,17 +65,27 @@ fn touch_eval() -> Option<TouchEvent> {
TouchEvent::new(event_type, ex as _, ey as _).ok()
}
pub fn fadein() {
#[cfg(feature = "backlight")]
display::fade_backlight_duration(BACKLIGHT_NORMAL, 150);
}
pub fn fadeout() {
#[cfg(feature = "backlight")]
display::fade_backlight_duration(BACKLIGHT_DIM, 150);
}
pub fn run<F>(frame: &mut F) -> u32
where
F: Component,
F::Msg: ReturnToC,
{
frame.place(ModelFeatures::SCREEN);
ModelFeatures::fadeout();
frame.place(SCREEN);
fadeout();
display::sync();
frame.paint();
display::refresh();
ModelFeatures::fadein();
fadein();
#[cfg(feature = "button")]
while button_eval().is_some() {}
@ -115,14 +116,14 @@ pub fn show<F>(frame: &mut F, fading: bool)
where
F: Component,
{
frame.place(ModelFeatures::SCREEN);
frame.place(SCREEN);
if fading {
ModelFeatures::fadeout()
fadeout()
};
display::sync();
frame.paint();
display::refresh();
if fading {
ModelFeatures::fadein()
fadein()
};
}

@ -18,3 +18,14 @@ pub mod layout;
pub mod model_tr;
#[cfg(feature = "model_tt")]
pub mod model_tt;
#[cfg(all(
feature = "model_t1",
not(feature = "model_tr"),
not(feature = "model_tt")
))]
pub use model_t1 as model;
#[cfg(all(feature = "model_tr", not(feature = "model_tt")))]
pub use model_tr as model;
#[cfg(feature = "model_tt")]
pub use model_tt as model;

@ -1,5 +1,3 @@
use super::{geometry::Rect, layout::simplified::SimplifiedFeatures};
#[cfg(feature = "bootloader")]
pub mod bootloader;
pub mod common_messages;
@ -9,9 +7,3 @@ pub mod constant;
pub mod layout;
pub mod screens;
pub mod theme;
pub struct ModelTRFeatures {}
impl SimplifiedFeatures for ModelTRFeatures {
const SCREEN: Rect = constant::SCREEN;
}

@ -5,9 +5,9 @@ use crate::{
trezorhal::secbool::secbool,
ui::{
component::{connect::Connect, Label},
constant::HEIGHT,
display::{self, Color, Font, Icon},
geometry::{Point, Rect},
layout::simplified::{run, show, SimplifiedFeatures as _},
geometry::Point,
util::{from_c_array, from_c_str},
},
};
@ -18,6 +18,7 @@ use super::{
bl_confirm::{Confirm, ConfirmTitle},
Button, ResultScreen, WelcomeScreen,
},
constant,
theme::{
bootloader::{
button_bld, button_bld_menu, button_confirm, button_wipe_cancel, button_wipe_confirm,
@ -27,9 +28,9 @@ use super::{
},
BACKLIGHT_NORMAL, BLACK, FG, WHITE,
},
ModelTTFeatures,
};
use crate::ui::layout::simplified::{fadein, fadeout, run, show};
use intro::Intro;
use menu::Menu;
@ -41,8 +42,6 @@ pub type BootloaderString = String<128>;
const RECONNECT_MESSAGE: &str = "PLEASE RECONNECT\nTHE DEVICE";
const SCREEN: Rect = ModelTTFeatures::SCREEN;
#[no_mangle]
extern "C" fn screen_install_confirm(
vendor_str: *const cty::c_char,
@ -166,12 +165,12 @@ fn screen_progress(
icon: Option<(Icon, Color)>,
) {
if initialize {
ModelTTFeatures::fadeout();
display::rect_fill(SCREEN, bg_color);
fadeout();
display::rect_fill(constant::screen(), bg_color);
}
display::text_center(
Point::new(SCREEN.width() / 2, SCREEN.height() - 45),
Point::new(constant::WIDTH / 2, HEIGHT - 45),
text,
Font::NORMAL,
fg_color,
@ -180,7 +179,7 @@ fn screen_progress(
display::loader(progress, -20, fg_color, bg_color, icon);
display::refresh();
if initialize {
ModelTTFeatures::fadein();
fadein();
}
}
@ -245,16 +244,16 @@ extern "C" fn screen_wipe_fail() {
#[no_mangle]
extern "C" fn screen_boot_empty(fading: bool) {
if fading {
ModelTTFeatures::fadeout();
fadeout();
}
display::rect_fill(SCREEN, BLACK);
display::rect_fill(constant::screen(), BLACK);
let mut frame = WelcomeScreen::new(true);
show(&mut frame, false);
if fading {
ModelTTFeatures::fadein();
fadein();
} else {
display::set_backlight(BACKLIGHT_NORMAL);
}
@ -329,7 +328,7 @@ extern "C" fn screen_welcome() {
#[no_mangle]
extern "C" fn bld_continue_label(bg_color: cty::uint16_t) {
display::text_center(
Point::new(SCREEN.width() / 2, SCREEN.height() - 5),
Point::new(constant::WIDTH / 2, HEIGHT - 5),
"click to continue ...",
Font::NORMAL,
WHITE,

@ -1,5 +1,3 @@
use super::{geometry::Rect, layout::simplified::SimplifiedFeatures};
#[cfg(feature = "bootloader")]
pub mod bootloader;
pub mod component;
@ -9,19 +7,3 @@ pub mod theme;
#[cfg(feature = "micropython")]
pub mod layout;
pub mod screens;
pub struct ModelTTFeatures {}
impl SimplifiedFeatures for ModelTTFeatures {
fn fadein() {
#[cfg(feature = "backlight")]
crate::ui::display::fade_backlight_duration(theme::BACKLIGHT_NORMAL, 150);
}
fn fadeout() {
#[cfg(feature = "backlight")]
crate::ui::display::fade_backlight_duration(theme::BACKLIGHT_DIM, 150);
}
const SCREEN: Rect = constant::SCREEN;
}

@ -40,14 +40,14 @@ secbool secure_aes_init(void) {
}
static void secure_aes_load_bhk(void) {
TAMP->BKP0R;
TAMP->BKP1R;
TAMP->BKP2R;
TAMP->BKP3R;
TAMP->BKP4R;
TAMP->BKP5R;
TAMP->BKP6R;
TAMP->BKP7R;
TAMP->BKP6R;
TAMP->BKP5R;
TAMP->BKP4R;
TAMP->BKP3R;
TAMP->BKP2R;
TAMP->BKP1R;
TAMP->BKP0R;
}
secbool secure_aes_encrypt(uint32_t* input, size_t size, uint32_t* output) {

Loading…
Cancel
Save