Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed implementation for device scanning #14

Closed
wants to merge 2 commits into from
Closed

Proposed implementation for device scanning #14

wants to merge 2 commits into from

Conversation

mattborja
Copy link

A rather basic implementation to scan for a specific device address.

This was tested against a AT24C256C breakout board where all I2C pins except VCC were wired (onboard LED was emitting, but visibly underpowered) using the following snippet:

#define XEEPROM_ADDR 0x50

void xEEPROM_demo() {
  // I2c.timeOut(10000);

  Serial.println("Checking wire status...");

  I2c.begin();
  bool found = I2c.scanFor(XEEPROM_ADDR);
  I2c.end();

  Serial.println(found ? "WIRE_OK" : "WIRE_TIMEOUT");
}

Wire check also returned extremely fast, way under timeout value that was originally under test. Seems doing this form of preliminary device checking before attempting to read/write might even be preferred in real applications vs. the timeout people have been calling for for a while now (i.e. arduino/ArduinoCore-avr#42).

@mattborja
Copy link
Author

It appears Wire.setWireTimeout() now covers my use case, so I'm going to close this out as I'm switching back to native libraries.

@mattborja mattborja closed this Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant