ESPHome
2024.12.2
esphome
esphome
components
sx1509
binary_sensor
sx1509_binary_keypad_sensor.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/components/sx1509/sx1509.h
"
4
#include "
esphome/components/binary_sensor/binary_sensor.h
"
5
6
namespace
esphome
{
7
namespace
sx1509 {
8
9
class
SX1509BinarySensor
:
public
sx1509::SX1509Processor
,
public
binary_sensor::BinarySensor
{
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
esphome::sx1509::SX1509BinarySensor::process
void process(uint16_t data) override
Definition:
sx1509_binary_keypad_sensor.h:12
esphome::sx1509::SX1509Processor
Definition:
sx1509.h:25
esphome::sx1509::SX1509BinarySensor
Definition:
sx1509_binary_keypad_sensor.h:9
binary_sensor.h
esphome::binary_sensor::BinarySensor::publish_state
void publish_state(bool state)
Publish a new state to the front-end.
Definition:
binary_sensor.cpp:14
sx1509.h
esphome::sx1509::SX1509BinarySensor::key_
uint16_t key_
Definition:
sx1509_binary_keypad_sensor.h:15
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::binary_sensor::BinarySensor
Base class for all binary_sensor-type classes.
Definition:
binary_sensor.h:37
esphome::sx1509::SX1509BinarySensor::set_row_col
void set_row_col(uint8_t row, uint8_t col)
Definition:
sx1509_binary_keypad_sensor.h:11
Generated by
1.8.13