ESPHome  2024.12.2
sx1509_binary_keypad_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace esphome {
7 namespace sx1509 {
8 
10  public:
11  void set_row_col(uint8_t row, uint8_t col) { this->key_ = (1 << (col + 8)) | (1 << row); }
12  void process(uint16_t data) override { this->publish_state(static_cast<bool>(data == key_)); }
13 
14  protected:
15  uint16_t key_{0};
16 };
17 
18 } // namespace sx1509
19 } // namespace esphome
void publish_state(bool state)
Publish a new state to the front-end.
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:37
void set_row_col(uint8_t row, uint8_t col)