[
https://issues.apache.org/jira/browse/MYNEWT-529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marko Kiiskila resolved MYNEWT-529.
-----------------------------------
Resolution: Fixed
Now available as separate package test/i2c_scan
> i2c bus scanner
> ---------------
>
> Key: MYNEWT-529
> URL: https://issues.apache.org/jira/browse/MYNEWT-529
> Project: Mynewt
> Issue Type: New Feature
> Security Level: Public(Viewable by anyone)
> Components: HAL
> Reporter: Marko Kiiskila
> Assignee: Marko Kiiskila
> Priority: Minor
> Fix For: v1_1_0_rel
>
>
> Bring in Kevin's i2c bus scanner, probably in form of separate package.
> test/i2c_tools maybe?
> static int
> shell_i2cscan_cmd(int argc, char **argv)
> {
> uint8_t addr;
> int32_t timeout = OS_TICKS_PER_SEC / 10;
> uint8_t dev_count = 0;
> console_printf("Scanning I2C bus 0\n"
> " 0 1 2 3 4 5 6 7 8 9 a b c d e f\n"
> "00: ");
> /* Scan all valid I2C addresses (0x03..0x77) */
> for (addr = 0x08; addr < 0x78; addr++) {
> int rc = hal_i2c_master_probe(0, addr, timeout);
> /* Print addr header every 16 bytes */
> if (!(addr % 16)) {
> console_printf("\n%02x: ", addr);
> }
> /* Display the addr if a response was received */
> if (!rc) {
> console_printf("%02x ", addr);
> dev_count++;
> } else {
> console_printf("-- ");
> }
> }
> console_printf("\nFound %u devices on I2C bus 0\n", dev_count);
> return 0;
> }
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)