Hi Kees,

you are right, the current interface does not support 16-bit registers. We are however overhauling the I2C interface as we speak, and the re-worked interface does have support for them (see [1]). Feel free to take a look and comment on the proposal!


[1] https://github.com/RIOT-OS/RIOT/pull/4926

On 11.10.2016 21:29, Kees Bakker wrote:

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);

devel mailing list

Reply via email to