cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Loading...
Searching...
No Matches
ui_sale.cpp File Reference

The sale flow: amount, confirm, PIN, transaction status, and their page chrome. More...

#include "ui_internal.h"
Include dependency graph for ui_sale.cpp:

Go to the source code of this file.

Macros

#define CHIP_W   56
#define BSP_W
#define BSP_H   9
#define BSP_NOSE   6
#define BSP_CROSS   4
#define BSP_LINE   2
#define BSP_R   3
#define BSP_R45   2 /* round(BSP_R * sin 45) — the fillet's middle point */
#define BSP_NOSE_DX   2 /* the nose's cut, one third of its run... */
#define BSP_NOSE_DY   3 /* ...and one third of its rise */

Functions

static lv_coord_t amount_ink_shift (const lv_font_t *f)
static void amount_row_place (void)
static void charge_set_enabled (bool on)
void charge_set_busy (void)
static void amount_update_display (void)
static void kbd_fill_rows (lv_obj_t *kb)
static void kbd_backspace_draw_cb (lv_event_t *e)
static void amount_kbd_cb (lv_event_t *e)
void code_field_reveal (lv_obj_t *ta, lv_obj_t *eye_lbl)
void build_splash (void)
void build_amount (void)
void build_confirm (void)
static void pin_submit (void)
static void pin_kbd_cb (lv_event_t *e)
static void code_hint_cb (lv_event_t *e)
static lv_obj_t * make_code_field (uint32_t max_len, lv_coord_t x1, lv_coord_t y, const char *hint, lv_coord_t w, lv_obj_t *parent=NULL)
lv_obj_t * make_numeric_keypad (lv_event_cb_t cb, lv_obj_t *parent, lv_coord_t w, lv_coord_t h)
lv_obj_t * make_code_row (lv_obj_t *host, lv_obj_t *kb, uint32_t max_len, const char *hint, BtnAction eye_act, lv_obj_t **eye_lbl)
void build_pin (void)
static void zoom_anim_cb (void *obj, int32_t v)
void pop_in (lv_obj_t *obj)
static void hash_short (const char *h, char *out, size_t n)
static void tx_amount_row (lv_obj_t *parent, const char *amt, const lv_font_t *font, lv_coord_t y, bool ticker)
void build_tx_status (void)
void build_boot_error (void)

Detailed Description

The sale flow: amount, confirm, PIN, transaction status, and their page chrome.

Definition in file ui_sale.cpp.

Macro Definition Documentation

◆ BSP_CROSS

#define BSP_CROSS   4

Definition at line 149 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_H

#define BSP_H   9

Definition at line 147 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_LINE

#define BSP_LINE   2

Definition at line 150 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_NOSE

#define BSP_NOSE   6

Definition at line 148 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_NOSE_DX

#define BSP_NOSE_DX   2 /* the nose's cut, one third of its run... */

Definition at line 163 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_NOSE_DY

#define BSP_NOSE_DY   3 /* ...and one third of its rise */

Definition at line 164 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_R

#define BSP_R   3

Definition at line 161 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_R45

#define BSP_R45   2 /* round(BSP_R * sin 45) — the fillet's middle point */

Definition at line 162 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ BSP_W

#define BSP_W
Value:
16 /* half-length; 32 wide against 18 tall reads as the
* conventional backspace proportion (tuned by eye) */

Definition at line 146 of file ui_sale.cpp.

Referenced by kbd_backspace_draw_cb().

◆ CHIP_W

#define CHIP_W   56

Definition at line 14 of file ui_sale.cpp.

Function Documentation

◆ amount_ink_shift()

lv_coord_t amount_ink_shift ( const lv_font_t * f)
static

Place the figure's row: on the screen's centre line, and on the coin's.

Vertically: the row's measured height against the selector's, so the digits' ink middle (amount_ink_shift(), read off the font's '0') lands on the coin's.

Horizontally: the screen's centre, which the keypad and Charge button share. The row slides left only as far as it must to clear the selector, so a typical amount stays centred. Both widths are measured, never predicted. Nothing on this row is dropped to make it fit: the figure is money.

Definition at line 28 of file ui_sale.cpp.

Referenced by amount_row_place().

◆ amount_kbd_cb()

void amount_kbd_cb ( lv_event_t * e)
static

◆ amount_row_place()

void amount_row_place ( void )
static

◆ amount_update_display()

◆ build_amount()

void build_amount ( void )

Definition at line 330 of file ui_sale.cpp.

Referenced by render_requested_screen().

◆ build_boot_error()

◆ build_confirm()

void build_confirm ( void )

Definition at line 400 of file ui_sale.cpp.

Referenced by render_requested_screen().

◆ build_pin()

void build_pin ( void )

Definition at line 643 of file ui_sale.cpp.

Referenced by render_requested_screen().

◆ build_splash()

void build_splash ( void )

Definition at line 295 of file ui_sale.cpp.

Referenced by render_requested_screen().

◆ build_tx_status()

void build_tx_status ( void )

Definition at line 734 of file ui_sale.cpp.

Referenced by render_requested_screen().

◆ charge_set_busy()

void charge_set_busy ( void )

Charge has been tapped: inert until this screen is next built.

A gate, not a look: it does not repaint the button. It stops a second UI_EVENT_AMOUNT_CONFIRMED queued behind the first, whose echo would otherwise pull an operator who double-tapped Charge back out of the PIN keypad.

Definition at line 100 of file ui_sale.cpp.

References s_charge_btn, and s_charge_busy.

Referenced by btn_event_cb().

◆ charge_set_enabled()

void charge_set_enabled ( bool on)
static

Charge is available only once there is something to charge.

0.00 is not a sale; a lit button that ignores the tap reads as a missed touch on a resistive panel. btn_event_cb drops the event; this makes that visible.

LV_STATE_DISABLED rather than hiding: LVGL's hit test drops taps on a disabled object (lv_obj_pos.c), so the state is the whole gate. The label is recoloured by hand because make_button() styles the label itself, out of the state's reach.

Definition at line 79 of file ui_sale.cpp.

References COL_ACTION, COL_BG, COL_DIM, COL_SURFACE, and s_charge_btn.

Referenced by amount_update_display().

◆ code_field_reveal()

void code_field_reveal ( lv_obj_t * ta,
lv_obj_t * eye_lbl )

Flip a masked field between hidden and shown, and swap its eye glyph to match.

Toggled in place, never via request_screen(): rebuilding the screen would discard what has been typed, which on the PIN keypad costs the operator an attempt the card is counting. The glyph shows what the next tap does. Either argument may be NULL; nothing but convention ties the action to its screen.

Definition at line 286 of file ui_sale.cpp.

Referenced by btn_event_cb().

◆ code_hint_cb()

void code_hint_cb ( lv_event_t * e)
static

Definition at line 532 of file ui_sale.cpp.

Referenced by make_code_field().

◆ hash_short()

void hash_short ( const char * h,
char * out,
size_t n )
static

Definition at line 694 of file ui_sale.cpp.

◆ kbd_backspace_draw_cb()

void kbd_backspace_draw_cb ( lv_event_t * e)
static

Draw the keypad's backspace as an outline rather than a solid glyph.

LV_SYMBOL_BACKSPACE is a filled slab at 28px, the heaviest mark beside thin numerals. It keeps the digits' colour: grey would read as disabled.

Drawn because a btnmatrix key holds text and the symbol font has no outline backspace: DRAW_PART_BEGIN hides the glyph, END draws in the key's own area. Used on the amount, PIN and admin pads; matched on the key's text, not index.

Definition at line 183 of file ui_sale.cpp.

References BSP_CROSS, BSP_H, BSP_LINE, BSP_NOSE, BSP_NOSE_DX, BSP_NOSE_DY, BSP_R, BSP_R45, BSP_W, and COL_TEXT.

◆ kbd_fill_rows()

void kbd_fill_rows ( lv_obj_t * kb)
static

Definition at line 168 of file ui_sale.cpp.

◆ make_code_field()

lv_obj_t * make_code_field ( uint32_t max_len,
lv_coord_t x1,
lv_coord_t y,
const char * hint,
lv_coord_t w,
lv_obj_t * parent = NULL )
static

Definition at line 544 of file ui_sale.cpp.

References code_hint_cb(), COL_DIM, FIELD_PAD_V, font_inter_14, and make_label().

Referenced by make_code_row().

◆ make_code_row()

lv_obj_t * make_code_row ( lv_obj_t * host,
lv_obj_t * kb,
uint32_t max_len,
const char * hint,
BtnAction eye_act,
lv_obj_t ** eye_lbl )

Definition at line 615 of file ui_sale.cpp.

References make_code_field(), and make_icon_button().

Referenced by build_admin_screen().

◆ make_numeric_keypad()

lv_obj_t * make_numeric_keypad ( lv_event_cb_t cb,
lv_obj_t * parent,
lv_coord_t w,
lv_coord_t h )

Definition at line 576 of file ui_sale.cpp.

Referenced by build_admin_screen().

◆ pin_kbd_cb()

void pin_kbd_cb ( lv_event_t * e)
static

Definition at line 515 of file ui_sale.cpp.

References pin_submit(), and s_pin_ta.

◆ pin_submit()

◆ pop_in()

void pop_in ( lv_obj_t * obj)

Definition at line 673 of file ui_sale.cpp.

References zoom_anim_cb().

Referenced by build_boot_error(), build_prov(), and build_welcome().

◆ tx_amount_row()

void tx_amount_row ( lv_obj_t * parent,
const char * amt,
const lv_font_t * font,
lv_coord_t y,
bool ticker )
static

◆ zoom_anim_cb()

void zoom_anim_cb ( void * obj,
int32_t v )
static

Definition at line 668 of file ui_sale.cpp.

Referenced by pop_in().