15 int channel_resolution)
17 pwm_channel_{static_cast<uint8_t>(pwm_channel)},
18 channel_frequency_{channel_frequency},
19 channel_resolution_{channel_resolution},
20 pwmrange_{static_cast<int>(pow(2, channel_resolution) - 1)} {
29 if (pwm_channel == -1) {
31 std::map<uint8_t, int8_t>::iterator it;
41 ESP_LOGD(__FILENAME__,
"PWM channel %d assigned to pin %d", pwm_channel, pin);
45 ledcAttachPin(pin, pwm_channel);
51 std::map<uint8_t, int8_t>::iterator it;
56 ESP_LOGD(__FILENAME__,
"Outputting %d to pwm channel %d (pin %d)",
60 ESP_LOGW(__FILENAME__,
"No pin assigned to channel %d. Ignoring set_pwm()",
void set_pwm(float value)
PWMOutput(int pin=-1, int pwm_channel=-1, int channel_frequency=5000, int channel_resolution=13)
static std::map< uint8_t, int8_t > channel_to_pin_
int assign_channel(int pin, int pwm_channel=-1)
virtual void set(const float &new_value) override
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...