This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Wrong computation in BSP_MS_TO_TICK macro

Hi,

I noticed a possible issue in BSP_MS_TO_TICK macro computation. In bsp.c, the macro is defined as:

#define BSP_MS_TO_TICK(MS) (m_app_ticks_per_100ms * (MS / 100))

This macro is used many places in BSP to start timers. But due to the places of parenthesis, it forbid the usage of timers shorter than 100ms. It does a division of MS by 100, leading to 0 if MS < 100.

Rather than:

#define BSP_MS_TO_TICK(MS) ((m_app_ticks_per_100ms * MS) / 100)

It shall be (mind the place of the parenthesis):

#define BSP_MS_TO_TICK(MS) (m_app_ticks_per_100ms * (MS / 100))

Multiply before divide is probably better to avoid 0 tick computation when MS < 100ms.

Is it on-purpose ? Can you confirm there is no issue setting timers shorter than 100ms ? (I think/hope not).

Regards. Djamil

Parents Reply Children
No Data
Related