Advanced AVR 3.0 time management Finalized - Elegant delay code + new HC-SR04 library
AA3TM is a set of high quality and well-calculated doctrines for programming a MCU, and it's been refined and redefined over and over again, and it's considered done. Proofread, and added 2 examples code and reinvented code elegance. Achieving 551kHz on the main loop while having 100us to 6.55s programmable delay in multiple stages at 10kHz is not a break through, but the absolutely best I can do. 100us is picked for more balance between the CPU power and the delay range, meaning the 10kHz timer loop can have about 800 CPU instructions at 8MHz and 1600 at 16MHz. The delay range is 100us-6.55s with 16-bit counter, and 100us-25.5ms with 8-bit counter. The 8-bit counter range is good for most delay needs.
In short, AA3TM is the result of complete understanding in the hardware level with supreme software coding technique, a milestone to build more sophisticated application on.