Enable setting the clock time via keyboard
This commit is contained in:
10
main.c
10
main.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user