[ https://issues.apache.org/jira/browse/MYNEWT-529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16048588#comment-16048588 ]
ASF subversion and git services commented on MYNEWT-529: -------------------------------------------------------- Commit 1839134dc34a9797d1f50733351e3d32a96fcea0 in incubator-mynewt-core's branch refs/heads/master from [~marko] [ https://gitbox.apache.org/repos/asf?p=incubator-mynewt-core.git;h=1839134 ] MYNEWT-529 - move i2c_scan to a separate package. > 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 > > 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)