From 24a42d558e72bae8a496e92edb8ebcaa215fc2d2 Mon Sep 17 00:00:00 2001 From: Bob Ham Date: Tue, 28 Nov 2023 20:07:09 +0000 Subject: [PATCH] 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. --- src/SparkFun_BNO08x_Arduino_Library.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SparkFun_BNO08x_Arduino_Library.cpp b/src/SparkFun_BNO08x_Arduino_Library.cpp index d6b6419..6db1380 100644 --- a/src/SparkFun_BNO08x_Arduino_Library.cpp +++ b/src/SparkFun_BNO08x_Arduino_Library.cpp @@ -42,7 +42,7 @@ #include "SparkFun_BNO08x_Arduino_Library.h" -int8_t _int_pin, _reset_pin; +int8_t _int_pin = -1, _reset_pin = -1; static TwoWire *_i2cPort = NULL; //The generic connection to user's chosen I2C hardware static SPIClass *_spiPort = NULL; //The generic connection to user's chosen SPI hardware 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, _spiPort->endTransaction(); return true; -} \ No newline at end of file +}