|
cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
|
Widget helpers shared by every screen, and the Wi-Fi signal mark. More...
#include "ui_internal.h"Go to the source code of this file.
Macros | |
| #define | CHIP_SZ 16 |
| #define | BADGE_SZ (COIN_SZ + 6) /* room for the chip to hang off the corner */ |
| #define | TAP_MARK_W 109 |
| #define | COL_TAP_MARK COL_TEXT |
| #define | PILL_TEXT_X 52 /* clears the BADGE_SZ icon at PILL_ICON_X */ |
| #define | PILL_TEXT_PAD_R 24 |
| #define | SIG_ARCS 3 |
| #define | SIG_AW 2 /* arc thickness */ |
| #define | SIG_R0 4 /* innermost arc radius; each ring adds SIG_RSTEP */ |
| #define | SIG_RSTEP 3 |
| #define | SIG_DOT 4 |
| #define | SIG_REACH (SIG_R0 + ((SIG_ARCS - 1) * SIG_RSTEP) + (SIG_AW / 2)) |
| #define | SIG_W (2 * SIG_REACH) |
| #define | SIG_H (SIG_REACH + ((SIG_DOT + 1) / 2)) |
| #define | SIG_INSET 14 |
Functions | |
| lv_obj_t * | make_button (lv_obj_t *parent, const char *label, lv_color_t bg, lv_color_t fg, lv_coord_t w, lv_coord_t h, lv_align_t align, lv_coord_t x, lv_coord_t y, BtnAction act, const lv_font_t *font) |
| lv_obj_t * | make_label (lv_obj_t *parent, const char *txt, lv_color_t color, const lv_font_t *font, lv_align_t align, lv_coord_t x, lv_coord_t y) |
| lv_obj_t * | make_ghost_button (lv_obj_t *parent, const char *label, lv_coord_t w, lv_align_t align, lv_coord_t x, lv_coord_t y, BtnAction act) |
| void | make_divider (lv_obj_t *parent, lv_coord_t y) |
| lv_obj_t * | make_glyph_disc (lv_obj_t *parent, const char *sym, lv_color_t bg, lv_coord_t sz) |
| static lv_obj_t * | make_icon_box (lv_obj_t *parent, const lv_img_dsc_t *coin_src, const lv_img_dsc_t *chip_src) |
| static const lv_img_dsc_t * | coin_icon (const pos_asset_t *a) |
| lv_obj_t * | make_asset_badge (lv_obj_t *parent, pos_chain_t chain) |
| lv_obj_t * | make_asset_button (lv_obj_t *parent) |
| void | asset_btn_set_compact (bool compact) |
| lv_obj_t * | make_net_badge (lv_obj_t *parent, pos_net_t net) |
| void | make_tap_mark (lv_obj_t *parent, lv_coord_t y) |
| lv_obj_t * | make_pill (lv_obj_t *parent, const char *title, const char *sub, lv_coord_t w, lv_coord_t y, BtnAction act, bool leaf) |
| lv_obj_t * | make_field (lv_obj_t *parent, const char *caption, const char *value, lv_color_t col) |
| static void | sheet_y_cb (void *obj, int32_t v) |
| static lv_obj_t * | sheet_open (void) |
| static void | sheet_slide_in (lv_obj_t *sh) |
| static void | code_field_wipe (lv_obj_t *ta) |
| void | clear_screen (void) |
| static void | clock_refresh (void) |
| Retext the band's clock from the system clock plus the stored offset. | |
| void | paint_page (lv_obj_t *obj) |
| Lay the sale-flow chrome and return the white card to build into. | |
| lv_obj_t * | make_card (lv_obj_t *parent) |
| lv_obj_t * | build_page (int step, bool band) |
| lv_obj_t * | make_icon_button (const char *sym, BtnAction act, lv_obj_t *parent) |
| void | add_test_chip (void) |
| lv_obj_t * | make_title (const char *txt, bool has_icon, lv_obj_t *parent) |
| Screen title, centred but never underneath the top-left icon button. | |
| void | build_header (const char *title) |
| static void | signal_refresh (lv_timer_t *t) |
| void | signal_init (void) |
| void | render_requested_screen (void) |
Variables | |
| static const lv_img_dsc_t *const | NET_ICON [POS_NET__COUNT] |
| static const lv_img_dsc_t *const | NET_CHIP [POS_NET__COUNT] |
| static int16_t | s_tz_off_min = 0 |
| static uint8_t | s_tz_dst = 0 |
| volatile bool | s_tz_dirty = true |
| static const uint16_t | SIG_SWEEP [SIG_ARCS] = { 140, 110, 100 } |
| static lv_obj_t * | s_sig_arc [SIG_ARCS] |
| static lv_obj_t * | s_sig_dot = NULL |
| static lv_obj_t * | s_sig_box = NULL |
Widget helpers shared by every screen, and the Wi-Fi signal mark.
Definition in file ui_widgets.cpp.
| #define BADGE_SZ (COIN_SZ + 6) /* room for the chip to hang off the corner */ |
Definition at line 102 of file ui_widgets.cpp.
Referenced by make_icon_box().
| #define CHIP_SZ 16 |
Definition at line 101 of file ui_widgets.cpp.
| #define COL_TAP_MARK COL_TEXT |
Definition at line 251 of file ui_widgets.cpp.
Referenced by make_tap_mark().
| #define PILL_TEXT_PAD_R 24 |
Definition at line 264 of file ui_widgets.cpp.
Referenced by make_pill().
| #define PILL_TEXT_X 52 /* clears the BADGE_SZ icon at PILL_ICON_X */ |
Definition at line 261 of file ui_widgets.cpp.
Referenced by make_pill().
| #define SIG_ARCS 3 |
Definition at line 636 of file ui_widgets.cpp.
Referenced by signal_init(), and signal_refresh().
| #define SIG_AW 2 /* arc thickness */ |
Definition at line 637 of file ui_widgets.cpp.
Referenced by signal_init().
| #define SIG_DOT 4 |
Definition at line 645 of file ui_widgets.cpp.
Referenced by signal_init().
Definition at line 657 of file ui_widgets.cpp.
Referenced by signal_init().
| #define SIG_INSET 14 |
Definition at line 659 of file ui_widgets.cpp.
Referenced by signal_init().
| #define SIG_R0 4 /* innermost arc radius; each ring adds SIG_RSTEP */ |
Definition at line 640 of file ui_widgets.cpp.
Referenced by signal_init().
Definition at line 655 of file ui_widgets.cpp.
Referenced by signal_init().
| #define SIG_RSTEP 3 |
Definition at line 641 of file ui_widgets.cpp.
Referenced by signal_init().
| #define SIG_W (2 * SIG_REACH) |
Definition at line 656 of file ui_widgets.cpp.
Referenced by signal_init().
| #define TAP_MARK_W 109 |
Definition at line 246 of file ui_widgets.cpp.
| void add_test_chip | ( | void | ) |
Definition at line 561 of file ui_widgets.cpp.
References CHIP_X, CHIP_Y, COL_BG, COL_DANGER, font_inter_14_medium, and settings_get_mainnet().
| void asset_btn_set_compact | ( | bool | compact | ) |
Definition at line 219 of file ui_widgets.cpp.
References s_asset_arrow.
Referenced by amount_update_display().
| void build_header | ( | const char * | title | ) |
Definition at line 617 of file ui_widgets.cpp.
References HDR_DIVIDER_Y, make_divider(), and make_title().
Referenced by build_boot_error(), build_touch_cal(), and build_wifi_connecting().
| lv_obj_t * build_page | ( | int | step, |
| bool | band ) |
Definition at line 496 of file ui_widgets.cpp.
References clear_screen(), clock_refresh(), CLOCK_X, CLOCK_Y, COL_HOME_BAR, COL_TITLE, font_inter_14_medium, make_card(), make_label(), paint_page(), s_clock_lbl, and s_page_card.
Referenced by build_admin_screen(), build_card_wait(), build_prov(), and build_welcome().
| void clear_screen | ( | void | ) |
Definition at line 378 of file ui_widgets.cpp.
References code_field_wipe(), COL_BG, s_admin_note_lbl, s_admin_ta, s_amount_cents_label, s_amount_label, s_amount_row, s_asset_arrow, s_asset_btn, s_boot_step_lbl, s_cal_countdown, s_charge_btn, s_charge_busy, s_clock_lbl, s_close_btn, s_fee_max_lbl, s_fee_prio_lbl, s_page_card, s_pin_eye_lbl, s_pin_ta, s_reset_btn, s_tx_info_lbl, s_wifi_eye_lbl, and s_wifi_pass_ta.
Referenced by build_boot_error(), build_page(), build_prov(), build_settings(), build_touch_cal(), build_wifi_connecting(), build_wifi_list(), and build_wifi_pass().
|
static |
Retext the band's clock from the system clock plus the stored offset.
"--:--" until SNTP has set the clock: a till showing a confident wrong time (1970) is worse than one admitting it has none.
gmtime_r on an already-offset instant, not localtime_r: newlib's timezone machinery costs 64 KB of the app slot. DST comes from civil_local_offset_min(). Minute resolution, so the 3 s Wi-Fi status timer drives it.
Definition at line 431 of file ui_widgets.cpp.
References civil_local_offset_min(), s_clock_lbl, s_tz_dirty, s_tz_dst, s_tz_off_min, settings_get_tz_dst(), and settings_get_tz_offset_min().
Referenced by build_page(), and signal_refresh().
|
static |
Definition at line 371 of file ui_widgets.cpp.
Referenced by clear_screen().
|
static |
Definition at line 161 of file ui_widgets.cpp.
References pos_asset_t::coin, icon_usdc, icon_usdt, pos_asset_t::net, NET_ICON, POS_COIN_USDC, and POS_COIN_USDT.
Referenced by make_asset_badge().
| lv_obj_t * make_asset_badge | ( | lv_obj_t * | parent, |
| pos_chain_t | chain ) |
Definition at line 171 of file ui_widgets.cpp.
References coin_icon(), make_icon_box(), pos_asset_t::native, pos_asset_t::net, NET_CHIP, NET_ICON, and pos_asset_of().
Referenced by build_settings(), make_asset_button(), open_coin_picker(), and tx_amount_row().
| lv_obj_t * make_asset_button | ( | lv_obj_t * | parent | ) |
Definition at line 182 of file ui_widgets.cpp.
References ACT_NET_PICK, ASSET_BTN_H, ASSET_BTN_PAD, ASSET_BTN_X, ASSET_BTN_Y, asset_name(), btn_event_cb(), COL_DIM, COL_SURFACE, COL_TEXT, font_inter_14, font_inter_14_medium, make_asset_badge(), make_label(), s_asset_arrow, s_asset_btn, and settings_get_chain().
| lv_obj_t * make_button | ( | lv_obj_t * | parent, |
| const char * | label, | ||
| lv_color_t | bg, | ||
| lv_color_t | fg, | ||
| lv_coord_t | w, | ||
| lv_coord_t | h, | ||
| lv_align_t | align, | ||
| lv_coord_t | x, | ||
| lv_coord_t | y, | ||
| BtnAction | act, | ||
| const lv_font_t * | font ) |
Definition at line 17 of file ui_widgets.cpp.
References btn_event_cb(), BTN_RADIUS, COL_ACTION, COL_BORDER, and COL_SURFACE.
Referenced by build_ota_confirm(), build_prov(), build_prov_confirm(), build_settings(), build_touch_cal(), build_welcome(), build_wifi_list(), make_ghost_button(), open_coin_picker(), open_network_picker(), open_ota_gone(), open_portal_window(), and open_reset_confirm().
| lv_obj_t * make_card | ( | lv_obj_t * | parent | ) |
Definition at line 481 of file ui_widgets.cpp.
References CARD_H, CARD_W, CARD_X, CARD_Y, and COL_BG.
Referenced by build_admin_screen(), and build_page().
| void make_divider | ( | lv_obj_t * | parent, |
| lv_coord_t | y ) |
Definition at line 91 of file ui_widgets.cpp.
References COL_BORDER, and SCR_W.
Referenced by build_header(), and build_header_back().
| lv_obj_t * make_field | ( | lv_obj_t * | parent, |
| const char * | caption, | ||
| const char * | value, | ||
| lv_color_t | col ) |
Definition at line 316 of file ui_widgets.cpp.
References COL_DIM, font_inter_14, font_inter_14_medium, make_label(), and TAB_W.
Referenced by build_settings().
| lv_obj_t * make_ghost_button | ( | lv_obj_t * | parent, |
| const char * | label, | ||
| lv_coord_t | w, | ||
| lv_align_t | align, | ||
| lv_coord_t | x, | ||
| lv_coord_t | y, | ||
| BtnAction | act ) |
Definition at line 78 of file ui_widgets.cpp.
References CARD_BTN_H, COL_BG, COL_BORDER, COL_TEXT, font_pjs_20_semibold, and make_button().
Referenced by build_card_wait().
| lv_obj_t * make_glyph_disc | ( | lv_obj_t * | parent, |
| const char * | sym, | ||
| lv_color_t | bg, | ||
| lv_coord_t | sz ) |
Definition at line 103 of file ui_widgets.cpp.
References COL_BG, and font_inter_14.
Referenced by build_settings().
|
static |
Definition at line 129 of file ui_widgets.cpp.
References BADGE_SZ, and COIN_SZ.
Referenced by make_asset_badge(), and make_net_badge().
| lv_obj_t * make_icon_button | ( | const char * | sym, |
| BtnAction | act, | ||
| lv_obj_t * | parent ) |
Definition at line 532 of file ui_widgets.cpp.
References btn_event_cb(), COL_TEXT, font_pjs_20_medium, MENU_BTN_H, MENU_BTN_W, MENU_BTN_X, and MENU_BTN_Y.
Referenced by build_admin_screen(), build_header_back(), build_wifi_pass(), and make_code_row().
| lv_obj_t * make_label | ( | lv_obj_t * | parent, |
| const char * | txt, | ||
| lv_color_t | color, | ||
| const lv_font_t * | font, | ||
| lv_align_t | align, | ||
| lv_coord_t | x, | ||
| lv_coord_t | y ) |
Definition at line 64 of file ui_widgets.cpp.
Referenced by build_admin_screen(), build_boot_error(), build_card_wait(), build_page(), build_prov(), build_settings(), build_touch_cal(), build_welcome(), build_wifi_connecting(), build_wifi_list(), build_wifi_pass(), make_asset_button(), make_code_field(), make_field(), make_pill(), make_title(), open_coin_picker(), open_network_picker(), open_reset_confirm(), ota_text(), and tx_amount_row().
| lv_obj_t * make_net_badge | ( | lv_obj_t * | parent, |
| pos_net_t | net ) |
Definition at line 227 of file ui_widgets.cpp.
References make_icon_box(), and NET_ICON.
Referenced by open_network_picker().
| lv_obj_t * make_pill | ( | lv_obj_t * | parent, |
| const char * | title, | ||
| const char * | sub, | ||
| lv_coord_t | w, | ||
| lv_coord_t | y, | ||
| BtnAction | act, | ||
| bool | leaf ) |
Definition at line 265 of file ui_widgets.cpp.
References btn_event_cb(), COL_DIM, COL_SURFACE, COL_TEXT, font_inter_14, font_pjs_20_medium, make_label(), PILL_H, PILL_TEXT_PAD_R, and PILL_TEXT_X.
Referenced by build_settings(), open_coin_picker(), and open_network_picker().
| void make_tap_mark | ( | lv_obj_t * | parent, |
| lv_coord_t | y ) |
Definition at line 252 of file ui_widgets.cpp.
References COL_TAP_MARK, and tap_icon.
Referenced by build_card_wait().
| lv_obj_t * make_title | ( | const char * | txt, |
| bool | has_icon, | ||
| lv_obj_t * | parent ) |
Screen title, centred but never underneath the top-left icon button.
The title gets the gap between two symmetric gutters; if it does not fit at 20px it drops to the 14px face rather than overlapping the icon or eliding. The width cap and LONG_DOT are the backstop for a title too long even at 14px.
| has_icon | true when make_icon_button() has put a glyph in the top-left. |
Definition at line 586 of file ui_widgets.cpp.
References COL_TITLE, font_inter_14_medium, font_pjs_20_medium, HDR_TITLE_Y, make_label(), MENU_BTN_W, MENU_BTN_X, and SCR_W.
Referenced by build_admin_screen(), build_header(), and build_header_back().
| void paint_page | ( | lv_obj_t * | obj | ) |
Lay the sale-flow chrome and return the white card to build into.
| step | Which step of the sale this is (PAY_STEP_*). Currently unused. |
Definition at line 470 of file ui_widgets.cpp.
References COL_PAGE, and COL_PAGE_GRAD.
Referenced by build_admin_screen(), and build_page().
| void render_requested_screen | ( | void | ) |
Definition at line 753 of file ui_widgets.cpp.
References build_admin_set(), build_admin_unlock(), build_amount(), build_boot_error(), build_card_wait(), build_confirm(), build_pin(), build_prov(), build_settings(), build_splash(), build_touch_cal(), build_tx_status(), build_welcome(), build_wifi_connecting(), build_wifi_list(), build_wifi_pass(), close_modal(), s_input_block_until, s_req_screen, s_sheet, s_sheet_pending, s_sig_box, s_tx_state, s_wait_release, sheet_open(), sheet_slide_in(), signal_refresh(), UI_SCREEN_ADMIN_SET, UI_SCREEN_ADMIN_UNLOCK, UI_SCREEN_AMOUNT, UI_SCREEN_BOOT_ERROR, UI_SCREEN_CARD_WAIT, UI_SCREEN_CONFIRM, UI_SCREEN_PIN, UI_SCREEN_PROV, UI_SCREEN_SETTINGS, UI_SCREEN_SPLASH, UI_SCREEN_TOUCH_CAL, UI_SCREEN_TX_STATUS, UI_SCREEN_WELCOME, UI_SCREEN_WIFI_CONNECTING, UI_SCREEN_WIFI_LIST, UI_SCREEN_WIFI_PASS, and UI_TX_STATE_PLACE_CARD.
Referenced by ui_task().
|
static |
Definition at line 341 of file ui_widgets.cpp.
References COL_BG, SCR_H, and SCR_W.
Referenced by render_requested_screen().
|
static |
Definition at line 354 of file ui_widgets.cpp.
References SCR_H, and sheet_y_cb().
Referenced by render_requested_screen().
|
static |
Definition at line 334 of file ui_widgets.cpp.
Referenced by sheet_slide_in().
| void signal_init | ( | void | ) |
|
static |
Definition at line 665 of file ui_widgets.cpp.
References clock_refresh(), COL_DIM, COL_TEXT, COL_WARN, net_wifi_reconnecting(), net_wifi_rssi(), s_pin_for_card, s_req_screen, s_sig_arc, s_sig_box, s_sig_dot, SIG_ARCS, UI_SCREEN_ADMIN_SET, UI_SCREEN_ADMIN_UNLOCK, UI_SCREEN_CARD_WAIT, UI_SCREEN_PIN, UI_SCREEN_PROV, UI_SCREEN_SETTINGS, UI_SCREEN_SPLASH, UI_SCREEN_TOUCH_CAL, UI_SCREEN_WELCOME, UI_SCREEN_WIFI_CONNECTING, UI_SCREEN_WIFI_LIST, and UI_SCREEN_WIFI_PASS.
Referenced by render_requested_screen(), and signal_init().
|
static |
Definition at line 156 of file ui_widgets.cpp.
Referenced by make_asset_badge().
|
static |
Definition at line 153 of file ui_widgets.cpp.
Referenced by coin_icon(), make_asset_badge(), and make_net_badge().
|
static |
Definition at line 661 of file ui_widgets.cpp.
Referenced by signal_init(), and signal_refresh().
|
static |
Definition at line 663 of file ui_widgets.cpp.
Referenced by render_requested_screen(), signal_init(), and signal_refresh().
|
static |
Definition at line 662 of file ui_widgets.cpp.
Referenced by signal_init(), and signal_refresh().
| volatile bool s_tz_dirty = true |
Definition at line 419 of file ui_widgets.cpp.
Referenced by clock_refresh(), and ui_clock_changed().
|
static |
Definition at line 418 of file ui_widgets.cpp.
Referenced by clock_refresh().
|
static |
Definition at line 417 of file ui_widgets.cpp.
Referenced by clock_refresh().
|
static |
Definition at line 651 of file ui_widgets.cpp.
Referenced by signal_init().