Skip to content

Commit

Permalink
Fixed XL9555 examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Sep 28, 2023
1 parent 29e2199 commit 16b0df1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@
#include <time.h>
#include "ExtensionIOXL9555.hpp"

#define SENSOR_SDA 8
#define SENSOR_SCL 9
#define SENSOR_IRQ 3
#ifndef SENSOR_SDA
#define SENSOR_SDA 17
#endif

#ifndef SENSOR_SCL
#define SENSOR_SCL 18
#endif

#ifndef SENSOR_IRQ
#define SENSOR_IRQ -1
#endif

ExtensionIOXL9555 extIO;

Expand All @@ -54,10 +62,10 @@ void setup()
}

pinMode(SENSOR_IRQ, INPUT_PULLUP);
// Set PORT0 as input
extIO.configPort(ExtensionIOXL9555::PORT0, INPUT);
// Set PORT1 as input
extIO.configPort(ExtensionIOXL9555::PORT1, INPUT);
// Set PORT0 as input,mask = 0xFF = all pin input
extIO.configPort(ExtensionIOXL9555::PORT0, 0xFF);
// Set PORT1 as input,mask = 0xFF = all pin input
extIO.configPort(ExtensionIOXL9555::PORT1, 0xFF);
}

void loop()
Expand Down
22 changes: 15 additions & 7 deletions examples/XL9555_ExtensionIORead/XL9555_ExtensionIORead.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@
#include <time.h>
#include "ExtensionIOXL9555.hpp"

#define SENSOR_SDA 8
#define SENSOR_SCL 9
#define SENSOR_IRQ 3
#ifndef SENSOR_SDA
#define SENSOR_SDA 17
#endif

#ifndef SENSOR_SCL
#define SENSOR_SCL 18
#endif

#ifndef SENSOR_IRQ
#define SENSOR_IRQ -1
#endif

ExtensionIOXL9555 extIO;

Expand All @@ -54,10 +62,10 @@ void setup()
}

pinMode(SENSOR_IRQ, INPUT_PULLUP);
// Set PORT0 as input
extIO.configPort(ExtensionIOXL9555::PORT0, INPUT);
// Set PORT1 as input
extIO.configPort(ExtensionIOXL9555::PORT1, INPUT);
// Set PORT0 as input,mask = 0xFF = all pin input
extIO.configPort(ExtensionIOXL9555::PORT0, 0xFF);
// Set PORT1 as input,mask = 0xFF = all pin input
extIO.configPort(ExtensionIOXL9555::PORT1, 0xFF);
}

void loop()
Expand Down
22 changes: 15 additions & 7 deletions examples/XL9555_ExtensionIOWirte/XL9555_ExtensionIOWirte.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@
#include <time.h>
#include "ExtensionIOXL9555.hpp"

#define SENSOR_SDA 8
#define SENSOR_SCL 9
#define SENSOR_IRQ 3
#ifndef SENSOR_SDA
#define SENSOR_SDA 17
#endif

#ifndef SENSOR_SCL
#define SENSOR_SCL 18
#endif

#ifndef SENSOR_IRQ
#define SENSOR_IRQ -1
#endif

ExtensionIOXL9555 extIO;

Expand All @@ -53,10 +61,10 @@ void setup()
delay(1000);
}
}
// Set PORT0 as output
extIO.configPort(ExtensionIOXL9555::PORT0, OUTPUT);
// Set PORT1 as output
extIO.configPort(ExtensionIOXL9555::PORT1, OUTPUT);
// Set PORT0 as output ,mask = 0x00 = all pin output
extIO.configPort(ExtensionIOXL9555::PORT0, 0x00);
// Set PORT1 as output ,mask = 0x00 = all pin output
extIO.configPort(ExtensionIOXL9555::PORT1, 0x00);
}

void loop()
Expand Down

0 comments on commit 16b0df1

Please sign in to comment.