Skip to content

Commit 57e325c

Browse files
committed
Add support for the accelerometer on GIGA R1
1 parent 5dbb4a9 commit 57e325c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/Arduino_SensorKit.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_UNOR4_WIFI)
44
#define _PIN_SDA SDA
55
#define _PIN_SCL SCL
6+
#define _WIRE Wire
67
#elif defined(ARDUINO_GIGA)
78
#define _PIN_SDA I2C_SDA1
89
#define _PIN_SCL I2C_SCL1
10+
#define _WIRE Wire1
911
#else
1012
#error "This board is not supported by Arduino_SensorKit"
1113
#endif
@@ -15,5 +17,5 @@ U8X8_SSD1306_128X64_NONAME_SW_I2C Oled_SW(_PIN_SCL, _PIN_SDA, U8X8_PIN_NONE);
1517
U8X8_SSD1306_128X64_NONAME_HW_I2C Oled_HW(U8X8_PIN_NONE, _PIN_SCL, _PIN_SDA);
1618
SensorKit_DHT Environment(3,DHT11);
1719
DHT Environment_I2C(DHT20);
18-
SensorKit_LIS3DHTR Accelerometer;
20+
SensorKit_LIS3DHTR Accelerometer(_WIRE);
1921
SensorKit_BMP280 Pressure;

src/Arduino_SensorKit_LIS3DHTR.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include "Arduino_SensorKit_LIS3DHTR.h"
22

3-
SensorKit_LIS3DHTR::SensorKit_LIS3DHTR(){}
4-
53
bool SensorKit_LIS3DHTR::begin(){
6-
LIS.begin(Wire, 0x19);
4+
LIS.begin(*_wire, 0x19);
75
delay(100);
86
LIS.openTemp();
97
LIS.setOutputDataRate(LIS3DHTR_DATARATE_50HZ);

src/Arduino_SensorKit_LIS3DHTR.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class SensorKit_LIS3DHTR{
99
LIS3DHTR<TwoWire> LIS;
1010

1111
public:
12-
SensorKit_LIS3DHTR();
12+
SensorKit_LIS3DHTR(TwoWire& w) : _wire(&w) {};
1313
bool begin();
1414

1515
bool available();
@@ -18,6 +18,8 @@ class SensorKit_LIS3DHTR{
1818
float readZ();
1919

2020
void setOutputDataRate(odr_type_t odr);
21+
private:
22+
TwoWire* _wire;
2123
};
2224

2325
#endif

0 commit comments

Comments
 (0)