Skip to content

Commit

Permalink
scanner example that does not abort, seems to still not be able to li…
Browse files Browse the repository at this point in the history
…st i2c devices correctly
  • Loading branch information
rac2030 committed Jun 16, 2018
1 parent ad76bc5 commit 17f0b4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"browse": {
"limitSymbolsToIncludedHeaders": false,
"path": [
"/home/rac/Arduino/hardware/espressif/esp32/cores/esp32"
"/home/rac/Arduino/hardware/espressif/esp32/cores/esp32",
"/home/rac/Arduino/hardware/espressif/esp32/libraries/Wire/src"
]
},
"intelliSenseMode": "clang-x64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,28 @@ void setup() {
// This is a list of all GPIOs, I excluded GPIs as they are not suitable for I2C AFAIK
// Those are the actual ESP32 pins
//uint8_t portArray[] = {23, 32, 33, 21, 25, 26, 27, 22, 19, 1, 3, 4, 2, 0, 5, 18, 14, 15, 13, 12};
// This array is just needed to display the friendly name from the NINA-W102 pinout
//This array is just needed to display the friendly name from the NINA-W102 pinout
//String portMap[] = {"IO1", "IO5", "IO7", "IO8", "IO16", "IO17", "IO18", "IO20", "IO21", "IO22" "IO23", "IO24", "IO25", "IO27", "IO28", "IO29", "IO31", "IO32", "IO35", "IO36" };
// Disbled ports as there where strange characters...
uint8_t portArray[] = {/**23, **//**32, 33, 21, 25, 26,**/ /**27, **//**22,**/ /**19, **//**1, 3, 4, 2,**/ 0, /**5, 18, 14, 15,**/ 13/**, 12 **/};
String portMap[] = {/**"IO1",**/ /**"IO5", "IO7", "IO8", "IO16", "IO17",**/ /**"IO18",**/ /**"IO20",**/ /**"IO21",**/ /**"IO22" "IO23", "IO24", "IO25", **/"IO27", /**"IO28", "IO29", "IO31", "IO32",**/ "IO35"/**, "IO36" **/ };
uint8_t portArray[] = {32, 33, 21, 25, 26, 27, 22, 4, 2, 0, 5, 18, 14, 15, 13, 12};
String portMap[] = {"IO5", "IO7", "IO8", "IO16", "IO17", "IO18", "IO20", "IO24", "IO25", "IO27", "IO28", "IO29", "IO31", "IO32", "IO35", "IO36" };

//uint8_t portArray[] = {35, 36};
//String portMap[] = {"IO35", "IO36"};

void scanPorts() {
for (uint8_t i = 0; i < sizeof(portArray); i++) {
for (uint8_t j = 0; j < sizeof(portArray); j++) {
if (i != j){
Serial.printf("Scanning (SDA : SCL) - %i : %i\n", portMap[i], portMap[j]);
Serial.print("Scanning (SDA : SCL) - ");
Serial.print(portMap[i]);
Serial.print(" : ");
Serial.println(portMap[j]);
//TODO maybe add speed evaluation?
Wire.begin(portArray[i], portArray[j], 100000 /** bus speed in Hz **/);
Wire.begin(portArray[i], portArray[j], 400000 /** bus speed in Hz **/);
delay(4000);
check_if_exist_I2C();

Wire.reset();
}
}
}
Expand Down

0 comments on commit 17f0b4d

Please sign in to comment.