stm32: fix static clock output for faster chips
Some checks are pending
Build test / build (push) Waiting to run

If pcycle_time is scaled, the value should be scaled as well

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
Timofey Titovets 2025-12-31 12:39:02 +01:00 committed by KevinOConnor
parent ae3eb30f28
commit 05ce956456

View file

@ -323,9 +323,11 @@ gpio_timer_setup(uint8_t pin, uint32_t cycle_time, uint32_t val,
// CLK output
if (is_clock_out) {
prescaler = 1;
val = val / pclock_div;
while (pcycle_time > UINT16_MAX) {
prescaler = prescaler * 2;
pcycle_time /= 2;
val /= 2;
}
max_pwm = pcycle_time;
}