feat: update RX8025T_SetTime() in rx8025t demo

This commit is contained in:
IOsetting 2022-07-16 10:08:08 +08:00
parent 5058b6b3dd
commit 8af7df122e
2 changed files with 15 additions and 5 deletions

View File

@ -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)
{

View File

@ -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;
}