From 8af7df122eca6f91c7e96edd544dd49a72b8d3bd Mon Sep 17 00:00:00 2001 From: IOsetting Date: Sat, 16 Jul 2022 10:08:08 +0800 Subject: [PATCH] feat: update RX8025T_SetTime() in rx8025t demo --- demo/i2c/rx8025t/main.c | 8 ++++++++ demo/i2c/rx8025t/rx8025t.c | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/demo/i2c/rx8025t/main.c b/demo/i2c/rx8025t/main.c index 7f61326..b9bfdcc 100644 --- a/demo/i2c/rx8025t/main.c +++ b/demo/i2c/rx8025t/main.c @@ -61,6 +61,14 @@ int main(void) GPIO_Init(); I2C_Init(); RX8025T_Init(); + time[0] = 0x10; // second + time[1] = 0x10; // minute + time[2] = 0x10; // hour + time[3] = 0x40; // week day + time[4] = 0x16; // day + time[5] = 0x07; // month + time[6] = 0x22; // year + RX8025T_SetTime(time); while(1) { diff --git a/demo/i2c/rx8025t/rx8025t.c b/demo/i2c/rx8025t/rx8025t.c index f033788..96304cb 100755 --- a/demo/i2c/rx8025t/rx8025t.c +++ b/demo/i2c/rx8025t/rx8025t.c @@ -38,11 +38,13 @@ uint8_t RX8025T_GetTime(uint8_t *t) uint8_t RX8025T_SetTime(uint8_t *t) { - RX8025T_Write(RX8025T_REG_YEAR, t[0]); - RX8025T_Write(RX8025T_REG_MONTH, t[0]); - RX8025T_Write(RX8025T_REG_DAY, t[0]); - RX8025T_Write(RX8025T_REG_HOUR, t[0]); - RX8025T_Write(RX8025T_REG_MINUTE, t[0]); RX8025T_Write(RX8025T_REG_SECOND, t[0]); + RX8025T_Write(RX8025T_REG_MINUTE, t[1]); + RX8025T_Write(RX8025T_REG_HOUR, t[2]); + + RX8025T_Write(RX8025T_REG_WEEKDAY, t[3]); + RX8025T_Write(RX8025T_REG_DAY, t[4]); + RX8025T_Write(RX8025T_REG_MONTH, t[5]); + RX8025T_Write(RX8025T_REG_YEAR, t[6]); return HAL_OK; }