[riot-notifications] [RIOT-OS/RIOT] periph/i2c: handle i2c registers in both little and big endian (#11585)

MrKevinWeiss notifications at github.com
Tue May 28 17:09:38 CEST 2019


Device | 8 bit reg | 16 big | 16 little |
-|-|-|-
M24C64||x|
24AA512||x|
ADS1015|x||

_feel free to add if you evaluate, I just need one little endian_

The ADS1015 and the [device dependant](https://www.raspberrypi.org/forums/viewtopic.php?t=122923) statement was not what we mean by register, register to us is the address pointer in this case (which for this device is actually only two bits) the size of the control register (register address 0x01) is 16 bits but that just means that one would have to write two bytes 
`i2c_write_regs 0x68 0x01 0x00 0x12 0x34`
`i2c_write_regs <dev_addr> <reg> <flag> [data0 data1]`

When we are talking about read and write registers we need to be clear what that means
First it is only a helper function that sits on top of the i2c spec
Second, in many but not all cases it can be achieved through basic calls (some issues in the stm devices since flags need to be set before completion and everything is blocking...)
Third, what we mean by read register is
`start_bit-address-write_bit-ack-reg-ack-[optional second byte for reg]-ack-[stop_bit]-start_bit-address-read_bit-ack-slave_data-ack-[slave_data_n]-stop_bit`
and for write it should be
`start_bit-address-write_bit-ack-reg-ack-[optional second byte for reg]-ack-master_data-ack-[master_data_n]-nack-stop_bit`
probably a better way to say this info.

Also sorry I didn't chime in when the issue was raised.  Either someone fine a single device that would need read_reg or just do big endian (which should be simple and less code size).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11585#issuecomment-496558702
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190528/82d64220/attachment.html>


More information about the notifications mailing list