Commit 2f248bbf authored by Christos Gentsos's avatar Christos Gentsos

I2C: Fix bug with command 0x00 always returning zero

parent a79fbf97
Pipeline #2593 failed with stage
in 0 seconds
......@@ -17,7 +17,7 @@ static struct io_descriptor *io;
static uint16_t dev_addr __xMR;
static uint16_t rx_state __xMR = CMD;
static uint8_t tmp_std_cmd_addr;
static uint16_t std_cmd_addr __xMR;
static uint16_t std_cmd_addr __xMR = 0xFF;
static int16_t cmd_index __xMR;
static int16_t cmd_len __xMR;
static uint8_t tmp_ext_cmd_addr;
......@@ -72,7 +72,6 @@ static void __xMR I2C_rx_complete(const struct i2c_s_async_descriptor *const des
if (use_pec)
pec_checksum = crc8_byte(pec_checksum ^ std_cmd_addr);
if (std_cmd_addr == 0xFF) {
std_cmd_addr = 0;
rx_state = EXT_CMD;
send_ack(descr);
set_cmd(descr, 3);
......@@ -223,7 +222,7 @@ static void __xMR I2C_tx_pending(const struct i2c_s_async_descriptor *const desc
added_tx_pec = 1;
sent_checksum = 0;
}
if (std_cmd_addr) {
if (std_cmd_addr != 0xFF) {
if ((*cmds->cmds[cmd_index].data_len < 0) && (!blk_wrote_len_byte)) {
cmd_len = 0;
tx_tmp = -*cmds->cmds[cmd_index].data_len;
......
Markdown is supported
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