summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2025-11-11 04:02:35 -0800
committerGitHub <noreply@github.com>2025-11-11 23:02:35 +1100
commit28eeb92f8eec5b8268d2a74ad0561670d14e189a (patch)
tree55e9a33aa1bd678116118da48a103f7ef4365061 /docs
parentefc5d63383b64291f25c8377bcfae8178dd63302 (diff)
Add I2C Transmit and Receive function (#25637)
* feat: adds a transmit and receive i2c method * fix: address the i2c transmit and receive length on u16 * Add AVR/LUFA implementation Didn't add a progmem version, since that would only apply to receive. Figured it wasn't worth it, but can add. * Rearrange order of functions * Add docs * Fix doc gen error * Fix lint issues * fix more lint issues
Diffstat (limited to 'docs')
-rw-r--r--docs/drivers/i2c.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/drivers/i2c.md b/docs/drivers/i2c.md
index ad74d0e481..75823c682b 100644
--- a/docs/drivers/i2c.md
+++ b/docs/drivers/i2c.md
@@ -221,6 +221,31 @@ Receive multiple bytes from the selected I2C device.
221 221
222--- 222---
223 223
224### `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)` {#api-i2c-transmit-and-receive}
225
226Send and receive multiple bytes from the selected I2C device.
227
228#### Arguments {#api-i2c-transmit-and-receive-arguments}
229
230 - `uint8_t address`
231 The 7-bit I2C address of the device.
232 - `const uint8_t* tx_data`
233 A pointer to the data to transmit.
234 - `uint16_t tx_length`
235 The number of bytes to write. Take care not to overrun the length of `tx_data`.
236 - `uint8_t* rx_data`
237 A pointer to a buffer to read into.
238 - `uint16_t rx_length`
239 The number of bytes to read. Take care not to overrun the length of `data`.
240 - `uint16_t timeout`
241 The time in milliseconds to wait for a response from the target device.
242
243#### Return Value {#api-i2c-transmit-and-receive-return}
244
245`I2C_STATUS_TIMEOUT` if the timeout period elapses, `I2C_STATUS_ERROR` if some other error occurs, otherwise `I2C_STATUS_SUCCESS`.
246
247---
248
224### `i2c_status_t i2c_write_register(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout)` {#api-i2c-write-register} 249### `i2c_status_t i2c_write_register(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout)` {#api-i2c-write-register}
225 250
226Write to a register with an 8-bit address on the I2C device. 251Write to a register with an 8-bit address on the I2C device.