M41T62 driver error
The M41T62 driver provided in STSW-M41T62 appears to have an error related to calibration of positive adjustments. Refer to the code below from line 750 of M41T62.c
The sign parameter is 0 or 1. To program the M41T62 for positive compensation requires programming the control register bit 5 with a logical 1. The code does not do this as it effects only bit 0 of the control register.
I suggest adding the following code at line 758:
sign = sign <<5;
M41T62_Error_et M41T62_Set_SignForCalibration(M41T62_SignCalibrationStatus_et sign)
{
uint8_t tmp;
M41T62_assert_param(IS_M41T62_CALIBRATION_SIGN(sign));
if(M41T62_ReadRegs(M41T62_CALIBRATIONREG, 1, &tmp))
return M41T62_ERROR;
tmp &= ~M41T62_SIGN_CALIBRATION_MASK;
tmp |= ((uint8_t)sign);
if(M41T62_WriteRegs(M41T62_CALIBRATIONREG, 1, &tmp))
return M41T62_ERROR;
return M41T62_OK;
}
