Browse Source

🐛 [LCP1768] Init PWM in set_pwm_duty (#23110)

vanilla_fb_2.0.x
Mike La Spina 3 years ago
committed by Scott Lahteine
parent
commit
b662dd1f92
  1. 4
      Marlin/src/HAL/LPC1768/fast_pwm.cpp

4
Marlin/src/HAL/LPC1768/fast_pwm.cpp

@ -25,7 +25,9 @@
#include <pwm.h>
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size);
if (!LPC176x::pin_is_valid(pin)) return;
if (LPC176x::pwm_attach_pin(pin))
LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size); // map 1-254 onto PWM range
}
#if NEEDS_HARDWARE_PWM // Specific meta-flag for features that mandate PWM

Loading…
Cancel
Save