42_KFS/headers/rtc.h

30 lines
622 B
C
Raw Normal View History

2024-09-18 15:45:10 -04:00
#pragma once
#include <stdint.h>
2024-09-18 16:30:11 -04:00
#define SECOND_REGISTER 0x00
#define MINUTE_REGISTER 0x02
#define HOUR_REGISTER 0x04
#define DAY_OF_THE_WEEK_REGISTER 0x06
2024-09-18 15:45:10 -04:00
#define DAY_OF_THE_MONTH_REGISTER 0x07
2024-09-18 16:30:11 -04:00
#define MONTH_REGISTER 0x08
#define YEAR_REGISTER 0x09
#define CENTURY_REGISTER 0x32
2024-09-18 15:45:10 -04:00
#define REGISTER_A 0x0A
#define REGISTER_B 0x0B
2024-09-18 16:30:11 -04:00
enum { CMOS_ADDRESS = 0x70, CMOS_DATA = 0x71 };
2024-09-18 15:45:10 -04:00
struct rtc_date {
2024-09-18 16:30:11 -04:00
uint8_t second;
uint8_t minute;
uint8_t hour;
2024-09-18 15:45:10 -04:00
2024-09-18 16:30:11 -04:00
uint8_t index_of_the_day;
uint8_t day;
uint8_t month;
uint32_t year;
2024-09-18 15:45:10 -04:00
};
struct rtc_date get_date(void);