示例#1
0
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]);
}
示例#2
0
uint8_t TM_DS1307_GetYear(void) {
	return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_YEAR));
}
示例#3
0
uint8_t TM_DS1307_GetMonth(void) {
	return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_MONTH));
}
示例#4
0
uint8_t TM_DS1307_GetDate(void) {
	return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_DATE));
}
示例#5
0
uint8_t TM_DS1307_GetHours(void) {
	return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_HOURS));
}
示例#6
0
uint8_t TM_DS1307_GetMinutes(void) {
	return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_MINUTES));
}
示例#7
0
uint8_t TM_DS1307_GetSeconds(void) {
	return TM_DS1307_Bcd2Bin(TM_I2C_ReadReg(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_SECONDS));
}
示例#8
0
uint8_t TM_DS1307_GetDay(void) {
	return TM_DS1307_Bcd2Bin(TM_I2C_Read(TM_DS1307_I2C, TM_DS1307_I2C_ADDR, TM_DS1307_DAY));
}