Just ran into the overflow problem on this macro, as I’m using just 16-bit ticks, needing only a 10 second (10,000 tick) horizon for everything except the hourmeter:
“pound”define configUSE16BITTICKS 1
“pound”define configTICKRATEHZ ( ( TickTypet ) 1000 )
The problem with re-writing it really boils down to implementation details: If I use a constant argument that is computed at compile time, or even just once at startup, it doesn’t matter whether 64 bit types are implemented on the target or not. Modern, fast targets wouldn’t care if it was a run-time function, but I’m really not at all CPU-power conscious.
The “proper” size of the arguments in the calculation (defined by expectations as a naive user) would need to be sizeof(argument)+sizeof(TickTypet), which we can conservatively decide should be
2 * sizeof(TickType
t). Good luck properly expressing that in the C programming language, especially in a portable, simple way — you’d need some decent typedef magic.
A warning in the examples is probably best, as if the definition had been partially “fixed”,say, with uint32 casts, it just hides the problem until much
For myself, I’m modifying projdefs.h and putting my definition (with a warning) in FreeRTOSConfig.h.