ESPHome
2025.5.0
Loading...
Searching...
No Matches
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
binary_sensor.h
esphome::binary_sensor::BinarySensor
Base class for all binary_sensor-type classes.
Definition
binary_sensor.h:37
esphome::binary_sensor::BinarySensor::publish_state
void publish_state(bool state)
Publish a new state to the front-end.
Definition
binary_sensor.cpp:14
esphome::sx1509::SX1509BinarySensor
Definition
sx1509_binary_keypad_sensor.h:9
esphome::sx1509::SX1509BinarySensor::process
void process(uint16_t data) override
Definition
sx1509_binary_keypad_sensor.h:12
esphome::sx1509::SX1509BinarySensor::set_row_col
void set_row_col(uint8_t row, uint8_t col)
Definition
sx1509_binary_keypad_sensor.h:11
esphome::sx1509::SX1509BinarySensor::key_
uint16_t key_
Definition
sx1509_binary_keypad_sensor.h:15
esphome::sx1509::SX1509Processor
Definition
sx1509.h:25
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
sx1509.h
Generated by
1.12.0