[riot-notifications] [RIOT-OS/RIOT] shell: Add command i2c_scan (#11240)

Marian Buschsieweke notifications at github.com
Fri Mar 22 18:00:23 CET 2019


### Contribution description
Adds a trivial shell program that scans for all slaves on an I2C bus by iterating all of the possible 127 I2C addresses and checking for the ACK of the device.

Example output with 2 I2C slaves add addresses `0x44`, `0x50`, and `0x76`:

```
> i2c_scan 0
Scanning I2C device 0...
Legend: no device = "-", device responded = "X", error = "E"
     0 1 2 3 4 5 6 7 8 9 a b c d e f
0x00 - - - - - - - - - - - - - - - -
0x10 - - - - - - - - - - - - - - - -
0x20 - - - - - - - - - - - - - - - -
0x30 - - - - - - - - - - - - - - - -
0x40 - - - - X - - - - - - - - - - -
0x50 X - - - - - - - - - - - - - - -
0x60 - - - - - - - - - - - - - - - -
0x70 - - - - - - X - - - - - - - - -
```


### Testing procedure
Grab a board with I2C support, connect one or more I2C devices to it and run `USEMODULE=i2c_scan make flash` for the application `examples/default`. Run `i2c_scan 0` (or `i2c_scan 1` etc.)

### Issues/PRs references
None
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11240

-- Commit Summary --

  * shell: Add command i2c_scan

-- File Changes --

    M makefiles/pseudomodules.inc.mk (1)
    M sys/Makefile.dep (4)
    M sys/shell/commands/Makefile (4)
    A sys/shell/commands/sc_i2c_scan.c (100)
    M sys/shell/commands/shell_commands.c (7)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11240.patch
https://github.com/RIOT-OS/RIOT/pull/11240.diff

-- 
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/11240
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190322/a8603f16/attachment.html>


More information about the notifications mailing list