diff --git a/os/kernel/include/chvt.h b/os/kernel/include/chvt.h index 63ff3c4b3..97a04d81e 100644 --- a/os/kernel/include/chvt.h +++ b/os/kernel/include/chvt.h @@ -43,7 +43,8 @@ * * @api */ -#define S2ST(sec) ((systime_t)((sec) * CH_FREQUENCY)) +#define S2ST(sec) \ + ((systime_t)((sec) * CH_FREQUENCY)) /** * @brief Milliseconds to system ticks. @@ -55,8 +56,8 @@ * * @api */ -#define MS2ST(msec) ((systime_t)(((((msec) - 1L) * CH_FREQUENCY) / \ - 1000L) + 1L)) +#define MS2ST(msec) \ + ((systime_t)((((msec) * CH_FREQUENCY - 1L) / 1000L) + 1L)) /** * @brief Microseconds to system ticks. @@ -68,8 +69,8 @@ * * @api */ -#define US2ST(usec) ((systime_t)(((((usec) - 1L) * CH_FREQUENCY) / \ - 1000000L) + 1L)) +#define US2ST(usec) \ + ((systime_t)((((usec) * CH_FREQUENCY - 1L) / 1000000L) + 1L)) /** @} */ /** diff --git a/readme.txt b/readme.txt index 953b51cec..adf5773f2 100644 --- a/readme.txt +++ b/readme.txt @@ -89,6 +89,8 @@ ***************************************************************************** *** 2.5.2 *** +- FIX: Fixed MS2ST() and US2ST() macros error (bug #415)(backported to 2.4.4, + 2.2.10, NilRTOS). - FIX: Fixed lwipthread.h should explicitly include lwip/opts.h (bug #414). - FIX: Fixed STM32_PLLI2SCLKOUT miscalculated (bug #413)(backported to 2.4.4). - FIX: Fixed wrong RTC vector name in STM32F1/F4/L1 EXT drivers (bug #412). diff --git a/testhal/SPC563Mxx/SPI/main.c b/testhal/SPC563Mxx/SPI/main.c index 25b67546b..46378a5f8 100644 --- a/testhal/SPC563Mxx/SPI/main.c +++ b/testhal/SPC563Mxx/SPI/main.c @@ -152,6 +152,7 @@ int main(void) { */ while (TRUE) { chThdSleepMilliseconds(500); + palTogglePad(PORT11, P11_LED2); } return 0; }