/* * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. * (c) 2014 Stefan Rupp * ---------------------------------------------------------------------------- */ #include #include "rtc.h" #include #include static volatile uint32_t _rtc_time; ISR(TIMER2_OVF_vect) { ++_rtc_time; return; } void rtc_init(uint32_t rtc_time) { // Stop all interrupts uint8_t sreg = SREG; cli(); TCCR2B = 0; TCCR2A = 0; TCNT2 = 0; // Reset timer to zero _rtc_time = rtc_time; ASSR = (1<= 1000) { *ms -= 1000; (*seconds)++; } while (*seconds >= 60) { *ms -= 60; (*minutes)++; } while (*minutes >= 60) { *minutes -= 60; (*hours)++; } return; } */ #endif