This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
Distancer/hardware.cpp

18 lines
175 B
C++
Raw Permalink 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;
}
}
}