From d8e0b25c9d0422ee7e960ea07e3f4b03b3ce6aa9 Mon Sep 17 00:00:00 2001 From: "steve.jeong" Date: Wed, 19 Oct 2022 09:27:28 +0900 Subject: [PATCH] debian: update package version 3.13.8 ODROID-M1: troubleshooting 2x pwm freq. Signed-off-by: steve.jeong Change-Id: Idd13e496ef864986bd8c9c79a6ea6ae680b7e9ba --- debian/changelog | 6 ++++++ wiringPi/odroidm1.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 70d613d..04a4739 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +odroid-wiringpi (3.13.8) stable; urgency=medium + + * ODROID-M1: pwmSetClock: Troubleshooting (2x) frequencies + + -- steve Wed, 19 Oct 2022 09:25:29 +0900 + odroid-wiringpi (3.13.7) stable; urgency=medium * ODROID-M1: support PWM OUTPUT. (PWM1. PWM2) diff --git a/wiringPi/odroidm1.c b/wiringPi/odroidm1.c index bd27b7c..d9a8d35 100644 --- a/wiringPi/odroidm1.c +++ b/wiringPi/odroidm1.c @@ -1346,8 +1346,14 @@ static void _pwmSetClock (int divisor) { uint8_t scale; uint32_t pwmScale, target; - scale = (uint8_t)(divisor & 0xFF); + if ((divisor % 2 != 0)) { + printf("clk divisor must be set to an even number.\n"); + return; + } + + divisor = divisor / 2; + scale = (uint8_t)(divisor & 0xFF); pwmScale = (scale << 16); target = pwmScale; // if scale == 0, It changes to the maximum value(256).