2013-12-26 11:47:30 -07:00
|
|
|
#include <stdbool.h>
|
2013-03-27 21:50:31 -06:00
|
|
|
#include <avr/io.h>
|
2013-06-30 14:19:41 -06:00
|
|
|
#include <avr/interrupt.h>
|
|
|
|
|
2013-12-26 11:47:30 -07:00
|
|
|
#include "avr.h"
|
2013-06-30 14:19:41 -06:00
|
|
|
|
|
|
|
volatile uint32_t jiffies = 0;
|
2013-12-26 11:47:30 -07:00
|
|
|
volatile bool tick = false;
|
2013-06-30 14:19:41 -06:00
|
|
|
|
2013-12-26 11:47:30 -07:00
|
|
|
void
|
|
|
|
loop(void)
|
2013-03-07 23:55:05 -07:00
|
|
|
{
|
2013-12-26 11:47:30 -07:00
|
|
|
if (tick) {
|
|
|
|
tick = false;
|
|
|
|
|
|
|
|
if (jiffies % 10 == 0) {
|
|
|
|
PORTB ^= 0xff;
|
|
|
|
}
|
|
|
|
}
|
2013-06-30 14:19:41 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
2013-12-26 11:47:30 -07:00
|
|
|
init();
|
2013-06-30 14:19:41 -06:00
|
|
|
|
2013-12-26 11:47:30 -07:00
|
|
|
for (;;) {
|
|
|
|
loop();
|
2013-03-27 21:50:31 -06:00
|
|
|
}
|
2013-06-30 14:19:41 -06:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|