Add support for night mode
This commit is contained in:
@@ -22,18 +22,18 @@ void rtc_set_time_part(uint8_t part, uint8_t value)
|
||||
i2c_writebuf(RTC_I2C_ADDR, part, 1, &bcd);
|
||||
}
|
||||
|
||||
void rtc_set_time(struct TIME* time)
|
||||
void rtc_set_time(struct TIME_HMS* time)
|
||||
{
|
||||
uint8_t buf[] = { DEC_2_BCD(time->second), DEC_2_BCD(time->minute), DEC_2_BCD(time->hour) };
|
||||
i2c_writebuf(RTC_I2C_ADDR, SECOND, 3, buf); // SECOND is the first memory cell (0x02)
|
||||
}
|
||||
|
||||
struct TIME rtc_read_time(void)
|
||||
struct TIME_HMS rtc_read_time(void)
|
||||
{
|
||||
uint8_t buffer[3];
|
||||
i2c_readbuf(RTC_I2C_ADDR, 0x02, 3, buffer);
|
||||
|
||||
struct TIME curr_time = {
|
||||
struct TIME_HMS curr_time = {
|
||||
BCD_2_DEC(buffer[2]),
|
||||
BCD_2_DEC(buffer[1]),
|
||||
BCD_2_DEC(buffer[0])
|
||||
|
||||
Reference in New Issue
Block a user