Tiny Real-Time Clock/calendar
Diff: PCF85063.cpp
- Revision:
- 4:a5c06ac163f1
- Parent:
- 3:c3635fe3ca6f
--- a/PCF85063.cpp Tue Feb 19 20:22:28 2019 +0000 +++ b/PCF85063.cpp Fri Apr 12 14:08:54 2019 +0000 @@ -58,7 +58,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_1; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( ( cmd[1] & ~CONTROL_1_EXT_TEST_MASK ) | myEXT_TEST ); @@ -105,7 +105,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_1; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( ( cmd[1] & ~CONTROL_1_STOP_MASK ) | mySTOP ); @@ -201,7 +201,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_1; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( ( cmd[1] & ~CONTROL_1_CIE_MASK ) | myCIE ); @@ -248,7 +248,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_1; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( ( cmd[1] & ~CONTROL_1_12_24_MASK ) | my12_24.Time12H_24HMode ); @@ -295,7 +295,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_1; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( ( cmd[1] & ~CONTROL_1_CAP_SEL_MASK ) | myCAP_SEL ); @@ -343,7 +343,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_2; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( ( cmd[1] & ~( CONTROL_2_MI_MASK | CONTROL_2_HMI_MASK ) ) | myMI | myHMI ); @@ -390,7 +390,7 @@ /* Read the register */ cmd = PCF85063_CONTROL_2; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ *myTF = (PCF85063_control_2_tf_t)( cmd & CONTROL_2_TF_MASK ); @@ -437,7 +437,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_2; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( cmd[1] & ~CONTROL_2_TF_MASK ); @@ -485,7 +485,7 @@ /* Read the register */ cmd[0] = PCF85063_CONTROL_2; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( cmd[1] & ~CONTROL_2_COF_MASK ) | myCOF; @@ -541,7 +541,7 @@ /* Read the register */ cmd[0] = PCF85063_OFFSET; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( cmd[1] & ~( OFFSET_MODE_MASK | 0b01111111 ) ) | ( myMODE | myOFFSET ); @@ -633,7 +633,7 @@ /* Read the register */ cmd = PCF85063_RAM_BYTE; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ myData->ramByte = cmd; @@ -680,7 +680,7 @@ /* Read the register */ cmd = PCF85063_SECONDS; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ myOS->os = (PCF85063_seconds_os_t)cmd; @@ -727,7 +727,7 @@ /* Read the register */ cmd[0] = PCF85063_SECONDS; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( cmd[1] & ~SECONDS_OS_MASK ); @@ -783,7 +783,7 @@ /* Read the register */ cmd[0] = PCF85063_HOURS; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 1U ); /* Mask it and update it with the new value */ cmd[1] = ( cmd[1] & ~HOURS_AMPM_MASK ) | myAM_PM_Indicator.TimeAM_PM_Mode; @@ -839,7 +839,7 @@ /* Read the register */ cmd = PCF85063_HOURS; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ myAM_PM_Indicator->TimeAM_PM_Mode = (PCF85063_hours_ampm_t)cmd; @@ -886,7 +886,7 @@ /* Read the register */ cmd = PCF85063_DAYS; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ myActualDay->BCDday = ( cmd & ( DAYS_DAYS_TEN_PLACE_MASK | DAYS_DAYS_UNIT_PLACE_MASK ) ); @@ -977,7 +977,7 @@ /* Read the register */ cmd = PCF85063_WEEKDAYS; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ myActualWeekday->weekday = (PCF85063_weekdays_weekdays_t)( cmd & WEEKDAYS_WEEKDAYS_MASK ); @@ -1068,7 +1068,7 @@ /* Read the register */ cmd = PCF85063_MONTHS; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ myActualMonth->BCDmonth = (PCF85063_months_months_t)( cmd & MONTHS_MONTHS_MASK ); @@ -1159,7 +1159,7 @@ /* Read the register */ cmd = PCF85063_YEARS; aux = _i2c.write ( _PCF85063_Addr, &cmd, 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd, 1U ); /* Parse the data */ myActualYear->BCDyear = cmd; @@ -1250,7 +1250,7 @@ /* Read the register */ cmd[0] = PCF85063_SECONDS; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[0], sizeof( cmd )/sizeof( cmd[0] ) ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[0], sizeof( cmd )/sizeof( cmd[0] ) ); /* Parse the data */ if ( myActualTime->Time12H_24HMode == CONTROL_1_12_24_24_HOUR_MODE ) @@ -1308,7 +1308,7 @@ /* Read the register */ cmd[0] = PCF85063_SECONDS; aux = _i2c.write ( _PCF85063_Addr, &cmd[0], 1U, true ); - aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 3U ); + aux = _i2c.read ( _PCF85063_Addr, &cmd[1], 3U ); /* Mask it and update the register */ cmd[1] &= ~( SECONDS_SECONDS_TEN_PLACE_MASK | SECONDS_SECONDS_UNIT_PLACE_MASK );