ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
mt6701_spi_binary_sensors.cpp
Go to the documentation of this file.
3#include "esphome/core/log.h"
4
6
7ESPHOME_LOG_TAG(TAG, "mt6701_spi.binary_sensor");
8
9void MT6701SPIBinarySensors::loop() {
12 return;
13 this->last_read_ = now;
14 if (!this->parent_->read_encoder())
15 return;
16 const uint8_t status = this->parent_->get_status();
17 if (this->push_button_binary_sensor_ != nullptr)
18 this->push_button_binary_sensor_->publish_state((status & 0x04) != 0);
19 if (this->track_loss_binary_sensor_ != nullptr)
20 this->track_loss_binary_sensor_->publish_state((status & 0x08) != 0);
21}
22
23void MT6701SPIBinarySensors::dump_config() {
24 ESP_LOGCONFIG(TAG, "MT6701 status:\n Update Interval: %" PRIu32 " ms", this->update_interval_);
25 LOG_BINARY_SENSOR(" ", "Push button", this->push_button_binary_sensor_);
26 LOG_BINARY_SENSOR(" ", "Track loss", this->track_loss_binary_sensor_);
27}
28
29} // namespace esphome::mt6701_spi
uint8_t status
Definition bl0942.h:8
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.
ESPHOME_LOG_TAG(TAG, "mt6701_spi.binary_sensor")
Application App
Global storage of Application pointer - only one Application can exist.
static void uint32_t