Page 1 of 1

Macro Expansion chThdSleepMilliseconds

Posted: Sun Mar 20, 2016 12:26 pm
by pito
Hi, when looking at macro expansion of chThdSleepMilliseconds I always see ((uint32_t)10000) in

chThdSleep(((systime_t)(((((uint32_t)(500)) * \
((uint32_t)10000)) + 999UL) / 1000UL)))

independently of CH_CFG_ST_FREQUENCY settings. Is that ok?

Re: Macro Expansion chThdSleepMilliseconds

Posted: Sun Mar 20, 2016 12:36 pm
by Giovanni
Hi,

Code: Select all

#define MS2ST(msec)                                                         \
  ((systime_t)(((((uint32_t)(msec)) *                                       \
                 ((uint32_t)CH_CFG_ST_FREQUENCY)) + 999UL) / 1000UL))


That (uint32_t)10000) is CH_CFG_ST_FREQUENCY, expanded.

Giovanni

Re: Macro Expansion chThdSleepMilliseconds

Posted: Sun Mar 20, 2016 12:43 pm
by pito
I know, but it shows 10000 even the CH_CFG_ST_FREQUENCY is set to 3000, for example (ie VLDiscovery demo).

Re: Macro Expansion chThdSleepMilliseconds

Posted: Sun Mar 20, 2016 12:48 pm
by Giovanni
Probably you need to reindex your project.

Giovanni

Re: Macro Expansion chThdSleepMilliseconds

Posted: Sun Mar 20, 2016 12:54 pm
by pito
Ok, after "Index->Freshen All Files" it starts to copy the actual value of CH_CFG_ST_FREQUENCY into the chThdSleepMilliseconds macro expansion.
Tkanks!