Enoch H. Wexler wrote:
Hello libc maintainers,

Hi, Enoch.

Not a libc maintainer, more of a lurker, but maybe I can help ;)

May I suggest adding to libc an optimization safe access method to the
timers, for example:

typedef volatile int16_t (*pTCNT);
#define TCNT(n) *(pTCNT)(&TCNT ## n) /* e.g., TCNT(3) */

Without this a 100 "tick" delay loop like this would run forever:

Have you verified this?

It shouldn't run forever since TCNT3 should already be declared as volatile, like all the hardware registers that can change value without the compiler knowing.

If for some reason it is not declared volatile, that would be a bug.

--
Paulo Marques


_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to