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 <bjarki.andreasen@nordicsemi.no>
This commit is contained in:
Bjarki Arge Andreasen 2025-01-09 12:26:05 +01:00 committed by Benjamin Cabé
commit 2e0092356f

View file

@ -74,7 +74,8 @@ static bool i2c_nrfx_twim_rtio_start(const struct device *dev)
sqe->tx.buf = config->common.msg_buf;
}
return i2c_nrfx_twim_rtio_msg_start(dev, I2C_MSG_WRITE | sqe->iodev_flags,
sqe->tx.buf, sqe->tx.buf_len, dt_spec->addr);
(uint8_t *)sqe->tx.buf, sqe->tx.buf_len,
dt_spec->addr);
case RTIO_OP_I2C_CONFIGURE:
(void)i2c_nrfx_twim_configure(dev, sqe->i2c_config);
return false;