Create global 'time' variable which holds RTC value

This commit is contained in:
2020-11-19 22:03:35 +01:00
parent ca61a84220
commit 29c593c2a4
9 changed files with 46 additions and 46 deletions

View File

@@ -1,7 +1,10 @@
#include <avr/interrupt.h>
#include <avr/io.h>
#include "rtc.h"
#include "i2c.h"
volatile struct TIME_HMS time;
void rtc_int0_init(void)
{
INT0_DIR &= ~(1<<INT0_PIN);
@@ -40,4 +43,21 @@ struct TIME_HMS rtc_read_time(void)
};
return curr_time;
}
uint8_t rtc_handle_timer(void)
{
if(!(GIFR & (1<<INTF0)))
{
time = rtc_read_time();
GIFR |= 1<<INTF0;
return 1;
}
return 0;
}
ISR(INT0_vect)
{
}