ESPHome 2026.3.0-dev
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 void dump_config() override;
26 void update() override;
27
28 protected:
30
32 uint32_t last_update_{0};
33};
34
35} // namespace duty_cycle
36} // namespace esphome
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Definition gpio.h:92
This class simplifies creating components that periodically check a state.
Definition component.h:527
void set_pin(InternalGPIOPin *pin)
Base-class for all sensors.
Definition sensor.h:47
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)