Enable setting the clock time via keyboard

This commit is contained in:
2020-11-08 23:24:25 +01:00
parent 0378d53456
commit ed34a0a578
6 changed files with 138 additions and 6 deletions

10
main.c
View File

@@ -1,16 +1,16 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include "keyboard.h"
#include "ptimer.h"
#include "i2c.h"
#include "rtc.h"
#include "led.h"
#define I2C_BITRATE 100000UL // 100kHz
#define RTC_I2C_ADDR 0xA2
int main()
{
keyboard_init();
ptimer_init();
i2c_init(I2C_BITRATE);
rtc_int0_init();
@@ -20,17 +20,17 @@ int main()
led_hour = 0;
led_minute = 0;
led_second = 0;
led_second = 0;
while(1)
{
keyboard_handle_input();
}
}
ISR(INT0_vect)
{
struct time curr_time = rtc_read_time(RTC_I2C_ADDR);
struct time curr_time = rtc_read_time();
led_hour = curr_time.hour;
led_minute = curr_time.minute;
led_second = curr_time.second;