Delay functions cdelay.h

alank2's picture
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1



Here is the cdelay.h I use for most of my projects.  It requires defining the symbol F_CPU with the number of cpu cycles, but then you can do delays in ns, us, ms, or s.

It will always select the next higher delay.

The _approx functions may add up to 5 more cycles of delay at the savings of flash.