5 namespace matrix_keypad {
7 static const char *
const TAG =
"matrix_keypad";
10 for (
auto *pin : this->
rows_) {
27 static uint32_t active_start = 0;
28 static int active_key = -1;
32 int pos = 0, row, col;
33 for (
auto *row : this->
rows_) {
54 if (key != active_key) {
55 if ((active_key != -1) && (this->
pressed_key_ == active_key)) {
58 ESP_LOGD(TAG,
"key @ row %d, col %d released", row, col);
60 listener->button_released(row, col);
61 if (!this->
keys_.empty()) {
63 ESP_LOGD(TAG,
"key '%c' released", keycode);
64 for (
auto &listener : this->listeners_)
65 listener->key_released(keycode);
81 ESP_LOGD(TAG,
"key @ row %d, col %d pressed", row, col);
83 listener->button_pressed(row, col);
84 if (!this->
keys_.empty()) {
85 uint8_t keycode = this->
keys_[key];
86 ESP_LOGD(TAG,
"key '%c' pressed", keycode);
87 for (
auto &listener : this->listeners_)
88 listener->key_pressed(keycode);
95 ESP_LOGCONFIG(TAG,
"Matrix Keypad:");
96 ESP_LOGCONFIG(TAG,
" Rows:");
97 for (
auto &pin : this->
rows_) {
98 LOG_PIN(
" Pin: ", pin);
100 ESP_LOGCONFIG(TAG,
" Cols:");
102 LOG_PIN(
" Pin: ", pin);
void send_key_(uint8_t key)
uint32_t IRAM_ATTR HOT millis()
void dump_config() override
std::vector< GPIOPin * > columns_
std::vector< MatrixKeypadListener * > listeners_
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
void register_listener(MatrixKeypadListener *listener)
std::vector< GPIOPin * > rows_