Skip to content

Changes required for ESP32 with Arduino IDE #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 62 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
f51a38c
Handle error codes in derived measurement functions
eric-wieser Nov 25, 2013
9abe6a3
Add files via upload
RobertRFenichel Oct 22, 2016
6f6c58d
Create IMU_Zero.ino
RobertRFenichel Oct 22, 2016
9ee8ffa
Merge pull request #1 from RobertRFenichel/RobertRFenichel-patch-1
RobertRFenichel Oct 22, 2016
0e4c037
Merge pull request #273 from RobertRFenichel/master
jrowberg Oct 23, 2016
c6f19a8
Delete IMU_Zero.ino
jrowberg Oct 23, 2016
86a454d
Add files via upload
RobertRFenichel Oct 25, 2016
0d0f8c6
Add files via upload
RobertRFenichel Oct 25, 2016
0939ca7
Merge pull request #274 from RobertRFenichel/master
jrowberg Oct 26, 2016
1f86a3c
Delete IMU_Zero.ino
jrowberg Oct 26, 2016
0129c52
Fixed typo in DS1307 implementation
jeremybarnes Nov 7, 2016
615f132
Merge pull request #275 from mldbai/DS1307-typo-fix
jrowberg Nov 7, 2016
1d6637f
Unknown function is actually setting start address
k1l1 Dec 2, 2016
32e1ca0
Update MPU6050_6Axis_MotionApps20.h
k1l1 Dec 4, 2016
5e6f3d6
Merge pull request #278 from k1l1/patch-1
jrowberg Dec 4, 2016
a0d2b1d
Update IMU_Zero.ino
RobertRFenichel Dec 5, 2016
2f29979
Merge pull request #280 from RobertRFenichel/patch-1
jrowberg Dec 5, 2016
c84fb86
Merge pull request #52 from eric-wieser/patch-1
jrowberg Jan 6, 2017
a06bf1b
Fixed wrong type of variable
Feb 16, 2017
0a027b4
Merge pull request #294 from MatixYo/patch-1
jrowberg Feb 16, 2017
ecb4fbc
init commit
Daichou Feb 19, 2017
65c945d
updated readme
Daichou Feb 19, 2017
912eda7
create lib project,porting readbytes
Daichou Feb 19, 2017
b45cf79
updated I2Cdev_writeWords and I2Cdev_writeBytes
Daichou Feb 19, 2017
cde3972
add Example,but not finish
Daichou Mar 15, 2017
2782a6c
Entering fuse ROM access mode to read adjustment registers
Mar 25, 2017
d31a75c
Initial commit for stm32 support
kript0n Mar 28, 2017
ef9964f
Fixed changelog description
kript0n Mar 28, 2017
454b014
More descriptions
kript0n Mar 28, 2017
df92b18
Added comments to functions
kript0n Mar 28, 2017
43cf365
MPU6050 connection failed
Daichou Apr 4, 2017
86c4e0e
Fix I2C Read Sequence extra unused byte transmission error
Daichou Apr 4, 2017
a57b336
finished i2cdev for dsPIC30F without interrupt
Daichou Apr 26, 2017
9677566
coding style correct
Daichou Apr 26, 2017
9aa4762
Merge pull request #302 from Daichou/master
jrowberg Apr 26, 2017
0c9d8f9
Added polling for end of conversion bit. Updated example.
me21 May 29, 2017
c199e9f
Removed unnecessary float.
me21 Jun 1, 2017
312e173
Add pointer initialization in MPU6050.cpp
ryan-feeley Jul 10, 2017
712efe1
Added ESP32 esp-idf platform
Aug 28, 2017
70b0689
Merge pull request #324 from chegewara/master
jrowberg Aug 28, 2017
3b4c8bd
Fix typos in example sketches
per1234 Sep 10, 2017
0bae02b
Add support for ESP8266 and OSC
gdsports Sep 21, 2017
9a1ef6e
Merge pull request #318 from ryan-feeley/init-nullptr
jrowberg Sep 23, 2017
470bc2c
Merge pull request #299 from nameofuser1/master
jrowberg Sep 23, 2017
079bdcb
Merge pull request #298 from Suyash458/patch-6
jrowberg Sep 23, 2017
d4cdc4c
Merge pull request #327 from per1234/example-typos
jrowberg Sep 23, 2017
4105eb5
Merge pull request #313 from me21/master
jrowberg Sep 23, 2017
e0ac048
Merge pull request #328 from gdsports/esp8266
jrowberg Sep 23, 2017
e455e49
DS1307 Arduino library - build error caused by non const progmem fixed
Dec 12, 2017
35e7ec1
Merge pull request #344 from kohoutovice/master
jrowberg Dec 12, 2017
818dd7a
Fix bug in writeBytes method for nRF51
Feb 17, 2018
3dc9538
Merge pull request #360 from dingari/bugfix-nrf51-writebytes
jrowberg Feb 17, 2018
9e67902
Implement MPU6050::dmpGetGravity(int16_t *data, const uint8_t* packet);
jensh Apr 25, 2018
7ea8b7c
Merge pull request #374 from jensh/master
jrowberg Apr 25, 2018
6be1b56
Added Shuning (Steve) Bian's SBWire library as an option in I2Cdev.h/cpp
paynterf Aug 27, 2018
0657acf
Added Shuning (Steve) Bian's SBWire library as an option in I2Cdev.h/cpp
paynterf Aug 27, 2018
7bdd885
Merge branch 'master' of https://github.com/paynterf/i2cdevlib
paynterf Aug 27, 2018
ceba54a
Fix #341.
me21 Dec 1, 2017
c20f68e
Merge pull request #342 from me21/master
jrowberg Sep 12, 2018
6dd5e46
Merge pull request #392 from paynterf/master
jrowberg Sep 12, 2018
2e9042c
Merge pull request #354 from jrowberg/develop
jrowberg Sep 29, 2018
900b8f9
Define BUFFER_LENGTH if not already present
jrowberg Oct 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ PIC18/MPU6050/Examples/MPU6050_raw.X/dist/
PIC18/MPU6050/Examples/MPU6050_raw.X/nbproject/private/
PIC18/MPU6050/Examples/MPU6050_raw.X/build/
*~
/dsPIC30F/I2Cdev/I2CdevdsPic30F.X/nbproject/private/
/dsPIC30F/I2Cdev/I2CdevdsPic30F.X/dist/default/
/dsPIC30F/I2Cdev/testMCC.X/nbproject/private/
/dsPIC30F/MPU6050/Examples/MPU6050_example.X/nbproject/private/
/dsPIC30F/MPU6050/Examples/MPU6050_example.X/build/default/
/dsPIC30F/MPU6050/Examples/MPU6050_example.X/dist/default/
2 changes: 1 addition & 1 deletion Arduino/ADS1115/examples/ADS1115_single/ADS1115_single.ino
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void setup() {
// Slow things down so that we can see that the "poll for conversion" code works
adc0.setRate(ADS1115_RATE_8);

// Set the gain (PGA) +/- 6.144v
// Set the gain (PGA) +/- 6.144V
// Note that any analog input must be higher than –0.3V and less than VDD +0.3
adc0.setGain(ADS1115_PGA_6P144);
// ALERT/RDY pin will indicate when conversion is ready
Expand Down
18 changes: 17 additions & 1 deletion Arduino/AK8975/AK8975.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,35 +148,51 @@ void AK8975::disableI2C() {

// ASA* registers
void AK8975::getAdjustment(int8_t *x, int8_t *y, int8_t *z) {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
I2Cdev::readBytes(devAddr, AK8975_RA_ASAX, 3, buffer);
*x = buffer[0];
*y = buffer[1];
*z = buffer[2];
}
void AK8975::setAdjustment(int8_t x, int8_t y, int8_t z) {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
buffer[0] = x;
buffer[1] = y;
buffer[2] = z;
I2Cdev::writeBytes(devAddr, AK8975_RA_ASAX, 3, buffer);
}
uint8_t AK8975::getAdjustmentX() {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
I2Cdev::readByte(devAddr, AK8975_RA_ASAX, buffer);
return buffer[0];
}
void AK8975::setAdjustmentX(uint8_t x) {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
I2Cdev::writeByte(devAddr, AK8975_RA_ASAX, x);
}
uint8_t AK8975::getAdjustmentY() {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
I2Cdev::readByte(devAddr, AK8975_RA_ASAY, buffer);
return buffer[0];
}
void AK8975::setAdjustmentY(uint8_t y) {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
I2Cdev::writeByte(devAddr, AK8975_RA_ASAY, y);
}
uint8_t AK8975::getAdjustmentZ() {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
I2Cdev::readByte(devAddr, AK8975_RA_ASAZ, buffer);
return buffer[0];
}
void AK8975::setAdjustmentZ(uint8_t z) {
I2Cdev::writeByte(devAddr, AK8975_RA_CNTL, 0x0F); // Enter Fuse ROM access mode
delay(10);
I2Cdev::writeByte(devAddr, AK8975_RA_ASAZ, z);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void setup() {
Serial.println("Testing device connections...");
Serial.println(mag.testConnection() ? "AK8975 connection successful" : "AK8975 connection failed");

// configure Arduino LED for
// configure Arduino LED pin for output
pinMode(LED_PIN, OUTPUT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void setup() {
Serial.println("Testing device connections...");
Serial.println(mag.testConnection() ? "AK8975 connection successful" : "AK8975 connection failed");

// configure Arduino LED for
// configure Arduino LED pin for output
pinMode(LED_PIN, OUTPUT);
}

Expand Down
2 changes: 1 addition & 1 deletion Arduino/AK8975/examples/AK8975_raw/AK8975_raw.ino
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void setup() {
Serial.println("Testing device connections...");
Serial.println(mag.testConnection() ? "AK8975 connection successful" : "AK8975 connection failed");

// configure Arduino LED for
// configure Arduino LED pin for output
pinMode(LED_PIN, OUTPUT);
}

Expand Down
2 changes: 1 addition & 1 deletion Arduino/BMA150/examples/BMA150_raw/BMA150_raw.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void setup() {
Serial.println("Testing device connections...");
Serial.println(accel.testConnection() ? "BMA150 connection successful" : "BMA150 connection failed");

// configure Arduino LED for
// configure Arduino LED pin for output
pinMode(LED_PIN, OUTPUT);
}

Expand Down
11 changes: 9 additions & 2 deletions Arduino/BMP085/BMP085.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ THE SOFTWARE.
*/

#include "BMP085.h"
#include <math.h>

/**
* Default constructor, uses default I2C device address.
Expand Down Expand Up @@ -166,10 +167,14 @@ void BMP085::setControl(uint8_t value) {
/* measurement register methods */

uint16_t BMP085::getMeasurement2() {
// wait for end of conversion
while(getControl() & 0x20);
I2Cdev::readBytes(devAddr, BMP085_RA_MSB, 2, buffer);
return ((uint16_t)buffer[0] << 8) + buffer[1];
}
uint32_t BMP085::getMeasurement3() {
// wait for end of conversion
while(getControl() & 0x20);
I2Cdev::readBytes(devAddr, BMP085_RA_MSB, 3, buffer);
return ((uint32_t)buffer[0] << 16) + ((uint16_t)buffer[1] << 8) + buffer[2];
}
Expand Down Expand Up @@ -207,6 +212,7 @@ float BMP085::getTemperatureC() {
T = (B5 + 8) / 2^4
*/
int32_t ut = getRawTemperature();
if(ut == 0) return NAN;
int32_t x1 = ((ut - (int32_t)ac6) * (int32_t)ac5) >> 15;
int32_t x2 = ((int32_t)mc << 11) / (x1 + md);
b5 = x1 + x2;
Expand All @@ -222,7 +228,7 @@ uint32_t BMP085::getRawPressure() {
return 0; // wrong measurement mode for pressure request
}

float BMP085::getPressure() {
int32_t BMP085::getPressure() {
/*
Datasheet forumla
UP = raw pressure
Expand All @@ -244,6 +250,7 @@ float BMP085::getPressure() {
p = p + (X1 + X2 + 3791) / 2^4
*/
uint32_t up = getRawPressure();
if(up == 0) return NAN;
uint8_t oss = (measureMode & 0xC0) >> 6;
int32_t p;
int32_t b6 = b5 - 4000;
Expand All @@ -269,4 +276,4 @@ float BMP085::getPressure() {

float BMP085::getAltitude(float pressure, float seaLevelPressure) {
return 44330 * (1.0 - pow(pressure / seaLevelPressure, 0.1903));
}
}
2 changes: 1 addition & 1 deletion Arduino/BMP085/BMP085.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class BMP085 {
float getTemperatureC();
float getTemperatureF();
uint32_t getRawPressure();
float getPressure();
int32_t getPressure();
float getAltitude(float pressure, float seaLevelPressure=101325);

private:
Expand Down
8 changes: 1 addition & 7 deletions Arduino/BMP085/examples/BMP085_basic/BMP085_basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ BMP085 barometer;

float temperature;
float pressure;
float altitude;
int32_t lastMicros;
int32_t altitude;

#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;
Expand Down Expand Up @@ -77,16 +76,11 @@ void loop() {
// request temperature
barometer.setControl(BMP085_MODE_TEMPERATURE);

// wait appropriate time for conversion (4.5ms delay)
lastMicros = micros();
while (micros() - lastMicros < barometer.getMeasureDelayMicroseconds());

// read calibrated temperature value in degrees Celsius
temperature = barometer.getTemperatureC();

// request pressure (3x oversampling mode, high detail, 23.5ms delay)
barometer.setControl(BMP085_MODE_PRESSURE_3);
while (micros() - lastMicros < barometer.getMeasureDelayMicroseconds());

// read calibrated pressure value in Pascals (Pa)
pressure = barometer.getPressure();
Expand Down
4 changes: 2 additions & 2 deletions Arduino/DS1307/DS1307.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void DS1307::setDateTime24(uint16_t year, uint8_t month, uint8_t day, uint8_t ho
////////////////////////////////////////////////////////////////////////////////
// utility code, some of this could be exposed in the DateTime API if needed

static uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 };
static const uint8_t daysInMonth [] PROGMEM = { 31,28,31,30,31,30,31,31,30,31,30,31 };

// number of days since 2000/01/01, valid for 2001..2099
static uint16_t date2days(uint16_t y, uint8_t m, uint8_t d) {
Expand Down Expand Up @@ -435,7 +435,7 @@ void DS1307::setDateTime24(uint16_t year, uint8_t month, uint8_t day, uint8_t ho
yOff = conv2d(date + 9);
// Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
switch (date[0]) {
case 'J': m = date[1] == 'a' ? 1 : m = date[2] == 'n' ? 6 : 7; break;
case 'J': m = (date[1] == 'a' ? 1 : (date[2] == 'n' ? 6 : 7)); break;
case 'F': m = 2; break;
case 'A': m = date[2] == 'r' ? 4 : 8; break;
case 'M': m = date[2] == 'r' ? 3 : 5; break;
Expand Down
2 changes: 1 addition & 1 deletion Arduino/HMC5843/examples/HMC5843_raw/HMC5843_raw.ino
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void setup() {
Serial.println("Testing device connections...");
Serial.println(mag.testConnection() ? "HMC5843 connection successful" : "HMC5843 connection failed");

// configure Arduino LED for
// configure Arduino LED pin for output
pinMode(LED_PIN, OUTPUT);
}

Expand Down
2 changes: 1 addition & 1 deletion Arduino/HMC5883L/examples/HMC5883L_raw/HMC5883L_raw.ino
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void setup() {
Serial.println("Testing device connections...");
Serial.println(mag.testConnection() ? "HMC5883L connection successful" : "HMC5883L connection failed");

// configure Arduino LED for
// configure Arduino LED pin for output
pinMode(LED_PIN, OUTPUT);
}

Expand Down
45 changes: 28 additions & 17 deletions Arduino/I2Cdev/I2Cdev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ THE SOFTWARE.

#include "I2Cdev.h"

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE

#ifdef I2CDEV_IMPLEMENTATION_WARNINGS
#if ARDUINO < 100
Expand Down Expand Up @@ -87,6 +87,11 @@ THE SOFTWARE.

#endif

#ifndef BUFFER_LENGTH
// band-aid fix for platforms without Wire-defined BUFFER_LENGTH (removed from some official implementations)
#define BUFFER_LENGTH 32
#endif

/** Default constructor.
*/
I2Cdev::I2Cdev() {
Expand Down Expand Up @@ -217,15 +222,15 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
int8_t count = 0;
uint32_t t1 = millis();

#if (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE)
#if (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE)

#if (ARDUINO < 100)
// Arduino v00xx (before v1.0), Wire library

// I2C/TWI subsystem uses internal buffer that breaks with large data requests
// so if user requests more than BUFFER_LENGTH bytes, we have to do it in
// smaller chunks instead of all at once
for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
for (uint8_t k = 0; k < length; k += min((int)length, BUFFER_LENGTH)) {
Wire.beginTransmission(devAddr);
Wire.send(regAddr);
Wire.endTransmission();
Expand All @@ -249,7 +254,7 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
// I2C/TWI subsystem uses internal buffer that breaks with large data requests
// so if user requests more than BUFFER_LENGTH bytes, we have to do it in
// smaller chunks instead of all at once
for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
for (uint8_t k = 0; k < length; k += min((int)length, BUFFER_LENGTH)) {
Wire.beginTransmission(devAddr);
Wire.write(regAddr);
Wire.endTransmission();
Expand All @@ -273,7 +278,7 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
// I2C/TWI subsystem uses internal buffer that breaks with large data requests
// so if user requests more than BUFFER_LENGTH bytes, we have to do it in
// smaller chunks instead of all at once
for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
for (uint8_t k = 0; k < length; k += min((int)length, BUFFER_LENGTH)) {
Wire.beginTransmission(devAddr);
Wire.write(regAddr);
Wire.endTransmission();
Expand Down Expand Up @@ -337,7 +342,7 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
int8_t count = 0;
uint32_t t1 = millis();

#if (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE)
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE

#if (ARDUINO < 100)
// Arduino v00xx (before v1.0), Wire library
Expand Down Expand Up @@ -594,7 +599,8 @@ bool I2Cdev::writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_
#if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE)
Wire.beginTransmission(devAddr);
Wire.send((uint8_t) regAddr); // send address
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100)
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100 \
|| I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100)
Wire.beginTransmission(devAddr);
Wire.write((uint8_t) regAddr); // send address
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE)
Expand All @@ -608,16 +614,18 @@ bool I2Cdev::writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_
#endif
#if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE)
Wire.send((uint8_t) data[i]);
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100)
Wire.write((uint8_t) data[i]);
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100 \
|| I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100)
Wire.write((uint8_t) data[i]);
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE)
Fastwire::write((uint8_t) data[i]);
#endif
}
#if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE)
Wire.endTransmission();
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100)
status = Wire.endTransmission();
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100 \
|| I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100)
status = Wire.endTransmission();
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE)
Fastwire::stop();
//status = Fastwire::endTransmission();
Expand Down Expand Up @@ -649,8 +657,9 @@ bool I2Cdev::writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16
#if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE)
Wire.beginTransmission(devAddr);
Wire.send(regAddr); // send address
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100)
Wire.beginTransmission(devAddr);
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100 \
|| I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100)
Wire.beginTransmission(devAddr);
Wire.write(regAddr); // send address
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE)
Fastwire::beginTransmission(devAddr);
Expand All @@ -664,8 +673,9 @@ bool I2Cdev::writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16
#if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE)
Wire.send((uint8_t)(data[i] >> 8)); // send MSB
Wire.send((uint8_t)data[i++]); // send LSB
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100)
Wire.write((uint8_t)(data[i] >> 8)); // send MSB
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100 \
|| I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100)
Wire.write((uint8_t)(data[i] >> 8)); // send MSB
Wire.write((uint8_t)data[i++]); // send LSB
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE)
Fastwire::write((uint8_t)(data[i] >> 8)); // send MSB
Expand All @@ -675,8 +685,9 @@ bool I2Cdev::writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16
}
#if ((I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO < 100) || I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_NBWIRE)
Wire.endTransmission();
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100)
status = Wire.endTransmission();
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE && ARDUINO >= 100 \
|| I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE && ARDUINO >= 100)
status = Wire.endTransmission();
#elif (I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE)
Fastwire::stop();
//status = Fastwire::endTransmission();
Expand Down
5 changes: 5 additions & 0 deletions Arduino/I2Cdev/I2Cdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ THE SOFTWARE.
// -----------------------------------------------------------------------------
#ifndef I2CDEV_IMPLEMENTATION
#define I2CDEV_IMPLEMENTATION I2CDEV_ARDUINO_WIRE
//#define I2CDEV_IMPLEMENTATION I2CDEV_BUILTIN_SBWIRE
//#define I2CDEV_IMPLEMENTATION I2CDEV_BUILTIN_FASTWIRE
#endif // I2CDEV_IMPLEMENTATION

Expand All @@ -67,6 +68,7 @@ THE SOFTWARE.
// ^^^ NBWire implementation is still buggy w/some interrupts!
#define I2CDEV_BUILTIN_FASTWIRE 3 // FastWire object from Francesco Ferrara's project
#define I2CDEV_I2CMASTER_LIBRARY 4 // I2C object from DSSCircuits I2C-Master Library at https://github.com/DSSCircuits/I2C-Master-Library
#define I2CDEV_BUILTIN_SBWIRE 5 // I2C object from Shuning (Steve) Bian's SBWire Library at https://github.com/freespace/SBWire

// -----------------------------------------------------------------------------
// Arduino-style "Serial.print" debug constant (uncomment to enable)
Expand All @@ -85,6 +87,9 @@ THE SOFTWARE.
#if I2CDEV_IMPLEMENTATION == I2CDEV_I2CMASTER_LIBRARY
#include <I2C.h>
#endif
#if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_SBWIRE
#include "SBWire.h"
#endif
#endif

#ifdef SPARK
Expand Down
Loading