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

Panel and touch hardware: TFT_eSPI flush, XPT2046 reads, the LVGL display and input drivers, backlight PWM. More...

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

Go to the source code of this file.

Macros

#define SWIPE_BAND_H   44 /* press must START in this bottom band */
#define SWIPE_MIN_DY   58 /* ...and travel at least this far up */
#define BL_GPIO   21
#define BL_LEDC_MODE   LEDC_LOW_SPEED_MODE
#define BL_LEDC_TIMER   LEDC_TIMER_0
#define BL_LEDC_CH   LEDC_CHANNEL_0
#define BL_LEDC_RES   LEDC_TIMER_10_BIT /* duty 0..1023 */
#define BL_PWM_HZ   5000 /* above the audible range */

Functions

SPIClass touchSPI (VSPI)
XPT2046_Touchscreen touch (T_CS, T_IRQ)
void disp_flush (lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *px)
void touch_cal_load (void)
bool touch_raw (int16_t *rx, int16_t *ry)
static bool touch_to_screen (int16_t *sx, int16_t *sy, int16_t *sz)
void indev_read (lv_indev_drv_t *drv, lv_indev_data_t *data)
void tick_cb (void *arg)
void backlight_set_pct (uint8_t pct)
void backlight_init (uint8_t pct)

Variables

TFT_eSPI tft
lv_color_t s_buf [SCR_W *40]
lv_disp_draw_buf_t s_draw_buf
lv_disp_drv_t s_disp_drv
lv_indev_drv_t s_indev_drv
uint16_t s_cal_xmin = 200U
uint16_t s_cal_xmax = 3800U
uint16_t s_cal_ymin = 200U
uint16_t s_cal_ymax = 3800U
uint32_t s_input_block_until = 0
bool s_wait_release = false
lv_obj_t * s_page_card = NULL
static touch_jump_t s_jump = { 0, 0, 0, false }
static bool s_jump_logged = false
static bool s_swipe_armed = false
static int16_t s_swipe_y0 = 0
volatile bool s_swipe_admin = false
uint8_t s_brightness = 80

Detailed Description

Panel and touch hardware: TFT_eSPI flush, XPT2046 reads, the LVGL display and input drivers, backlight PWM.

Definition in file ui_hal.cpp.

Macro Definition Documentation

◆ BL_GPIO

#define BL_GPIO   21

Definition at line 173 of file ui_hal.cpp.

Referenced by backlight_init().

◆ BL_LEDC_CH

#define BL_LEDC_CH   LEDC_CHANNEL_0

Definition at line 176 of file ui_hal.cpp.

Referenced by backlight_init(), and backlight_set_pct().

◆ BL_LEDC_MODE

#define BL_LEDC_MODE   LEDC_LOW_SPEED_MODE

Definition at line 174 of file ui_hal.cpp.

Referenced by backlight_init(), and backlight_set_pct().

◆ BL_LEDC_RES

#define BL_LEDC_RES   LEDC_TIMER_10_BIT /* duty 0..1023 */

Definition at line 177 of file ui_hal.cpp.

Referenced by backlight_init().

◆ BL_LEDC_TIMER

#define BL_LEDC_TIMER   LEDC_TIMER_0

Definition at line 175 of file ui_hal.cpp.

Referenced by backlight_init().

◆ BL_PWM_HZ

#define BL_PWM_HZ   5000 /* above the audible range */

Definition at line 178 of file ui_hal.cpp.

Referenced by backlight_init().

◆ SWIPE_BAND_H

#define SWIPE_BAND_H   44 /* press must START in this bottom band */

Definition at line 99 of file ui_hal.cpp.

Referenced by indev_read().

◆ SWIPE_MIN_DY

#define SWIPE_MIN_DY   58 /* ...and travel at least this far up */

Definition at line 100 of file ui_hal.cpp.

Referenced by indev_read().

Function Documentation

◆ backlight_init()

void backlight_init ( uint8_t pct)

Definition at line 186 of file ui_hal.cpp.

References backlight_set_pct(), BL_GPIO, BL_LEDC_CH, BL_LEDC_MODE, BL_LEDC_RES, BL_LEDC_TIMER, and BL_PWM_HZ.

Referenced by ui_task().

◆ backlight_set_pct()

void backlight_set_pct ( uint8_t pct)

Definition at line 180 of file ui_hal.cpp.

References BL_LEDC_CH, and BL_LEDC_MODE.

Referenced by backlight_init(), and brightness_event_cb().

◆ disp_flush()

void disp_flush ( lv_disp_drv_t * drv,
const lv_area_t * area,
lv_color_t * px )

Definition at line 22 of file ui_hal.cpp.

References tft.

Referenced by ui_task().

◆ indev_read()

void indev_read ( lv_indev_drv_t * drv,
lv_indev_data_t * data )

◆ tick_cb()

void tick_cb ( void * arg)

Definition at line 165 of file ui_hal.cpp.

References LV_TICK_PERIOD_MS.

Referenced by ui_task().

◆ touch()

XPT2046_Touchscreen touch ( T_CS ,
T_IRQ  )

References T_CS, and T_IRQ.

◆ touch_cal_load()

void touch_cal_load ( void )

Definition at line 43 of file ui_hal.cpp.

References s_cal_xmax, s_cal_xmin, s_cal_ymax, s_cal_ymin, and settings_get_touch_cal().

Referenced by btn_event_cb(), and ui_task().

◆ touch_raw()

bool touch_raw ( int16_t * rx,
int16_t * ry )

Definition at line 49 of file ui_hal.cpp.

References touch.

Referenced by touch_cal_poll().

◆ touch_to_screen()

bool touch_to_screen ( int16_t * sx,
int16_t * sy,
int16_t * sz )
static

Definition at line 59 of file ui_hal.cpp.

References s_cal_xmax, s_cal_xmin, s_cal_ymax, s_cal_ymin, SCR_H, SCR_W, and touch.

Referenced by indev_read().

◆ touchSPI()

SPIClass touchSPI ( VSPI )

Variable Documentation

◆ s_brightness

uint8_t s_brightness = 80

Definition at line 179 of file ui_hal.cpp.

Referenced by brightness_event_cb(), build_settings(), settings_persist(), and ui_task().

◆ s_buf

lv_color_t s_buf[SCR_W *40]

Definition at line 18 of file ui_hal.cpp.

Referenced by ui_task().

◆ s_cal_xmax

uint16_t s_cal_xmax = 3800U

Definition at line 40 of file ui_hal.cpp.

Referenced by btn_event_cb(), cal_apply(), touch_cal_load(), touch_to_screen(), and ui_task().

◆ s_cal_xmin

uint16_t s_cal_xmin = 200U

Definition at line 39 of file ui_hal.cpp.

Referenced by btn_event_cb(), cal_apply(), touch_cal_load(), touch_to_screen(), and ui_task().

◆ s_cal_ymax

uint16_t s_cal_ymax = 3800U

Definition at line 42 of file ui_hal.cpp.

Referenced by btn_event_cb(), cal_apply(), touch_cal_load(), touch_to_screen(), and ui_task().

◆ s_cal_ymin

uint16_t s_cal_ymin = 200U

Definition at line 41 of file ui_hal.cpp.

Referenced by btn_event_cb(), cal_apply(), touch_cal_load(), touch_to_screen(), and ui_task().

◆ s_disp_drv

lv_disp_drv_t s_disp_drv

Definition at line 20 of file ui_hal.cpp.

Referenced by ui_task().

◆ s_draw_buf

lv_disp_draw_buf_t s_draw_buf

Definition at line 19 of file ui_hal.cpp.

Referenced by ui_task().

◆ s_indev_drv

lv_indev_drv_t s_indev_drv

Definition at line 21 of file ui_hal.cpp.

Referenced by ui_task().

◆ s_input_block_until

uint32_t s_input_block_until = 0

Definition at line 79 of file ui_hal.cpp.

Referenced by indev_read(), and render_requested_screen().

◆ s_jump

touch_jump_t s_jump = { 0, 0, 0, false }
static

Definition at line 89 of file ui_hal.cpp.

Referenced by indev_read().

◆ s_jump_logged

bool s_jump_logged = false
static

Definition at line 90 of file ui_hal.cpp.

Referenced by indev_read().

◆ s_page_card

lv_obj_t* s_page_card = NULL

Definition at line 84 of file ui_hal.cpp.

Referenced by build_page(), clear_screen(), and indev_read().

◆ s_swipe_admin

volatile bool s_swipe_admin = false

Definition at line 103 of file ui_hal.cpp.

Referenced by indev_read(), and ui_task().

◆ s_swipe_armed

bool s_swipe_armed = false
static

Definition at line 101 of file ui_hal.cpp.

Referenced by indev_read().

◆ s_swipe_y0

int16_t s_swipe_y0 = 0
static

Definition at line 102 of file ui_hal.cpp.

Referenced by indev_read().

◆ s_wait_release

bool s_wait_release = false

Definition at line 80 of file ui_hal.cpp.

Referenced by indev_read(), and render_requested_screen().

◆ tft

TFT_eSPI tft

Definition at line 14 of file ui_hal.cpp.

Referenced by disp_flush(), and ui_task().