Skip to content

Commit 99b3aec

Browse files
committed
Does not yet work
1 parent f7eaa88 commit 99b3aec

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/SparkFun_SCD30_Arduino_Library.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ SCD30::SCD30(void)
3333
}
3434

3535
//Initialize the Serial port
36+
#ifdef USE_TEENSY3_I2C_LIB
37+
bool SCD30::begin(i2c_t3 &wirePort, bool autoCalibrate)
38+
#else
3639
bool SCD30::begin(TwoWire &wirePort, bool autoCalibrate)
40+
#endif
3741
{
3842
_i2cPort = &wirePort; //Grab which port the user wants us to use
3943

src/SparkFun_SCD30_Arduino_Library.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@
2828
#ifndef __SparkFun_SCD30_ARDUINO_LIBARARY_H__
2929
#define __SparkFun_SCD30_ARDUINO_LIBARARY_H__
3030

31+
#define USE_TEENSY3_I2C_LIB
32+
3133
#include "Arduino.h"
34+
#ifdef USE_TEENSY3_I2C_LIB
35+
#include <i2c_t3.h>
36+
#else
3237
#include <Wire.h>
38+
#endif
3339

3440
//The default I2C address for the SCD30 is 0x61.
3541
#define SCD30_ADDRESS 0x61
@@ -52,8 +58,11 @@ class SCD30
5258
SCD30(void);
5359

5460
bool begin(bool autoCalibrate) { return begin(Wire, autoCalibrate); }
61+
#ifdef USE_TEENSY3_I2C_LIB
62+
bool begin(i2c_t3 &wirePort = Wire, bool autoCalibrate=true); //By default use Wire port
63+
#else
5564
bool begin(TwoWire &wirePort = Wire, bool autoCalibrate=true); //By default use Wire port
56-
65+
#endif
5766
bool beginMeasuring(uint16_t pressureOffset);
5867
bool beginMeasuring(void);
5968

@@ -85,8 +94,11 @@ class SCD30
8594

8695
private:
8796
//Variables
97+
#ifdef USE_TEENSY3_I2C_LIB
98+
i2c_t3 *_i2cPort; //The generic connection to user's chosen I2C hardware
99+
#else
88100
TwoWire *_i2cPort; //The generic connection to user's chosen I2C hardware
89-
101+
#endif
90102
//Global main datums
91103
float co2 = 0;
92104
float temperature = 0;

0 commit comments

Comments
 (0)