Skip to content

Commit d8c6cc8

Browse files
author
noah-jonathan rosa
committed
Modified I2C define conditions in order to allow further implementation
1 parent 7f911da commit d8c6cc8

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

examples/X_NUCLEO_GNSS1A1_HelloWorld_I2C/X_NUCLEO_GNSS1A1_HelloWorld_I2C.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,24 @@ int waitType = 0;
5858
#define waitForRequest 0
5959
#define waitForAnswer 1
6060

61-
TwoWire *devI2C;
61+
#ifdef ARDUINO_SAM_DUE
62+
#define DEV_I2C Wire1
63+
#endif
6264

65+
#ifdef ARDUINO_ARCH_STM32
66+
#define DEV_I2C Wire
67+
#endif
6368

6469

6570
void setup()
6671
{
6772
//Initialize serial port for user communication
68-
#ifdef ARDUINO_SAM_DUE
69-
devI2C = &Wire1;
70-
#else
71-
devI2C = &Wire;
72-
#endif
7373
Serial.begin(115200);
7474
Serial.println("Setup begin");
7575
//Initialize the i2c communication
76-
devI2C->begin();
76+
DEV_I2C.begin();
7777
//Create the device object passing to it the i2c interface
78-
gps = new TeseoLIV3F(devI2C, 7, 13);
78+
gps = new TeseoLIV3F(&DEV_I2C, 7, 13);
7979
//Initialize the device
8080
gps->init();
8181
Serial.println("Setup end");

0 commit comments

Comments
 (0)