diff options
| author | Ryan <fauxpark@gmail.com> | 2021-10-07 10:29:35 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-07 10:29:35 +1100 |
| commit | bc1f5ef38172bc77a802fb779e5da60f800c231b (patch) | |
| tree | 104a22b67c21e08c33a9d2ddedf04abc9710d5e4 /docs | |
| parent | 875e44faac31e5985e764c7b117ad4938e2e6027 (diff) | |
| download | qmk_firmware-bc1f5ef38172bc77a802fb779e5da60f800c231b.tar.gz qmk_firmware-bc1f5ef38172bc77a802fb779e5da60f800c231b.zip | |
i2c_master: Add support for reading/writing to 16-bit registers (#14289)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/i2c_driver.md | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/docs/i2c_driver.md b/docs/i2c_driver.md index 9017b44ed..95c588af4 100644 --- a/docs/i2c_driver.md +++ b/docs/i2c_driver.md | |||
| @@ -187,7 +187,7 @@ Receive multiple bytes from the selected SPI device. | |||
| 187 | 187 | ||
| 188 | ### `i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout)` | 188 | ### `i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout)` |
| 189 | 189 | ||
| 190 | Writes to a register on the I2C device. | 190 | Writes to a register with an 8-bit address on the I2C device. |
| 191 | 191 | ||
| 192 | #### Arguments | 192 | #### Arguments |
| 193 | 193 | ||
| @@ -208,9 +208,32 @@ Writes to a register on the I2C device. | |||
| 208 | 208 | ||
| 209 | --- | 209 | --- |
| 210 | 210 | ||
| 211 | ### `i2c_status_t i2c_writeReg16(uint8_t devaddr, uint16_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout)` | ||
| 212 | |||
| 213 | Writes to a register with a 16-bit address (big endian) on the I2C device. | ||
| 214 | |||
| 215 | #### Arguments | ||
| 216 | |||
| 217 | - `uint8_t devaddr` | ||
| 218 | The 7-bit I2C address of the device. | ||
| 219 | - `uint16_t regaddr` | ||
| 220 | The register address to write to. | ||
| 221 | - `uint8_t *data` | ||
| 222 | A pointer to the data to transmit. | ||
| 223 | - `uint16_t length` | ||
| 224 | The number of bytes to write. Take care not to overrun the length of `data`. | ||
| 225 | - `uint16_t timeout` | ||
| 226 | The time in milliseconds to wait for a response from the target device. | ||
| 227 | |||
| 228 | #### Return Value | ||
| 229 | |||
| 230 | `I2C_STATUS_TIMEOUT` if the timeout period elapses, `I2C_STATUS_ERROR` if some other error occurs, otherwise `I2C_STATUS_SUCCESS`. | ||
| 231 | |||
| 232 | --- | ||
| 233 | |||
| 211 | ### `i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout)` | 234 | ### `i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout)` |
| 212 | 235 | ||
| 213 | Reads from a register on the I2C device. | 236 | Reads from a register with an 8-bit address on the I2C device. |
| 214 | 237 | ||
| 215 | #### Arguments | 238 | #### Arguments |
| 216 | 239 | ||
| @@ -229,6 +252,27 @@ Reads from a register on the I2C device. | |||
| 229 | 252 | ||
| 230 | --- | 253 | --- |
| 231 | 254 | ||
| 255 | ### `i2c_status_t i2c_readReg16(uint8_t devaddr, uint16_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout)` | ||
| 256 | |||
| 257 | Reads from a register with a 16-bit address (big endian) on the I2C device. | ||
| 258 | |||
| 259 | #### Arguments | ||
| 260 | |||
| 261 | - `uint8_t devaddr` | ||
| 262 | The 7-bit I2C address of the device. | ||
| 263 | - `uint16_t regaddr` | ||
| 264 | The register address to read from. | ||
| 265 | - `uint16_t length` | ||
| 266 | The number of bytes to read. Take care not to overrun the length of `data`. | ||
| 267 | - `uint16_t timeout` | ||
| 268 | The time in milliseconds to wait for a response from the target device. | ||
| 269 | |||
| 270 | #### Return Value | ||
| 271 | |||
| 272 | `I2C_STATUS_TIMEOUT` if the timeout period elapses, `I2C_STATUS_ERROR` if some other error occurs, otherwise `I2C_STATUS_SUCCESS`. | ||
| 273 | |||
| 274 | --- | ||
| 275 | |||
| 232 | ### `i2c_status_t i2c_stop(void)` | 276 | ### `i2c_status_t i2c_stop(void)` |
| 233 | 277 | ||
| 234 | Stop the current I2C transaction. | 278 | Stop the current I2C transaction. |
