🐛 Fix TFT backlight [STM32] (#23062)

This commit is contained in:
Tanguy Pruvot
2021-11-04 18:04:04 +01:00
committed by Scott Lahteine
parent 89ec1c71f0
commit fd136d5501
6 changed files with 22 additions and 8 deletions

View File

@@ -28,6 +28,7 @@
#include "timers.h"
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
if (!PWM_PIN(pin)) return;
timer_dev *timer = PIN_MAP[pin].timer_device;
uint16_t max_val = timer->regs.bas->ARR * v / v_size;
if (invert) max_val = v_size - max_val;