Skip to content

Commit 0d6021d

Browse files
committed
Add functions to header file.
Fixing: #1495
1 parent db120a1 commit 0d6021d

File tree

1 file changed

+29
-0
lines changed
  • src/rp2_common/hardware_i2c/include/hardware

1 file changed

+29
-0
lines changed

src/rp2_common/hardware_i2c/include/hardware/i2c.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,21 @@ int i2c_read_timeout_per_char_us(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, si
316316
*/
317317
int i2c_write_blocking(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop);
318318

319+
/*! \brief Attempt to write specified number of bytes to address, blocking in burst mode
320+
* \ingroup hardware_i2c
321+
*
322+
* This version of the function will not issue a stop and will not restart on the next write.
323+
* This allows you to write consecutive bytes of data without having to resend a stop bit and
324+
* (for example) without having to send address byte(s) repeatedly
325+
*
326+
* \param i2c Either \ref i2c0 or \ref i2c1
327+
* \param addr 7-bit address of device to read from
328+
* \param dst Pointer to buffer to receive data
329+
* \param len Length of data in bytes to receive
330+
* \return Number of bytes read, or PICO_ERROR_GENERIC if address not acknowledged or no device present.
331+
*/
332+
int i2c_write_blocking_burst_mode(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len);
333+
319334
/*! \brief Attempt to read specified number of bytes from address, blocking
320335
* \ingroup hardware_i2c
321336
*
@@ -329,6 +344,20 @@ int i2c_write_blocking(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t
329344
*/
330345
int i2c_read_blocking(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len, bool nostop);
331346

347+
/*! \brief Attempt to read specified number of bytes from address, blocking in burst mode
348+
* \ingroup hardware_i2c
349+
*
350+
* This version of the function will not issue a stop and will not restart on the next read.
351+
* This allows you to read consecutive bytes of data without having to resend a stop bit and
352+
* (for example) without having to send address byte(s) repeatedly
353+
*
354+
* \param i2c Either \ref i2c0 or \ref i2c1
355+
* \param addr 7-bit address of device to read from
356+
* \param dst Pointer to buffer to receive data
357+
* \param len Length of data in bytes to receive
358+
* \return Number of bytes read, or PICO_ERROR_GENERIC if address not acknowledged or no device present.
359+
*/
360+
int i2c_read_blocking_burst_mode(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_t len);
332361

333362
/*! \brief Determine non-blocking write space available
334363
* \ingroup hardware_i2c

0 commit comments

Comments
 (0)