Skip to content

Commit a338f8b

Browse files
authored
Merge pull request #4 from NoahRosa/master
Added Arduino Due compatibility
2 parents bf7446d + d8c6cc8 commit a338f8b

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

examples/X_NUCLEO_GNSS1A1_HelloWorld_I2C/X_NUCLEO_GNSS1A1_HelloWorld_I2C.ino

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

61+
#ifdef ARDUINO_SAM_DUE
62+
#define DEV_I2C Wire1
63+
#endif
64+
65+
#ifdef ARDUINO_ARCH_STM32
66+
#define DEV_I2C Wire
67+
#endif
68+
69+
6170
void setup()
6271
{
6372
//Initialize serial port for user communication
6473
Serial.begin(115200);
6574
Serial.println("Setup begin");
6675
//Initialize the i2c communication
67-
Wire.begin();
76+
DEV_I2C.begin();
6877
//Create the device object passing to it the i2c interface
69-
gps = new TeseoLIV3F(&Wire, 7, 13);
78+
gps = new TeseoLIV3F(&DEV_I2C, 7, 13);
7079
//Initialize the device
7180
gps->init();
7281
Serial.println("Setup end");

examples/X_NUCLEO_GNSS1A1_HelloWorld_UART/X_NUCLEO_GNSS1A1_HelloWorld_UART.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
******************************************************************************
3939
*/
4040

41+
//NOTE: for compatibility with the Arduino Due some additional cabling needs to be performed:
42+
// pin D8 should be connected to pin D18 and pin D2 should be connected to pin D19
43+
4144
#include "teseo_liv3f_class.h"
4245

4346
TeseoLIV3F *gps;
@@ -52,7 +55,10 @@ GPGGA_Info_t stored_positions[64];
5255
int status = 0;
5356
int stime = 0;
5457
int waitType = 0;
58+
59+
#ifdef ARDUINO_ARCH_STM32
5560
HardwareSerial Serial1(PA10, PA9);
61+
#endif
5662

5763
#define MSG_SZ 256
5864
#define waitForRequest 0

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ sentence=Allows controlling the X-NUCLEO-GNSS1A1 (GNSS expansion board based on
66
paragraph=This library provides a command line interface to communicate with the GNSS module via UART or I2C.
77
category=Device Control
88
url=https://github.com/stm32duino/X-NUCLEO-GNSS1A1
9-
architectures=stm32
9+
architectures=stm32, sam

0 commit comments

Comments
 (0)