ESPHome 2025.5.0
Loading...
Searching...
No Matches
duty_cycle_sensor.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/hal.h"
6
7namespace esphome {
8namespace 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
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition gpio.h:73
This class simplifies creating components that periodically check a state.
Definition component.h:301
void set_pin(InternalGPIOPin *pin)
Base-class for all sensors.
Definition sensor.h:57
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
Store data in a class that doesn't use multiple-inheritance (vtables in flash)
static void gpio_intr(DutyCycleSensorStore *arg)