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

Kees Bakker kees at sodaq.com
Thu Oct 13 21:54:48 CEST 2016


Ah, thanks.

On 12-10-16 09:48, Hauke Petersen wrote:
> 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!
>
> Cheers,
> Hauke
>
> [1] https://github.com/RIOT-OS/RIOT/pull/4926
>
>
> On 11.10.2016 21:29, Kees Bakker wrote:
>> Hi,
>>
>> 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
> devel at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel


-- 
Kees Bakker
Founder
SODAQ
M. 0031617737165
www.sodaq.com



More information about the devel mailing list