ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
mpr121_binary_sensor.cpp
Go to the documentation of this file.
2
3namespace esphome::mpr121 {
4
6 uint8_t touch_threshold = this->touch_threshold_.value_or(this->parent_->get_touch_threshold());
7 this->parent_->write_byte(MPR121_TOUCHTH_0 + 2 * this->channel_, touch_threshold);
8
9 uint8_t release_threshold = this->release_threshold_.value_or(this->parent_->get_release_threshold());
10 this->parent_->write_byte(MPR121_RELEASETH_0 + 2 * this->channel_, release_threshold);
11}
12
13void MPR121BinarySensor::process(uint16_t data) {
14 bool new_state = data & (1 << this->channel_);
15 this->publish_state(new_state);
16}
17
18} // namespace esphome::mpr121
void publish_state(bool new_state)
Publish a new state to the front-end.
@ MPR121_RELEASETH_0
Definition mpr121.h:31