Files
MeshCore-Solo/variants/simpson/SimpsonKeypad.h
T
JakubandClaude Opus 5.5 a67b0fa025 fix(simpson): PR #53 follow-up - LF endings, no MESHCORE_VERSION, a long Enter wakes the screen first
The keypad files came back with CRLF endings; MESHCORE_VERSION is the
MeshCore base on the splash (1.18.0), not the Solo version, which comes
from the tag; ENV_INCLUDE_GPS is already set by the ProMicro base. A long
Enter with the screen off acted on the dark screen: it now only wakes it,
like every other key, and restarts the screen-off timer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 22:33:33 +02:00

53 lines
1.1 KiB
C++

#pragma once
#include <Arduino.h>
#include <I2CKeyPad.h>
#ifndef SIMPSON_KEYPAD_ADDR
#define SIMPSON_KEYPAD_ADDR 0x20
#endif
enum SimpsonKeypadMode : uint8_t {
SIMPSON_KEYPAD_CONTROL,
SIMPSON_KEYPAD_ABC,
SIMPSON_KEYPAD_ABC_UPPER,
SIMPSON_KEYPAD_NUMERIC
};
enum SimpsonKeypadKey : uint8_t {
SIMPSON_KEY_NONE = 0,
SIMPSON_KEY_CANCEL = 1,
SIMPSON_KEY_UP,
SIMPSON_KEY_BLUETOOTH,
SIMPSON_KEY_LEFT,
SIMPSON_KEY_ENTER,
SIMPSON_KEY_RIGHT,
SIMPSON_KEY_BRIGHTNESS_UP,
SIMPSON_KEY_SYMBOLS,
SIMPSON_KEY_DOWN,
SIMPSON_KEY_BRIGHTNESS_DOWN,
SIMPSON_KEY_MESSAGES,
SIMPSON_KEY_FN,
SIMPSON_KEY_GPS,
SIMPSON_KEY_BACKSPACE,
SIMPSON_KEY_MODE_CHANGED,
SIMPSON_KEY_ENTER_LONG
};
class SimpsonKeypad {
I2CKeyPad _keypad;
SimpsonKeypadMode _mode = SIMPSON_KEYPAD_CONTROL;
uint8_t _last_key = SIMPSON_KEY_NONE;
uint32_t _enter_pressed_at = 0;
bool _enter_long_sent = false;
bool _ready = false;
void loadModeMap();
public:
SimpsonKeypad() : _keypad(SIMPSON_KEYPAD_ADDR, &Wire) {}
bool begin();
uint8_t poll();
SimpsonKeypadMode mode() const { return _mode; }
};