Skip to content
Snippets Groups Projects
Commit 13eb660f authored by Christos Gentsos's avatar Christos Gentsos
Browse files

Master: read data even when PEC is bad

parent ce854ec3
Branches
No related merge requests found
......@@ -428,8 +428,8 @@ int32_t i2c_m_sync_my_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t reg, uint8_t
pec = crc8_byte(pec ^ reg);
pec = crc8_byte(pec ^ ((i2c->slave_addr << 1) | 0x01));
pec = crc8_bytearray(pec_buf, length, pec);
memcpy(buffer, pec_buf, length);
if (pec == pec_buf[length]) {
memcpy(buffer, pec_buf, length);
free(pec_buf);
return ERR_NONE;
} else {
......@@ -600,8 +600,8 @@ int32_t i2c_m_sync_ext_cmd_read(struct i2c_m_sync_desc *i2c, uint8_t cmd, uint8_
pec = crc8_byte(pec ^ cmd);
pec = crc8_byte(pec ^ ((i2c->slave_addr << 1) | 0x01));
pec = crc8_bytearray(pec_buf, length, pec);
memcpy(buffer, pec_buf, length);
if (pec == pec_buf[length]) {
memcpy(buffer, pec_buf, length);
free(pec_buf);
return ERR_NONE;
} else {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment