This commit is contained in:
WillyJL 2025-09-19 23:43:54 +02:00
parent 15a22ee50d
commit 2c6414827e
No known key found for this signature in database
7 changed files with 13 additions and 14 deletions

View File

@ -32,8 +32,7 @@
#define _TCA8418_REG_LCK_EC_KLEC_0 0x01 // Key event count bit 0
TCA8418KeyboardBase::TCA8418KeyboardBase(uint8_t rows, uint8_t columns)
: rows(rows), columns(columns), queue(""), m_wire(nullptr), m_addr(0), readCallback(nullptr),
writeCallback(nullptr)
: rows(rows), columns(columns), queue(""), m_wire(nullptr), m_addr(0), readCallback(nullptr), writeCallback(nullptr)
{
}
@ -46,9 +45,7 @@ void TCA8418KeyboardBase::begin(uint8_t addr, TwoWire *wire)
#ifdef KB_INT
interruptInstance = this;
auto interruptHandler = []() {
interruptInstance->notifyObservers(interruptInstance);
};
auto interruptHandler = []() { interruptInstance->notifyObservers(interruptInstance); };
::pinMode(KB_INT, INPUT_PULLUP);
attachInterrupt(KB_INT, interruptHandler, FALLING);
@ -309,7 +306,7 @@ void TCA8418KeyboardBase::disableInterrupts()
writeRegister(TCA8418_REG_CFG, value);
};
TCA8418KeyboardBase* TCA8418KeyboardBase::interruptInstance;
TCA8418KeyboardBase *TCA8418KeyboardBase::interruptInstance;
void TCA8418KeyboardBase::enableMatrixOverflow()
{

View File

@ -1,7 +1,7 @@
// Based on the MPR121 Keyboard and Adafruit TCA8418 library
#include "configuration.h"
#include <Wire.h>
#include "kbInterrupt.h"
#include <Wire.h>
/**
* @brief TCA8418KeyboardBase is the base class for TCA8418 keyboard handling.
@ -143,7 +143,7 @@ class TCA8418KeyboardBase : public KbInterruptObservable
// enable / disable interrupts for matrix and GPI pins
void enableInterrupts();
void disableInterrupts();
static TCA8418KeyboardBase* interruptInstance;
static TCA8418KeyboardBase *interruptInstance;
// ignore key events when FIFO buffer is full or not.
void enableMatrixOverflow();

View File

@ -62,7 +62,8 @@ static const uint8_t TDeckProTapMap[_TCA8418_NUM_KEYS][5] = {
static bool TDeckProHeldMap[_TCA8418_NUM_KEYS] = {};
TDeckProKeyboard::TDeckProKeyboard()
: TCA8418KeyboardBase(_TCA8418_ROWS, _TCA8418_COLS), modifierFlag(0), pressedKeysCount(0), onlyOneModifierPressed(false), persistedPreviousModifier(false)
: TCA8418KeyboardBase(_TCA8418_ROWS, _TCA8418_COLS), modifierFlag(0), pressedKeysCount(0), onlyOneModifierPressed(false),
persistedPreviousModifier(false)
{
}

View File

@ -67,7 +67,8 @@ static const uint8_t TLoraPagerTapMap[_TCA8418_NUM_KEYS][3] = {
static bool TLoraPagerHeldMap[_TCA8418_NUM_KEYS] = {};
TLoraPagerKeyboard::TLoraPagerKeyboard()
: TCA8418KeyboardBase(_TCA8418_ROWS, _TCA8418_COLS), modifierFlag(0), pressedKeysCount(0), onlyOneModifierPressed(false), persistedPreviousModifier(false)
: TCA8418KeyboardBase(_TCA8418_ROWS, _TCA8418_COLS), modifierFlag(0), pressedKeysCount(0), onlyOneModifierPressed(false),
persistedPreviousModifier(false)
{
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
ledcAttach(KB_BL_PIN, LEDC_BACKLIGHT_FREQ, LEDC_BACKLIGHT_BIT_WIDTH);

View File

@ -2,10 +2,10 @@
#include "Observer.h"
class KbInterruptObservable : public Observable<KbInterruptObservable*>
class KbInterruptObservable : public Observable<KbInterruptObservable *>
{
};
class KbInterruptObserver : public Observer<KbInterruptObservable*>
class KbInterruptObserver : public Observer<KbInterruptObservable *>
{
};