mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
modtrezorui: display.raw data parameter is now optional
This commit is contained in:
parent
037df3357c
commit
f16d730c58
@ -413,7 +413,9 @@ void display_raw(uint8_t reg, const uint8_t *data, int datalen)
|
|||||||
if (reg) {
|
if (reg) {
|
||||||
CMD(reg);
|
CMD(reg);
|
||||||
}
|
}
|
||||||
|
if (data && datalen > 0) {
|
||||||
DATAS(data, datalen);
|
DATAS(data, datalen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int *display_offset(int xy[2])
|
int *display_offset(int xy[2])
|
||||||
|
@ -337,18 +337,22 @@ STATIC mp_obj_t mod_TrezorUi_Display_offset(size_t n_args, const mp_obj_t *args)
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_offset_obj, 1, 2, mod_TrezorUi_Display_offset);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_offset_obj, 1, 2, mod_TrezorUi_Display_offset);
|
||||||
|
|
||||||
/// def trezor.ui.display.raw(reg: int, data: bytes) -> None:
|
/// def trezor.ui.display.raw(reg: int, data: bytes=None) -> 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(size_t n_args, const mp_obj_t *args) {
|
||||||
mp_int_t r = mp_obj_get_int(reg);
|
mp_int_t r = mp_obj_get_int(args[1]);
|
||||||
|
if (n_args > 2){
|
||||||
mp_buffer_info_t raw;
|
mp_buffer_info_t raw;
|
||||||
mp_get_buffer_raise(data, &raw, MP_BUFFER_READ);
|
mp_get_buffer_raise(args[2], &raw, MP_BUFFER_READ);
|
||||||
display_raw(r, (raw.len > 0) ? raw.buf : "" , raw.len);
|
display_raw(r, raw.buf, raw.len);
|
||||||
|
} else {
|
||||||
|
display_raw(r, NULL, 0);
|
||||||
|
}
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorUi_Display_raw_obj, mod_TrezorUi_Display_raw);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_raw_obj, 2, 3, mod_TrezorUi_Display_raw);
|
||||||
|
|
||||||
/// def trezor.ui.display.save(filename: string) -> None:
|
/// def trezor.ui.display.save(filename: string) -> None:
|
||||||
/// '''
|
/// '''
|
||||||
|
Loading…
Reference in New Issue
Block a user