mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-13 19:18:56 +00:00
move ui.clear into ui.display.clear
This commit is contained in:
parent
8d3aed7ec0
commit
ed975398d9
@ -228,7 +228,7 @@ void display_init(void) {
|
||||
CMD(0xE1); DATAS("\x00\x10\x13\x04\x10\x06\x25\x26\x3B\x04\x0B\x0A\x33\x39\x0F", 15); // gamma curve 2
|
||||
#endif
|
||||
#if DISPLAY_ST7789V
|
||||
CMD(0x26); DATA(0x03); // gamma func enable
|
||||
CMD(0x26); DATA(0x01); // gamma func enable
|
||||
CMD(0xE0); DATAS("\x70\x2C\x2E\x15\x10\x09\x48\x33\x53\x0B\x19\x18\x20\x25", 14); // gamma curve 1
|
||||
CMD(0xE1); DATAS("\x70\x2C\x2E\x15\x10\x09\x48\x33\x53\x0B\x19\x18\x20\x25", 14); // gamma curve 2
|
||||
#endif
|
||||
|
@ -46,6 +46,15 @@ void set_color_table(uint16_t colortable[16], uint16_t fgcolor, uint16_t bgcolor
|
||||
}
|
||||
}
|
||||
|
||||
void display_clear(void)
|
||||
{
|
||||
display_set_window(0, 0, DISPLAY_RESX, DISPLAY_RESY);
|
||||
for (int i = 0; i < DISPLAY_RESX * DISPLAY_RESY * 2; i++) {
|
||||
DATA(0);
|
||||
}
|
||||
display_update();
|
||||
}
|
||||
|
||||
void display_bar(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t c)
|
||||
{
|
||||
display_set_window(x, y, w, h);
|
||||
|
@ -18,6 +18,7 @@ int display_orientation(int degrees);
|
||||
int display_backlight(int val);
|
||||
|
||||
void set_color_table(uint16_t colortable[16], uint16_t fgcolor, uint16_t bgcolor);
|
||||
void display_clear(void);
|
||||
void display_bar(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t c);
|
||||
void display_bar_radius(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t c, uint16_t b, uint8_t r);
|
||||
void display_blit(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const void *data, int datalen);
|
||||
|
@ -21,6 +21,16 @@ STATIC mp_obj_t mod_TrezorUi_Display_make_new(const mp_obj_type_t *type, size_t
|
||||
return MP_OBJ_FROM_PTR(o);
|
||||
}
|
||||
|
||||
/// def trezor.ui.display.clear() -> None
|
||||
/// '''
|
||||
/// Clear display (with black color)
|
||||
/// '''
|
||||
STATIC mp_obj_t mod_TrezorUi_Display_clear(mp_obj_t self) {
|
||||
display_clear();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_TrezorUi_Display_clear_obj, mod_TrezorUi_Display_clear);
|
||||
|
||||
/// def trezor.ui.display.bar(x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None, radius: int=None) -> None:
|
||||
/// '''
|
||||
/// Renders a bar at position (x,y = upper left corner) with width w and height h of color fgcolor.
|
||||
@ -308,6 +318,7 @@ STATIC mp_obj_t mod_TrezorUi_Display_raw(mp_obj_t self, mp_obj_t reg, mp_obj_t d
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorUi_Display_raw_obj, mod_TrezorUi_Display_raw);
|
||||
|
||||
STATIC const mp_rom_map_elem_t mod_TrezorUi_Display_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&mod_TrezorUi_Display_clear_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_bar), MP_ROM_PTR(&mod_TrezorUi_Display_bar_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_blit), MP_ROM_PTR(&mod_TrezorUi_Display_blit_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_image), MP_ROM_PTR(&mod_TrezorUi_Display_image_obj) },
|
||||
|
@ -7,7 +7,7 @@ async def layout_load_device(session_id, message):
|
||||
from trezor.messages.Success import Success
|
||||
from .confirm import require_confirm
|
||||
|
||||
ui.clear()
|
||||
ui.display.clear()
|
||||
ui.display.text_center(
|
||||
120, 40, 'Really load device?', ui.BOLD, ui.WHITE, ui.BLACK)
|
||||
ui.display.text_center(
|
||||
|
@ -15,7 +15,7 @@ async def layout_recovery_device(session_id, message):
|
||||
|
||||
msg = 'Please enter ' + nth(message.word_count) + ' word'
|
||||
|
||||
ui.clear()
|
||||
ui.display.clear()
|
||||
ui.display.text(10, 30, 'Recovering device',
|
||||
ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
|
||||
ui.display.text(10, 74, msg, ui.BOLD, ui.WHITE, ui.BLACK)
|
||||
|
@ -73,7 +73,7 @@ async def show_mnemonic_page(page, page_count, mnemonic):
|
||||
from trezor.ui.button import Button, CONFIRM_BUTTON, CONFIRM_BUTTON_ACTIVE
|
||||
from trezor.ui.scroll import render_scrollbar, animate_swipe
|
||||
|
||||
ui.clear()
|
||||
ui.display.clear()
|
||||
ui.display.text(
|
||||
10, 34, 'Write down your seed', ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
|
||||
render_scrollbar(page, page_count)
|
||||
|
@ -9,7 +9,7 @@ async def layout_wipe_device(message, session_id):
|
||||
from .confirm import hold_to_confirm
|
||||
from .storage import clear_storage
|
||||
|
||||
ui.clear()
|
||||
ui.display.clear()
|
||||
|
||||
content = Text('Wiping device',
|
||||
ui.BOLD, 'Do you really want to', 'wipe the device?',
|
||||
|
@ -16,7 +16,7 @@ async def request_pin(session_id, *args, **kwargs):
|
||||
ButtonRequest(code=ProtectCall),
|
||||
ButtonAck)
|
||||
|
||||
ui.clear()
|
||||
ui.display.clear()
|
||||
matrix = PinMatrix(*args, **kwargs)
|
||||
dialog = ConfirmDialog(matrix)
|
||||
if await dialog != CONFIRMED:
|
||||
|
@ -6,7 +6,7 @@ from trezor.utils import unimport
|
||||
async def layout_sign_message(message, session_id):
|
||||
from trezor.messages.Success import Success
|
||||
|
||||
ui.clear()
|
||||
ui.display.clear()
|
||||
ui.display.text(10, 30, 'Signing message',
|
||||
ui.BOLD, ui.LIGHT_GREEN, ui.BLACK)
|
||||
ui.display.text(10, 60, message.message, ui.MONO, ui.WHITE, ui.BLACK)
|
||||
|
@ -47,10 +47,6 @@ NORMAL = const(1)
|
||||
BOLD = const(2)
|
||||
|
||||
|
||||
def clear(color=BLACK):
|
||||
display.bar(0, 0, 240, 240, color)
|
||||
|
||||
|
||||
def in_area(pos: tuple, area: tuple) -> bool:
|
||||
x, y = pos
|
||||
ax, ay, aw, ah = area
|
||||
|
Loading…
Reference in New Issue
Block a user