only disable interrupts temporarily, not permanently
This commit is contained in:
parent
598281a193
commit
39ac2613bb
2
rtc.c
2
rtc.c
@ -25,6 +25,7 @@ ISR(TIMER2_OVF_vect) {
|
||||
void rtc_init(uint32_t rtc_time)
|
||||
{
|
||||
// Stop all interrupts
|
||||
uint8_t sreg = SREG;
|
||||
cli();
|
||||
TCCR2B = 0;
|
||||
TCCR2A = 0;
|
||||
@ -37,6 +38,7 @@ void rtc_init(uint32_t rtc_time)
|
||||
TCCR2B = (1<<CS22)|(1<<CS20);
|
||||
|
||||
TIMSK2 = (1<<TOIE2); // enable overflow interrupt
|
||||
SREG = sreg;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user