int watch_get_date(uint8_t* year, uint8_t* month, uint8_t* day_of_month)
{
uint8_t date_bits_low, date_bits_high;
if (year == NULL || month == NULL || day_of_month == NULL)
{
return -1;
}
if (watch_i2c_read_byte(ADDRESS_DATE_LOW, &date_bits_low) != 0)
{
return -1;
}
if (watch_i2c_read_byte(ADDRESS_DATE_HIGH, &date_bits_high) != 0)
{
return -1;
}
watch_registers_get_date(
date_bits_low, date_bits_low, year, month, day_of_month);
return 0;
}
.h file
void watch_registers_get_date(
uint8_t date_bits_low, uint8_t date_bits_high, uint8_t* year,
uint8_t* month, uint8_t* day_of_month);
void watch_registers_get_date(
uint8_t date_bits_low, uint8_t date_bits_high, uint8_t* year,
uint8_t* month, uint8_t* day_of_month)
{
*year = date_bits_low & 0b01111111 ;
*month = ((date_bits_high & 0b00000111)<<1) + (date_bits_low <<7);
*day_of_month = ((date_bits_high & 0b11111000 >>3));
}
ik krijg steeds een fout bij get of month tijdens een test case te maken kan iemand zo zien wat het is