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

Mitig: do TMR check before sending PEC checksum

parent 86b4e585
Branches
No related merge requests found
......@@ -30,6 +30,7 @@ static cmd_space_t *ext_cmds;
uint16_t use_pec __xMR = 0;
static uint16_t pec_checksum __xMR;
static uint8_t tmp_pec_checksum;
static uint8_t checksum_from_m;
static uint16_t added_tx_pec __xMR = 0;
static uint16_t sent_checksum __xMR = 0;
......@@ -229,7 +230,8 @@ static void __xMR I2C_tx_pending(const struct i2c_s_async_descriptor *const desc
set_cmd(descr, 3);
++cmd_len;
} else if (use_pec && !sent_checksum) {
io_write(io, (uint8_t *)&pec_checksum, 1);
tmp_pec_checksum = pec_checksum;
io_write(io, (uint8_t *)&tmp_pec_checksum, 1);
set_cmd(descr, 3);
sent_checksum = 1;
} else {
......@@ -254,7 +256,8 @@ static void __xMR I2C_tx_pending(const struct i2c_s_async_descriptor *const desc
set_cmd(descr, 3);
++cmd_len;
} else if (use_pec && !sent_checksum) {
io_write(io, (uint8_t *)&pec_checksum, 1);
tmp_pec_checksum = pec_checksum;
io_write(io, (uint8_t *)&tmp_pec_checksum, 1);
set_cmd(descr, 3);
sent_checksum = 1;
} 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