Skip to content

Commit 24a42d5

Browse files
Bob Hamlewispg228
authored andcommitted
Give _int_pin and _reset_pin sane default values
Assign sane default values to _int_pin and _reset_pin. Otherwise they get assigned zero and all the "if (_int_pin == -1)" checks fail and bad things happen.
1 parent ffe867a commit 24a42d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/SparkFun_BNO08x_Arduino_Library.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
#include "SparkFun_BNO08x_Arduino_Library.h"
4444

45-
int8_t _int_pin, _reset_pin;
45+
int8_t _int_pin = -1, _reset_pin = -1;
4646
static TwoWire *_i2cPort = NULL; //The generic connection to user's chosen I2C hardware
4747
static SPIClass *_spiPort = NULL; //The generic connection to user's chosen SPI hardware
4848
static uint8_t _deviceAddress = BNO08x_DEFAULT_ADDRESS; //Keeps track of I2C address. setI2CAddress changes this.
@@ -1653,4 +1653,4 @@ static bool spi_write(const uint8_t *buffer, size_t len,
16531653
_spiPort->endTransaction();
16541654

16551655
return true;
1656-
}
1656+
}

0 commit comments

Comments
 (0)