mirror of
https://github.com/esphome/esphome.git
synced 2025-09-18 03:02:20 +01:00
Auto-set LEDC channel
Fixes https://github.com/esphome/issues/issues/258
This commit is contained in:
@@ -9,9 +9,13 @@
|
||||
namespace esphome {
|
||||
namespace ledc {
|
||||
|
||||
extern uint8_t next_ledc_channel;
|
||||
|
||||
class LEDCOutput : public output::FloatOutput, public Component {
|
||||
public:
|
||||
explicit LEDCOutput(GPIOPin *pin) : pin_(pin) {}
|
||||
explicit LEDCOutput(GPIOPin *pin) : pin_(pin) {
|
||||
this->channel_ = next_ledc_channel++;
|
||||
}
|
||||
|
||||
void set_channel(uint8_t channel) { this->channel_ = channel; }
|
||||
void set_bit_depth(uint8_t bit_depth) { this->bit_depth_ = bit_depth; }
|
||||
@@ -35,8 +39,6 @@ class LEDCOutput : public output::FloatOutput, public Component {
|
||||
float frequency_{};
|
||||
};
|
||||
|
||||
extern uint8_t next_ledc_channel;
|
||||
|
||||
} // namespace ledc
|
||||
} // namespace esphome
|
||||
|
||||
|
Reference in New Issue
Block a user