diff options
| author | Your Name <you@example.com> | 2026-05-19 01:44:11 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 01:44:11 +0530 |
| commit | 58a0b5fd115d9687a1292e5e82e6b9fa8454b930 (patch) | |
| tree | dd9f18903d0237edcf5844c58fcb88bcf737b22c /main/keyboard.h | |
| parent | 699fc6c03899c3b1ff853d8c7c6cf32173436354 (diff) | |
Dynamic layout for WiFi setup: landscape rotation, responsive render, highlight feedback
- Render functions use axs15231b_get_width/height() instead of hardcoded coords
- render_wifi_setup_list: dynamic item widths, screen-relative cancel button
- render_wifi_setup_password: dynamic field/eye/keyboard from kb_get_layout()
- render_wifi_setup_result: centered on screen, dynamic button placement
- handle_wifi_setup_touch: matching dynamic hit areas, highlight_rect() feedback
- Rotation lifecycle: enter_wifi_setup_rotation/exit wired into all entry/exit paths
- display_enter_wifi_setup + READY/ERROR touch + SUCCESS auto-return + LIST cancel
- Added kb_result_t typedef to keyboard.h (was only in .c)
- Fixed test_keyboard.c: use computed offsets from kb_layout_t defaults
- All 101 unit tests pass (touch:19, keyboard:46, wifi_setup:36)
Diffstat (limited to 'main/keyboard.h')
| -rw-r--r-- | main/keyboard.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/main/keyboard.h b/main/keyboard.h index 495c499..9c4118f 100644 --- a/main/keyboard.h +++ b/main/keyboard.h | |||
| @@ -5,11 +5,6 @@ | |||
| 5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
| 6 | 6 | ||
| 7 | #define KB_INPUT_MAX 64 | 7 | #define KB_INPUT_MAX 64 |
| 8 | #define KB_KEY_W 28 | ||
| 9 | #define KB_KEY_H 36 | ||
| 10 | #define KB_KEY_GAP 2 | ||
| 11 | #define KB_ROW_COUNT 4 | ||
| 12 | #define KB_START_Y 70 | ||
| 13 | 8 | ||
| 14 | typedef enum { | 9 | typedef enum { |
| 15 | KB_ALPHA_LOWER, | 10 | KB_ALPHA_LOWER, |
| @@ -28,18 +23,29 @@ typedef enum { | |||
| 28 | } kb_action_t; | 23 | } kb_action_t; |
| 29 | 24 | ||
| 30 | typedef struct { | 25 | typedef struct { |
| 31 | kb_action_t action; | ||
| 32 | char ch; | ||
| 33 | } kb_result_t; | ||
| 34 | |||
| 35 | typedef struct { | ||
| 36 | char input[KB_INPUT_MAX + 1]; | 26 | char input[KB_INPUT_MAX + 1]; |
| 37 | int cursor; | 27 | int cursor; |
| 38 | bool reveal; | 28 | bool reveal; |
| 39 | kb_layer_t layer; | 29 | kb_layer_t layer; |
| 40 | } kb_state_t; | 30 | } kb_state_t; |
| 41 | 31 | ||
| 32 | typedef struct { | ||
| 33 | kb_action_t action; | ||
| 34 | char ch; | ||
| 35 | } kb_result_t; | ||
| 36 | |||
| 37 | typedef struct { | ||
| 38 | int key_w; | ||
| 39 | int key_h; | ||
| 40 | int key_gap; | ||
| 41 | int start_y; | ||
| 42 | int screen_w; | ||
| 43 | int row_count; | ||
| 44 | } kb_layout_t; | ||
| 45 | |||
| 42 | void kb_state_init(kb_state_t *st); | 46 | void kb_state_init(kb_state_t *st); |
| 47 | void kb_set_layout(const kb_layout_t *layout); | ||
| 48 | const kb_layout_t *kb_get_layout(void); | ||
| 43 | int kb_get_row_keys(int row, kb_layer_t layer, const char **keys_out); | 49 | int kb_get_row_keys(int row, kb_layer_t layer, const char **keys_out); |
| 44 | kb_result_t kb_hit_test(int tx, int ty, kb_layer_t layer); | 50 | kb_result_t kb_hit_test(int tx, int ty, kb_layer_t layer); |
| 45 | void kb_apply(kb_state_t *st, kb_result_t result); | 51 | void kb_apply(kb_state_t *st, kb_result_t result); |