mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-28 08:11:02 +00:00
introduce trezor.ui.display.refresh
This commit is contained in:
parent
1840e331bb
commit
d7398619e1
@ -257,7 +257,7 @@ void display_set_window(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void display_update(void) {
|
||||
void display_refresh(void) {
|
||||
}
|
||||
|
||||
int display_backlight(int val)
|
||||
|
@ -107,7 +107,7 @@ void display_set_window(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
|
||||
DATAODD = 0;
|
||||
}
|
||||
|
||||
void display_update(void)
|
||||
void display_refresh(void)
|
||||
{
|
||||
SDL_RenderClear(RENDERER);
|
||||
SDL_UpdateTexture(TEXTURE, NULL, SCREEN->pixels, SCREEN->pitch);
|
||||
@ -121,7 +121,6 @@ int display_orientation(int degrees)
|
||||
if (degrees != ORIENTATION) {
|
||||
if (degrees == 0 || degrees == 90 || degrees == 180 || degrees == 270) {
|
||||
ORIENTATION = degrees;
|
||||
display_update();
|
||||
}
|
||||
}
|
||||
return ORIENTATION;
|
||||
|
@ -52,7 +52,6 @@ void display_clear(void)
|
||||
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)
|
||||
@ -62,7 +61,6 @@ void display_bar(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t c)
|
||||
DATA(c >> 8);
|
||||
DATA(c & 0xFF);
|
||||
}
|
||||
display_update();
|
||||
}
|
||||
|
||||
#define CORNER_RADIUS 16
|
||||
@ -124,14 +122,12 @@ void display_bar_radius(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t c,
|
||||
}
|
||||
}
|
||||
}
|
||||
display_update();
|
||||
}
|
||||
|
||||
void display_blit(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const void *data, int datalen)
|
||||
{
|
||||
display_set_window(x, y, w, h);
|
||||
DATAS(data, datalen);
|
||||
display_update();
|
||||
}
|
||||
|
||||
static void inflate_callback_image(uint8_t byte, uint32_t pos, void *userdata)
|
||||
@ -143,7 +139,6 @@ void display_image(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const void *data,
|
||||
{
|
||||
display_set_window(x, y, w, h);
|
||||
sinf_inflate(data, datalen, inflate_callback_image, NULL);
|
||||
display_update();
|
||||
}
|
||||
|
||||
static void inflate_callback_icon(uint8_t byte, uint32_t pos, void *userdata)
|
||||
@ -161,7 +156,6 @@ void display_icon(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const void *data,
|
||||
uint16_t colortable[16];
|
||||
set_color_table(colortable, fgcolor, bgcolor);
|
||||
sinf_inflate(data, datalen, inflate_callback_icon, colortable);
|
||||
display_update();
|
||||
}
|
||||
|
||||
static const uint8_t *get_glyph(uint8_t font, uint8_t c)
|
||||
@ -219,8 +213,6 @@ void display_text(uint8_t x, uint8_t y, const char *text, int textlen, uint8_t f
|
||||
}
|
||||
px += g[2];
|
||||
}
|
||||
|
||||
display_update();
|
||||
}
|
||||
|
||||
// compute the width of the text (in pixels)
|
||||
@ -250,7 +242,6 @@ void display_qrcode(uint8_t x, uint8_t y, const char *data, int datalen, int sca
|
||||
}
|
||||
}
|
||||
}
|
||||
display_update();
|
||||
}
|
||||
|
||||
#include "loader.h"
|
||||
@ -318,7 +309,6 @@ void display_loader(uint16_t progress, uint16_t fgcolor, uint16_t bgcolor, const
|
||||
}
|
||||
}
|
||||
}
|
||||
display_update();
|
||||
}
|
||||
|
||||
void display_raw(uint8_t reg, const uint8_t *data, int datalen)
|
||||
|
@ -17,12 +17,12 @@
|
||||
|
||||
void display_init(void);
|
||||
void display_set_window(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||
void display_update(void);
|
||||
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_refresh(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);
|
||||
|
@ -31,6 +31,16 @@ STATIC mp_obj_t mod_TrezorUi_Display_clear(mp_obj_t self) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_TrezorUi_Display_clear_obj, mod_TrezorUi_Display_clear);
|
||||
|
||||
/// def trezor.ui.display.refresh() -> None
|
||||
/// '''
|
||||
/// Refresh display (update screen)
|
||||
/// '''
|
||||
STATIC mp_obj_t mod_TrezorUi_Display_refresh(mp_obj_t self) {
|
||||
display_refresh();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_TrezorUi_Display_refresh_obj, mod_TrezorUi_Display_refresh);
|
||||
|
||||
/// 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.
|
||||
@ -319,6 +329,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorUi_Display_raw_obj, mod_TrezorUi_Disp
|
||||
|
||||
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_refresh), MP_ROM_PTR(&mod_TrezorUi_Display_refresh_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) },
|
||||
|
Loading…
Reference in New Issue
Block a user