ESPHome  2024.12.2
duty_cycle_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace duty_cycle {
9 
12  volatile uint32_t last_interrupt{0};
13  volatile uint32_t on_time{0};
14  volatile bool last_level{false};
16 
17  static void gpio_intr(DutyCycleSensorStore *arg);
18 };
19 
21  public:
22  void set_pin(InternalGPIOPin *pin) { pin_ = pin; }
23 
24  void setup() override;
25  float get_setup_priority() const override;
26  void dump_config() override;
27  void update() override;
28 
29  protected:
31 
33  uint32_t last_update_{0};
34 };
35 
36 } // namespace duty_cycle
37 } // namespace esphome
void setup()
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition: gpio.h:66
Store data in a class that doesn't use multiple-inheritance (vtables in flash)
This class simplifies creating components that periodically check a state.
Definition: component.h:283
static void gpio_intr(DutyCycleSensorStore *arg)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
void set_pin(InternalGPIOPin *pin)