only disable interrupts temporarily, not permanently

This commit is contained in:
Stefan Rupp 2014-03-09 00:36:20 +01:00
parent 598281a193
commit 39ac2613bb
2 changed files with 4 additions and 1 deletions

2
rtc.c
View File

@ -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;
}

View File

@ -32,6 +32,7 @@ ISR(TIMER0_COMPA_vect) {
void timer_init(void)
{
uint8_t sreg = SREG;
// Stop all interrupts
cli();
@ -55,7 +56,7 @@ void timer_init(void)
// Interrupts setzen
TIMSK0 |= (1<<OCIE0A);
SREG = sreg;
}