Skip to content

Commit 22b6cea

Browse files
author
gdisirio
committed
Fixed bug #487.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6880 35acf78f-673a-0410-8e92-d51de3d6d3f4
1 parent d868819 commit 22b6cea

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

os/hal/include/pwm.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
118118
* @api
119119
*/
120120
#define PWM_FRACTION_TO_WIDTH(pwmp, denominator, numerator) \
121-
((uint16_t)((((uint32_t)(pwmp)->period) * \
122-
(uint32_t)(numerator)) / (uint32_t)(denominator)))
121+
((pwmcnt_t)((((pwmcnt_t)(pwmp)->period) * \
122+
(pwmcnt_t)(numerator)) / (pwmcnt_t)(denominator)))
123123

124124
/**
125125
* @brief Converts from degrees to pulse width.

readme.txt

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
*****************************************************************************
9090

9191
*** 2.7.0 ***
92+
- FIX: Fixed invalid cast in PWM_FRACTION_TO_WIDTH() macro (bug #487)
93+
(backported to 2.4.6 and 2.6.4).
9294
- FIX: Fixed wrong STM32 TIM9 clock source in PWM and ICU drivers (bug #486)
9395
(backported to 2.6.4).
9496
- FIX: Fixed MMC_SPI driver block_addresses is not initialized after

0 commit comments

Comments
 (0)