Skip to content

Commit fee3027

Browse files
[nrf fromtree] drivers: i2c: nrfx_twim_rtio: cast buf to non-const
RTIO correctly declares tx buffers as const, however, the existing I2C API and NRFX (SDK) drivers don't. Therefor cast the const buf to non-const when passing the tx buf to the twim driver from the RTIO call to avoid the const warning. The tx buffer is being treated as const data naturally in the NRFX driver, its just not declared as such since we reuse the buffer for both RX and TX data. Alternatively the SDK and "shim" drivers built on top of it need to be updated, which is quite a bit of work :) Signed-off-by: Bjarki Arge Andreasen <[email protected]> (cherry picked from commit 2e00923)
1 parent edb96f9 commit fee3027

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/i2c/i2c_nrfx_twim_rtio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ static bool i2c_nrfx_twim_rtio_start(const struct device *dev)
9696
sqe->tx.buf = config->common.msg_buf;
9797
}
9898
return i2c_nrfx_twim_rtio_msg_start(dev, I2C_MSG_WRITE | sqe->iodev_flags,
99-
sqe->tx.buf, sqe->tx.buf_len, dt_spec->addr);
99+
(uint8_t *)sqe->tx.buf, sqe->tx.buf_len,
100+
dt_spec->addr);
100101
case RTIO_OP_I2C_CONFIGURE:
101102
(void)i2c_nrfx_twim_configure(dev, sqe->i2c_config);
102103
return false;

0 commit comments

Comments
 (0)