29 lines
350 B
C
29 lines
350 B
C
#include "time.h"
|
|
#include "conf.h"
|
|
|
|
#include <avr/interrupt.h>
|
|
#include <avr/io.h>
|
|
|
|
volatile unsigned int _eigentime_ms;
|
|
|
|
void
|
|
time_init(void)
|
|
{
|
|
_eigentime_ms = 0;
|
|
TCCR1B = _BV(CS10);
|
|
OCR1A = TIMER1_COMPA_VALUE;
|
|
TIMSK |= _BV(OCIE1A);
|
|
}
|
|
|
|
|
|
unsigned int
|
|
get_eigentime(void)
|
|
{
|
|
return _eigentime_ms;
|
|
}
|
|
|
|
ISR(TIMER1_COMPA_vect)
|
|
{
|
|
_eigentime_ms++;
|
|
}
|