diff --git a/rtc.c b/rtc.c index 1147508..4f97b94 100644 --- a/rtc.c +++ b/rtc.c @@ -8,7 +8,6 @@ * ---------------------------------------------------------------------------- */ -#if 0 #include #include "rtc.h" @@ -16,24 +15,29 @@ #include -static volatile uint32_t rtc_time; +static volatile uint32_t _rtc_time; -ISR(TIMER2_COMP_vect) { - ++rtc_time; +ISR(TIMER2_OVF_vect) { + ++_rtc_time; return; } -void rtc_init(void) +void rtc_init(uint32_t rtc_time) { // Stop all interrupts cli(); + TCCR2B = 0; + TCCR2A = 0; + TCNT2 = 0; // Reset timer to zero - rtc_time = 0; + _rtc_time = rtc_time; - // ... - // ... - // ... + ASSR = (1<