Commit Graph

2 Commits

Author SHA1 Message Date
Gregory Nutt
69022c9f2b apps/system/i2c: Fix up some complaints from nxstyle. 2019-10-15 06:30:57 +08:00
David Alessio
720b854da2 Merged in david_alessio/apps/feature/i2c-multiple-read (pull request #201)
Feature/i2c dump

* friendlier I2C "knock-knock" uses only read request

    While many I2C slave devices have multiple indexed registers, some have
    only one register and it's not indexed.  For example, the I2C bus switch
    TCA9548A has only a Control Register, attempting to index to "Reg[0]"
    alters its contents to 0x00 disabling all subordinate buses.  This patch
    fixes that problem by simply trying to read something/anything from the
    slave.  This also helps coax out slaves with register files that start
    from a higher index, i.e. the AT24CS0x, FLASH chips with a UUID that
    appears as a 2nd I2C slave at (address+8), report their serial number at
    Reg[80]-Reg[8F] and will NAK a read of Reg[0].

* modify get/set to prevent write of reg index if not specifed

* add 'dump' command to issue a single transaction

    to retrieve multiple bytes from an I2C slave and register/offset.

* use NuttX' isprint()

* refactor to reduce coupling, hexdump only needs outstream

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-10-14 22:13:28 +00:00