[riot-devel] I2C driver function to read a register with 16 bits address

Kees Bakker kees at sodaq.com
Tue Oct 11 21:29:27 CEST 2016


The SHT2x I2C device has a register with a 16 bits address. If I'm correct
we don't have a function in the I2C driver to do that. Right?

Assuming we need to extend the driver API, what would be a good name
for such a function?

All I can come up with is i2c_read_regs2:

  * @brief   Read multiple bytes from a register at the I2C slave with 
the given
  *          address
  * @param[in]  dev          I2C peripheral device
  * @param[in]  address      bus address of the target device
  * @param[in]  reg          the 16 bits register address on the 
targeted I2C device
  * @param[out] data         array holding the received bytes
  * @param[in]  length       the number of bytes to read into `data`
  * @return                  the number of bytes that were read
  * @return                  -1 on undefined device given
int i2c_read_regs2(i2c_t dev, uint8_t address, uint16_t reg,
                   char *data, int length);

Kees Bakker
M. 0031617737165

More information about the devel mailing list