aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c_master.h
diff options
context:
space:
mode:
authorzvecr2025-12-01 23:07:33 +0100
committerzvecr2025-12-01 23:07:33 +0100
commitb315b707e60f86d79d34bcb7a15084468117c1a1 (patch)
tree7bbdc5f5d703c28310b4751dd3db280d8f55a6bd /drivers/i2c_master.h
parente2bf515df4c51c4d2e3b442d23e52d6d43f7f726 (diff)
parente10429baae2a4b3ffec67fe31a5e1ac3212817f0 (diff)
Merge branch 'develop'
Diffstat (limited to 'drivers/i2c_master.h')
-rw-r--r--drivers/i2c_master.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/i2c_master.h b/drivers/i2c_master.h
index dbe1cd42fa..5f6094bc81 100644
--- a/drivers/i2c_master.h
+++ b/drivers/i2c_master.h
@@ -73,6 +73,21 @@ i2c_status_t i2c_transmit_P(uint8_t address, const uint8_t* data, uint16_t lengt
i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);
/**
+ * \brief Send multiple bytes and then receive multiple bytes from the selected I2C device.
+ *
+ * \param address The 7-bit I2C address of the device.
+ * \param tx_data A pointer to the data to transmit.
+ * \param tx_length The number of bytes to write. Take care not to overrun the length of `tx_data`.
+ * \param rx_data A pointer to a buffer to read into.
+ * \param rx_length The number of bytes to read. Take care not to overrun the length of `rx_data`.
+ * \param timeout The time in milliseconds to wait for a response from the target device.
+ *
+ * \return `I2C_STATUS_TIMEOUT` if the timeout period elapses, `I2C_STATUS_ERROR` if some other error occurs, otherwise `I2C_STATUS_SUCCESS`.
+ */
+
+i2c_status_t i2c_transmit_and_receive(uint8_t address, const uint8_t* tx_data, uint16_t tx_length, uint8_t* rx_data, uint16_t rx_length, uint16_t timeout);
+
+/**
* \brief Write to a register with an 8-bit address on the I2C device.
*
* \param devaddr The 7-bit I2C address of the device.