void TM_DS1307_GetDateTime(TM_DS1307_Time_t* time) { uint8_t data[7]; TM_I2C_ReadMulti(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_SECONDS, data, 7); time->seconds = TM_DS1307_Bcd2Bin(data[TM_DS1307_SECONDS]); time->minutes = TM_DS1307_Bcd2Bin(data[TM_DS1307_MINUTES]); time->hours = TM_DS1307_Bcd2Bin(data[TM_DS1307_HOURS]); time->day = TM_DS1307_Bcd2Bin(data[TM_DS1307_DAY]); time->date = TM_DS1307_Bcd2Bin(data[TM_DS1307_DATE]); time->month = TM_DS1307_Bcd2Bin(data[TM_DS1307_MONTH]); time->year = TM_DS1307_Bcd2Bin(data[TM_DS1307_YEAR]); }
uint8_t TM_DS1307_GetYear(void) { return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_YEAR)); }
uint8_t TM_DS1307_GetMonth(void) { return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_MONTH)); }
uint8_t TM_DS1307_GetDate(void) { return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_DATE)); }
uint8_t TM_DS1307_GetHours(void) { return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_HOURS)); }
uint8_t TM_DS1307_GetMinutes(void) { return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_MINUTES)); }
uint8_t TM_DS1307_GetSeconds(void) { return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_SECONDS)); }
uint8_t TM_DS1307_GetDay(void) { return TM_DS1307_Bcd2Bin(TM_I2C_Read(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_DAY)); }