18 const uint8_t positive_pin_ledc_channel,
19 const uint8_t negative_pin,
20 const uint8_t negative_pin_ledc_channel)
21 : positive_pin_(positive_pin),
22 negative_pin_(negative_pin),
23 positive_pin_ledc_channel_(positive_pin_ledc_channel),
24 negative_pin_ledc_channel_(negative_pin_ledc_channel) {
28#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
29 if (positive_pin_ledc_channel_ != 0xFF) {
35 if (negative_pin_ledc_channel_ != 0xFF) {
43 ledcAttachPin(positive_pin_, positive_pin_ledc_channel_);
44 ledcAttachPin(negative_pin_, negative_pin_ledc_channel_);
52#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
53 ledcWrite(positive_pin_, pwm_duty_);
54 ledcWrite(negative_pin_, 0);
56 ledcWrite(positive_pin_ledc_channel_, pwm_duty_);
57 ledcWrite(negative_pin_ledc_channel_, 0);
60#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
61 ledcWrite(positive_pin_, 0);
62 ledcWrite(negative_pin_, -pwm_duty_);
64 ledcWrite(positive_pin_ledc_channel_, 0);
65 ledcWrite(negative_pin_ledc_channel_, -pwm_duty_);
static constexpr uint8_t kPwmFrequency
The frequency of PWM, in Hertz. Here it is set to 75000 Hz, used to control the frequency of the PWM ...