Hello libc maintainers,

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:


int16_t when, time;


when = TCNT3 + 99;

do {

    do_something();

    time = when - TCNT3;

}

while (time >= 0);


Thanks, Enoch.






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

Reply via email to