Skip to content

Commit

Permalink
Use new I2C function
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthbdn authored and nedseb committed May 13, 2024
1 parent d020bfc commit 4629659
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions samples/Basic/ScannerI2C/ScannerI2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ void ScannerI2C(codal::STM32STEAM32_WB55RG& steam32)
for (uint16_t m = 0; m < 0x100; m += 0x10) {
printf("%2X ", m);
for (uint8_t l = 0; l < 0x10; l++) {
i2c.beginTransmission(m | l);
i2c.write(0);
i2c.write(0);
auto result = i2c.endTransmission();
uint8_t addr = m | l;

if (result == i2c_status_e::I2C_OK) {
printf(" %2X ", m | l);
if ((addr & 0x01) == 0 && i2c.isDeviceAvailable(addr)) {
printf(" %2X ", addr);
}
else {
printf(" -- ");
Expand Down

0 comments on commit 4629659

Please sign in to comment.