diydrones/ardupilot — pull request #77 by JohnArneBirkeland (2013-02-05 12:17:07+00:00)
Title: AP_HAL_AVR: Improved AVRTimer micros() and millis()

- More efficient code with less overhead by using 16-bit timer
- micros() now has proper 1 us resolution
- removed unneeded/unwanted initializatin of timers in AVRTimer::init()
- Fixed micros() and millis() counting "backwards" by checking for imminent overflow interrupts when reading timer counters
- Cleaned up timer initialization in AVRTimer::Init() and APMnRCInput::init() so that both can be executed toghether or induvidually in any order
- Removed unsafe use of sei()
- The point where the AVR global interrupt flag is set, is now clearly defined inside AVRScheduler::init();