Open lefebvresam opened 7 months ago
Hmm, are any of those I2C calls returning an error code?
Hmm, are any of those I2C calls returning an error code?
@lefebvresam any comment?
I omitted this issue by not longer using those function calls. I think the bug in those calls is still there and should be further investigated.
I now use this implementation which is working correctly for my application:
RetCode_t RA8875::GT911_WriteConfig(GTConfig *config){
GTchecksum cs;
GT911_ReadChecksum(&cs);
INFO("Read checksum: 0x%02X", cs.value);
uint8_t cs_calc = GT911_CalcChecksum((uint8_t *)config+2, sizeof(GTConfig)-2);
INFO("Calc checksum: 0x%02X", cs_calc);
if (!configLoaded) {
ERR("Config has not been loaded");
return bad_parameter;
}
if (cs.value != cs_calc) { // config has been changed
int err = m_i2c->write(m_addr, (char*)config, sizeof(GTConfig));
if (err) {
ERR("I2C result: %d", err);
return bad_parameter;
}
cs.value = cs_calc;
cs.fresh = 1; // configuration updated
GT911_WriteChecksum(&cs);
INFO("Config has been written correctly");
return noerror;
}
INFO("No differences in config");
return noerror;
}
When I try this:
I get this: