aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/include/pwm.h4
-rw-r--r--readme.txt2
2 files changed, 4 insertions, 2 deletions
diff --git a/os/hal/include/pwm.h b/os/hal/include/pwm.h
index e943df382..cdd1f43ca 100644
--- a/os/hal/include/pwm.h
+++ b/os/hal/include/pwm.h
@@ -118,8 +118,8 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
* @api
*/
#define PWM_FRACTION_TO_WIDTH(pwmp, denominator, numerator) \
- ((uint16_t)((((uint32_t)(pwmp)->period) * \
- (uint32_t)(numerator)) / (uint32_t)(denominator)))
+ ((pwmcnt_t)((((pwmcnt_t)(pwmp)->period) * \
+ (pwmcnt_t)(numerator)) / (pwmcnt_t)(denominator)))
/**
* @brief Converts from degrees to pulse width.
diff --git a/readme.txt b/readme.txt
index e7afb49cb..8901f4aa7 100644
--- a/readme.txt
+++ b/readme.txt
@@ -89,6 +89,8 @@
*****************************************************************************
*** 2.7.0 ***
+- FIX: Fixed invalid cast in PWM_FRACTION_TO_WIDTH() macro (bug #487)
+ (backported to 2.4.6 and 2.6.4).
- FIX: Fixed wrong STM32 TIM9 clock source in PWM and ICU drivers (bug #486)
(backported to 2.6.4).
- FIX: Fixed MMC_SPI driver block_addresses is not initialized after