Code: Select all
chThdSleepMicroseconds(2000100); //2.0001sec
The macro flows over with CH_CFG_ST_FREQUENCY=10000 so I've modified it
Code: Select all
#define US2ST(usec) \
((systime_t)(((((uint64_t)(usec)) * \
((uint64_t)CH_CFG_ST_FREQUENCY)) + 999999ULL) / 1000000ULL))
and it blinks as expected now .
PS: I would do it with MS2ST too, as t>429secs with CH_CFG_ST_FREQUENCY=10000 will overflow as well (and those values are quite realistic).
PPS: and finally a check of the resulting macro value against the tick timer size (16 or 32bit) may help too..