Distancer/hardware.cpp

18 lines
175 B
C++
Raw Normal View History

#include "hardware.h"
#include "avr/io.h"
2017-03-02 07:21:17 +00:00
void delay_us(uint16_t delay)
{
2017-03-02 07:21:17 +00:00
TCCR1B = (1 << CS10);
TCNT1 = 0;
2017-03-02 07:21:17 +00:00
while (true)
{
2017-03-02 07:21:17 +00:00
if (TCNT1 >= delay)
{
2017-03-02 07:21:17 +00:00
return;
}
}
}