6namespace matrix_keypad {
8static const char *
const TAG =
"matrix_keypad";
11 for (
auto *pin : this->
rows_) {
33 int pos = 0, row, col;
34 for (
auto *row : this->
rows_) {
59 ESP_LOGD(TAG,
"key @ row %d, col %d released", row, col);
61 listener->button_released(row, col);
64 ESP_LOGD(TAG,
"key '%c' released", keycode);
65 for (
auto &listener : this->listeners_)
66 listener->key_released(keycode);
82 ESP_LOGD(TAG,
"key @ row %d, col %d pressed", row, col);
84 listener->button_pressed(row, col);
85 if (key < (
int) this->
keys_.size()) {
86 uint8_t keycode = this->
keys_[key];
87 ESP_LOGD(TAG,
"key '%c' pressed", keycode);
89 trigger->trigger(keycode);
90 for (
auto &listener : this->listeners_)
91 listener->key_pressed(keycode);
98 ESP_LOGCONFIG(TAG,
"Matrix Keypad:\n"
100 for (
auto &pin : this->
rows_) {
101 LOG_PIN(
" Pin: ", pin);
103 ESP_LOGCONFIG(TAG,
" Cols:");
105 LOG_PIN(
" Pin: ", pin);
uint32_t IRAM_ATTR HOT get_loop_component_start_time() const
Get the cached time in milliseconds from when the current component started its loop execution.
void send_key_(uint8_t key)
std::vector< MatrixKeypadListener * > listeners_
void register_key_trigger(MatrixKeyTrigger *trig)
std::vector< GPIOPin * > columns_
std::vector< MatrixKeyTrigger * > key_triggers_
void dump_config() override
std::vector< GPIOPin * > rows_
void register_listener(MatrixKeypadListener *listener)
Providing packet encoding functions for exchanging data with a remote host.
Application App
Global storage of Application pointer - only one Application can exist.