mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-28 20:52:02 +00:00
InkHUD support for LilyGo T3S3 E-Paper (#6503)
* Purge an incomplete E-Ink driver * Use the deep-sleep mode of SSD16XX E-Ink displays * TwoButton doesn't need to store pin mode * Fix false positive button presses after light sleep * E-Ink driver for DEPG0213BNS800 * InkHUD support for LilyGo T3S3 E-paper --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -98,9 +98,8 @@ void TwoButton::setWiring(uint8_t whichButton, uint8_t pin, bool internalPullup)
|
||||
assert(whichButton < 2);
|
||||
buttons[whichButton].pin = pin;
|
||||
buttons[whichButton].activeLogic = LOW; // Unimplemented
|
||||
buttons[whichButton].mode = internalPullup ? INPUT_PULLUP : INPUT;
|
||||
|
||||
pinMode(buttons[whichButton].pin, buttons[whichButton].mode);
|
||||
pinMode(buttons[whichButton].pin, internalPullup ? INPUT_PULLUP : INPUT);
|
||||
}
|
||||
|
||||
void TwoButton::setTiming(uint8_t whichButton, uint32_t debounceMs, uint32_t longpressMs)
|
||||
@@ -299,7 +298,9 @@ int TwoButton::afterLightSleep(esp_sleep_wakeup_cause_t cause)
|
||||
// Manually trigger the button-down ISR
|
||||
// - during light sleep, our ISR is disabled
|
||||
// - if light sleep ends by button press, pretend our own ISR caught it
|
||||
if (cause == ESP_SLEEP_WAKEUP_GPIO)
|
||||
// - need to manually confirm by reading pin ourselves, to avoid occasional false positives
|
||||
// (false positive only when using internal pullup resistors?)
|
||||
if (cause == ESP_SLEEP_WAKEUP_GPIO && digitalRead(buttons[0].pin) == buttons[0].activeLogic)
|
||||
isrPrimary();
|
||||
|
||||
return 0; // Indicates success
|
||||
|
||||
@@ -35,7 +35,7 @@ class TwoButton : protected concurrency::OSThread
|
||||
static TwoButton *getInstance(); // Create or get the singleton instance
|
||||
void start(); // Start handling button input
|
||||
void stop(); // Stop handling button input (disconnect ISRs for sleep)
|
||||
void setWiring(uint8_t whichButton, uint8_t pin, bool internalPulldown = false);
|
||||
void setWiring(uint8_t whichButton, uint8_t pin, bool internalPullup = false);
|
||||
void setTiming(uint8_t whichButton, uint32_t debounceMs, uint32_t longpressMs);
|
||||
void setHandlerDown(uint8_t whichButton, Callback onDown);
|
||||
void setHandlerUp(uint8_t whichButton, Callback onUp);
|
||||
@@ -65,7 +65,6 @@ class TwoButton : protected concurrency::OSThread
|
||||
// Per-button config
|
||||
uint8_t pin = 0xFF; // 0xFF: unset
|
||||
bool activeLogic = LOW; // Active LOW by default. Currently unimplemented.
|
||||
uint8_t mode = INPUT; // Whether to use internal pull up / pull down resistors
|
||||
uint32_t debounceLength = 50; // Minimum length for shortpress, in ms
|
||||
uint32_t longpressLength = 500; // How long after button down to fire longpress, in ms
|
||||
volatile State state = State::REST; // Internal state
|
||||
|
||||
Reference in New Issue
Block a user