ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
libretiny_pwm.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/hal.h"
6
7#ifdef USE_LIBRETINY
8
10
11class LibreTinyPWM final : public output::FloatOutput, public Component {
12 public:
13 explicit LibreTinyPWM(InternalGPIOPin *pin) : pin_(pin) {}
14
17 void update_frequency(float frequency) override;
18
20 void setup() override;
21 void dump_config() override;
23 float get_setup_priority() const override { return setup_priority::HARDWARE; }
24
26 void write_state(float state) override;
27
28 protected:
30 uint8_t bit_depth_{10};
31 float frequency_{};
32 float duty_{0.0f};
33 bool initialized_ = false;
34};
35
36} // namespace esphome::libretiny_pwm
37
38#endif
uint16_le_t frequency
Definition bl0942.h:6
float get_setup_priority() const override
HARDWARE setup priority.
void update_frequency(float frequency) override
Dynamically change frequency at runtime.
void set_frequency(float frequency)
void write_state(float state) override
Override FloatOutput's write_state.
void setup() override
Setup LibreTinyPWM.
Base class for all output components that can output a variable level, like PWM.
bool state
Definition fan.h:2
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.h:43