Macro Expansion chThdSleepMilliseconds

Discussions and support about ChibiStudio, the free development environment for ARM.
pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Macro Expansion chThdSleepMilliseconds

Postby pito » Sun Mar 20, 2016 12:26 pm

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?

User avatar
Giovanni
Site Admin
Posts: 12887
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 720 times
Been thanked: 602 times
Contact:

Re: Macro Expansion chThdSleepMilliseconds

Postby Giovanni » Sun Mar 20, 2016 12:36 pm

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

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: Macro Expansion chThdSleepMilliseconds

Postby pito » Sun Mar 20, 2016 12:43 pm

I know, but it shows 10000 even the CH_CFG_ST_FREQUENCY is set to 3000, for example (ie VLDiscovery demo).

User avatar
Giovanni
Site Admin
Posts: 12887
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 720 times
Been thanked: 602 times
Contact:

Re: Macro Expansion chThdSleepMilliseconds

Postby Giovanni » Sun Mar 20, 2016 12:48 pm

Probably you need to reindex your project.

Giovanni

pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: Macro Expansion chThdSleepMilliseconds

Postby pito » Sun Mar 20, 2016 12:54 pm

Ok, after "Index->Freshen All Files" it starts to copy the actual value of CH_CFG_ST_FREQUENCY into the chThdSleepMilliseconds macro expansion.
Tkanks!


Return to “ChibiStudio”

Who is online

Users browsing this forum: No registered users and 3 guests