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

cryptnox-pos entry point: touchscreen USDC payment terminal. More...

#include "pos_app.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Macros

#define MAIN_LOOP_TICK_MS   5000U
#define HEAP_LOG_PERIOD_US   (10LL * 60LL * 1000000LL)

Functions

void ui_event_dispatch (ui_event_t event, uint64_t payload)
 UI-task callback: forward a touch event to the main task queue.
void app_main (void)
 ESP-IDF application entry point: bring-up, then the main interaction loop (amount → confirm → sign+broadcast).

Variables

QueueHandle_t s_ui_queue = NULL
std::atomic< bool > s_user_cancelled {false}

Detailed Description

cryptnox-pos entry point: touchscreen USDC payment terminal.

Drives the amount → confirm → sign → broadcast flow on the Cheap Yellow Display, signing EIP-1559 USDC transfers on a Cryptnox card via PN532.

Definition in file main.cpp.

Macro Definition Documentation

◆ HEAP_LOG_PERIOD_US

#define HEAP_LOG_PERIOD_US   (10LL * 60LL * 1000000LL)

Definition at line 21 of file main.cpp.

Referenced by app_main().

◆ MAIN_LOOP_TICK_MS

#define MAIN_LOOP_TICK_MS   5000U

Definition at line 20 of file main.cpp.

Referenced by app_main().

Function Documentation

◆ app_main()

void app_main ( void )

ESP-IDF application entry point: bring-up, then the main interaction loop (amount → confirm → sign+broadcast).

Definition at line 51 of file main.cpp.

References inflight_t::active, active_dest(), active_token(), token_t::addr, address_consistent(), amount_consistent(), pos_amount_t::amount_minor, BCAST_FAILED, BCAST_SENT, inflight_t::broadcast_known, card_read_payouts(), chain_is_polygon(), chain_is_tron(), pos_hw_t::crypto, inflight_t::decided, ui_msg_t::event, evm_fees_wei(), HEAP_LOG_PERIOD_US, IS_TRUE32, MAIN_LOOP_TICK_MS, net_time_sync(), net_wifi_connect(), net_wifi_disconnect(), net_wifi_keep_trying(), net_wifi_online(), net_wifi_scan(), NOTE_JOIN_FAILED, NOTE_NO_TIME, token_t::ok, pay_sign_and_broadcast(), ui_msg_t::payload, pos_amount_set(), pos_boot(), pos_handle_anomaly(), PROV_ASK_PAYOUT_ETH, PROV_ASK_PAYOUT_TRON, prov_mode(), PROV_MODE_OFF, prov_propose(), prov_set_note(), prov_set_scan(), prov_stop(), s_inflight, s_payout_bad, s_payout_eth, s_payout_tron, s_sale_fee, s_ui_queue, s_user_cancelled, sale_fee_text(), settings_get_chain(), settings_get_wifi(), settings_has_payout(), settings_inflight_clear(), settings_inflight_load(), SETTINGS_PAYOUT_MAX, settings_set_wifi(), settle_inflight(), TAG, token_decimals_ok(), pos_hw_t::transport, UI_EVENT_AMOUNT_CONFIRMED, UI_EVENT_CARD_PIN, UI_EVENT_CONFIRM_CANCEL, UI_EVENT_OTA_STAGED, UI_EVENT_PIN_ENTERED, UI_EVENT_PROV_AUTH, UI_EVENT_PROV_CARD, UI_EVENT_PROV_SCAN, UI_EVENT_PROV_STOP, UI_EVENT_PROV_VALUE, UI_EVENT_PROV_VALUE_NO, UI_EVENT_PROV_VALUE_SET, UI_EVENT_TX_RECHECK, UI_EVENT_TX_RETRY, UI_EVENT_WIFI_SCAN, UI_EVENT_WIFI_TRY, ui_refresh_addresses(), ui_set_boot_status(), ui_show_amount_entry(), ui_show_card_pin(), ui_show_confirm(), ui_show_ota_confirm(), ui_show_prov_auth(), ui_show_prov_confirm(), ui_show_tx_status(), ui_show_wifi_connecting(), ui_show_wifi_list(), ui_take_pin(), ui_take_wifi_creds(), UI_TX_STATE_FAILED, wall_ms(), pos_hw_t::wallet, and wdt_feed().

◆ ui_event_dispatch()

void ui_event_dispatch ( ui_event_t event,
uint64_t payload )

UI-task callback: forward a touch event to the main task queue.

Runs in the UI task context. A Cancel tap also raises the atomic s_user_cancelled flag so the in-flight signing flow can abort without waiting for the queue to drain.

Parameters
[in]eventUI event identifier.
[in]payloadEvent payload (amount in USDC base units, or 0).

Definition at line 39 of file main.cpp.

References s_ui_queue, s_user_cancelled, and UI_EVENT_CONFIRM_CANCEL.

Referenced by pos_boot(), and run_wizard().

Variable Documentation

◆ s_ui_queue

QueueHandle_t s_ui_queue = NULL

◆ s_user_cancelled

std::atomic<bool> s_user_cancelled {false}