|
|
@ -22,10 +22,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_make_new(const mp_obj_type_t *type, size_t
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.bar(x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None) -> None
|
|
|
|
/// def trezor.ui.display.bar(x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders a bar at position (x,y = upper left corner) with width w and height h of color fgcolor.
|
|
|
|
/// Renders a bar at position (x,y = upper left corner) with width w and height h of color fgcolor.
|
|
|
|
/// When a bgcolor is set, the bar is drawn with rounded corners and bgcolor is used for background.
|
|
|
|
/// When a bgcolor is set, the bar is drawn with rounded corners and bgcolor is used for background.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_bar(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_bar(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -46,10 +46,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_bar(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_bar_obj, 6, 7, mod_TrezorUi_Display_bar);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_bar_obj, 6, 7, mod_TrezorUi_Display_bar);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.blit(x: int, y: int, w: int, h: int, data: bytes) -> None
|
|
|
|
/// def trezor.ui.display.blit(x: int, y: int, w: int, h: int, data: bytes) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders rectangle at position (x,y = upper left corner) with width w and height h with data.
|
|
|
|
/// Renders rectangle at position (x,y = upper left corner) with width w and height h with data.
|
|
|
|
/// The data needs to have the correct format.
|
|
|
|
/// The data needs to have the correct format.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_blit(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_blit(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -66,10 +66,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_blit(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_blit_obj, 6, 6, mod_TrezorUi_Display_blit);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_blit_obj, 6, 6, mod_TrezorUi_Display_blit);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.image(x: int, y: int, image: bytes) -> None
|
|
|
|
/// def trezor.ui.display.image(x: int, y: int, image: bytes) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders an image at position (x,y).
|
|
|
|
/// Renders an image at position (x,y).
|
|
|
|
/// The image needs to be in TREZOR Optimized Image Format (TOIF) - full-color mode.
|
|
|
|
/// The image needs to be in TREZOR Optimized Image Format (TOIF) - full-color mode.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_image(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_image(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -94,10 +94,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_image(size_t n_args, const mp_obj_t *args)
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_image_obj, 4, 4, mod_TrezorUi_Display_image);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_image_obj, 4, 4, mod_TrezorUi_Display_image);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.icon(x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None
|
|
|
|
/// def trezor.ui.display.icon(x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders an icon at position (x,y), fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
/// Renders an icon at position (x,y), fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
/// The image needs to be in TREZOR Optimized Image Format (TOIF) - gray-scale mode.
|
|
|
|
/// The image needs to be in TREZOR Optimized Image Format (TOIF) - gray-scale mode.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_icon(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_icon(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -124,10 +124,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_icon(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_icon_obj, 6, 6, mod_TrezorUi_Display_icon);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_icon_obj, 6, 6, mod_TrezorUi_Display_icon);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.text(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
/// def trezor.ui.display.text(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders left-aligned text at position (x,y) where x is left position and y is baseline.
|
|
|
|
/// Renders left-aligned text at position (x,y) where x is left position and y is baseline.
|
|
|
|
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -142,10 +142,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_text(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_obj, 7, 7, mod_TrezorUi_Display_text);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_obj, 7, 7, mod_TrezorUi_Display_text);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.text_center(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
/// def trezor.ui.display.text_center(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders text centered at position (x,y) where x is text center and y is baseline.
|
|
|
|
/// Renders text centered at position (x,y) where x is text center and y is baseline.
|
|
|
|
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text_center(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text_center(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -161,10 +161,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_text_center(size_t n_args, const mp_obj_t *
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_center_obj, 7, 7, mod_TrezorUi_Display_text_center);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_center_obj, 7, 7, mod_TrezorUi_Display_text_center);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.text_right(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
/// def trezor.ui.display.text_right(x: int, y: int, text: bytes, font: int, fgcolor: int, bgcolor: int) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders right-aligned text at position (x,y) where x is right position and y is baseline.
|
|
|
|
/// Renders right-aligned text at position (x,y) where x is right position and y is baseline.
|
|
|
|
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text_right(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text_right(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -180,9 +180,9 @@ STATIC mp_obj_t mod_TrezorUi_Display_text_right(size_t n_args, const mp_obj_t *a
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_right_obj, 7, 7, mod_TrezorUi_Display_text_right);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_right_obj, 7, 7, mod_TrezorUi_Display_text_right);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.text_width(text: bytes, font: int) -> int
|
|
|
|
/// def trezor.ui.display.text_width(text: bytes, font: int) -> int
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Returns a width of text in pixels. Font font is used for rendering.
|
|
|
|
/// Returns a width of text in pixels. Font font is used for rendering.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text_width(mp_obj_t self, mp_obj_t text, mp_obj_t font) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_text_width(mp_obj_t self, mp_obj_t text, mp_obj_t font) {
|
|
|
|
mp_buffer_info_t txt;
|
|
|
|
mp_buffer_info_t txt;
|
|
|
|
mp_get_buffer_raise(text, &txt, MP_BUFFER_READ);
|
|
|
|
mp_get_buffer_raise(text, &txt, MP_BUFFER_READ);
|
|
|
@ -193,10 +193,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_text_width(mp_obj_t self, mp_obj_t text, mp
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorUi_Display_text_width_obj, mod_TrezorUi_Display_text_width);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorUi_Display_text_width_obj, mod_TrezorUi_Display_text_width);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.qrcode(x: int, y: int, data: bytes, scale: int) -> None
|
|
|
|
/// def trezor.ui.display.qrcode(x: int, y: int, data: bytes, scale: int) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders data encoded as a QR code at position (x,y).
|
|
|
|
/// Renders data encoded as a QR code at position (x,y).
|
|
|
|
/// Scale determines a zoom factor.
|
|
|
|
/// Scale determines a zoom factor.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_qrcode(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_qrcode(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t x = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t y = mp_obj_get_int(args[2]);
|
|
|
@ -212,12 +212,12 @@ STATIC mp_obj_t mod_TrezorUi_Display_qrcode(size_t n_args, const mp_obj_t *args)
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_qrcode_obj, 5, 5, mod_TrezorUi_Display_qrcode);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_qrcode_obj, 5, 5, mod_TrezorUi_Display_qrcode);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.loader(progress: int, fgcolor: int, bgcolor: int, icon: bytes=None, iconfgcolor: int=None) -> None
|
|
|
|
/// def trezor.ui.display.loader(progress: int, fgcolor: int, bgcolor: int, icon: bytes=None, iconfgcolor: int=None) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Renders a rotating loader graphic.
|
|
|
|
/// Renders a rotating loader graphic.
|
|
|
|
/// Progress determines its position (0-1000), fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
/// Progress determines its position (0-1000), fgcolor is used as foreground color, bgcolor as background.
|
|
|
|
/// When icon and iconfgcolor are provided, an icon is drawn in the middle using the color specified in iconfgcolor.
|
|
|
|
/// When icon and iconfgcolor are provided, an icon is drawn in the middle using the color specified in iconfgcolor.
|
|
|
|
/// Icon needs to be of exaclty 96x96 pixels size.
|
|
|
|
/// Icon needs to be of exaclty 96x96 pixels size.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_loader(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_loader(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t progress = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t progress = mp_obj_get_int(args[1]);
|
|
|
|
mp_int_t fgcolor = mp_obj_get_int(args[2]);
|
|
|
|
mp_int_t fgcolor = mp_obj_get_int(args[2]);
|
|
|
@ -253,11 +253,11 @@ STATIC mp_obj_t mod_TrezorUi_Display_loader(size_t n_args, const mp_obj_t *args)
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_loader_obj, 4, 6, mod_TrezorUi_Display_loader);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_loader_obj, 4, 6, mod_TrezorUi_Display_loader);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.orientation(degrees: int=None) -> int
|
|
|
|
/// def trezor.ui.display.orientation(degrees: int=None) -> int
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Sets display orientation to 0, 90, 180 or 270 degrees.
|
|
|
|
/// Sets display orientation to 0, 90, 180 or 270 degrees.
|
|
|
|
/// Everything needs to be redrawn again when this function is used.
|
|
|
|
/// Everything needs to be redrawn again when this function is used.
|
|
|
|
/// Call without the degrees parameter to just perform the read of the value.
|
|
|
|
/// Call without the degrees parameter to just perform the read of the value.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_orientation(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_orientation(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t deg;
|
|
|
|
mp_int_t deg;
|
|
|
|
if (n_args > 1) {
|
|
|
|
if (n_args > 1) {
|
|
|
@ -274,10 +274,10 @@ STATIC mp_obj_t mod_TrezorUi_Display_orientation(size_t n_args, const mp_obj_t *
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_orientation_obj, 1, 2, mod_TrezorUi_Display_orientation);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_orientation_obj, 1, 2, mod_TrezorUi_Display_orientation);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.backlight(val: int=None) -> int
|
|
|
|
/// def trezor.ui.display.backlight(val: int=None) -> int
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Sets backlight intensity to the value specified in val.
|
|
|
|
/// Sets backlight intensity to the value specified in val.
|
|
|
|
/// Call without the val parameter to just perform the read of the value.
|
|
|
|
/// Call without the val parameter to just perform the read of the value.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_backlight(size_t n_args, const mp_obj_t *args) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_backlight(size_t n_args, const mp_obj_t *args) {
|
|
|
|
mp_int_t val;
|
|
|
|
mp_int_t val;
|
|
|
|
if (n_args > 1) {
|
|
|
|
if (n_args > 1) {
|
|
|
@ -294,9 +294,9 @@ STATIC mp_obj_t mod_TrezorUi_Display_backlight(size_t n_args, const mp_obj_t *ar
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_backlight_obj, 1, 2, mod_TrezorUi_Display_backlight);
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_backlight_obj, 1, 2, mod_TrezorUi_Display_backlight);
|
|
|
|
|
|
|
|
|
|
|
|
/// def trezor.ui.display.raw(reg: int, data: bytes) -> None
|
|
|
|
/// def trezor.ui.display.raw(reg: int, data: bytes) -> None
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
/// Performs a raw command on the display. Read the datasheet to learn more.
|
|
|
|
/// Performs a raw command on the display. Read the datasheet to learn more.
|
|
|
|
///
|
|
|
|
/// '''
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_raw(mp_obj_t self, mp_obj_t reg, mp_obj_t data) {
|
|
|
|
STATIC mp_obj_t mod_TrezorUi_Display_raw(mp_obj_t self, mp_obj_t reg, mp_obj_t data) {
|
|
|
|
mp_int_t r = mp_obj_get_int(reg);
|
|
|
|
mp_int_t r = mp_obj_get_int(reg);
|
|
|
|
mp_buffer_info_t raw;
|
|
|
|
mp_buffer_info_t raw;
|
|
|
|