diff --git a/examples/example1_basic_readings/example1_basic_readings.ino b/examples/example1_basic_readings/example1_basic_readings.ino index 5808951..7f02342 100644 --- a/examples/example1_basic_readings/example1_basic_readings.ino +++ b/examples/example1_basic_readings/example1_basic_readings.ino @@ -65,6 +65,10 @@ void setup() if( kxAccel.softwareReset() ) Serial.println("Reset."); + //Give some time for the accelerometer to reset. + //It needs two, but give it five for good measure. + delay(5); + // Many settings for KX13X can only be // applied when the accelerometer is powered down. // However there are many that can be changed "on-the-fly" @@ -80,6 +84,7 @@ void setup() kxAccel.enableAccel(); + } void loop() diff --git a/examples/example2_interrupts/example2_interrupts.ino b/examples/example2_interrupts/example2_interrupts.ino index 7b7dff6..982e847 100644 --- a/examples/example2_interrupts/example2_interrupts.ino +++ b/examples/example2_interrupts/example2_interrupts.ino @@ -3,15 +3,17 @@ This example shows how to route the data ready bit to either physical interrupt pin one and pin two. - Please refer to the header file for more possible settings, found here: - ..\SparkFun_KX13X_Arduino_Library\src\sfe_kx13x_defs.h - Written by Elias Santistevan @ SparkFun Electronics, October 2022 - Product: + Products: + SparkFun Triple Axis Accelerometer Breakout - KX132: https://www.sparkfun.com/products/17871 + SparkFun Triple Axis Accelerometer Breakout - KX134: + https://www.sparkfun.com/products/17589 + + Repository: https://github.com/sparkfun/SparkFun_KX13X_Arduino_Library @@ -55,6 +57,10 @@ void setup() if( kxAccel.softwareReset() ) Serial.println("Reset."); + //Give some time for the accelerometer to reset. + //It needs two, but give it five for good measure. + delay(5); + // Many settings for KX13X can only be // applied when the accelerometer is powered down. // However there are many that can be changed "on-the-fly" diff --git a/examples/example3_buffer/example3_buffer.ino b/examples/example3_buffer/example3_buffer.ino index 6e54d9f..e954b37 100644 --- a/examples/example3_buffer/example3_buffer.ino +++ b/examples/example3_buffer/example3_buffer.ino @@ -57,6 +57,10 @@ void setup() if( kxAccel.softwareReset() ) Serial.println("Reset."); + //Give some time for the accelerometer to reset. + //It needs two, but give it five for good measure. + delay(5); + // Many settings for KX13X can only be // applied when the accelerometer is powered down. // However there are many that can be changed "on-the-fly" diff --git a/examples/example4_tap/example4_tap.ino b/examples/example4_tap/example4_tap.ino index f340169..7ad9920 100644 --- a/examples/example4_tap/example4_tap.ino +++ b/examples/example4_tap/example4_tap.ino @@ -55,6 +55,10 @@ void setup() if( kxAccel.softwareReset() ) Serial.println("Reset."); + //Give some time for the accelerometer to reset. + //It needs two, but give it five for good measure. + delay(5); + // Many settings for KX13X can only be // applied when the accelerometer is powered down. // However there are many that can be changed "on-the-fly" diff --git a/examples/example5_spi/example5_spi.ino b/examples/example5_spi/example5_spi.ino index fdb7797..c0ac2f4 100644 --- a/examples/example5_spi/example5_spi.ino +++ b/examples/example5_spi/example5_spi.ino @@ -58,6 +58,10 @@ void setup() if( kxAccel.softwareReset() ) Serial.println("Reset."); + //Give some time for the accelerometer to reset. + //It needs two, but give it five for good measure. + delay(5); + // Many settings for KX13X can only be // applied when the accelerometer is powered down. // However there are many that can be changed "on-the-fly" diff --git a/library.properties b/library.properties index 281449d..5ab1b87 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun KX13X Arduino Library -version=2.0.1 +version=2.0.2 author=SparkFun Electronics maintainer=Elias Santistevan @ SparkFun Electronics sentence=Communicates and configures the SparkFun KX132/KX134 Accelerometer. diff --git a/src/SparkFun_Qwiic_KX13X.cpp b/src/SparkFun_Qwiic_KX13X.cpp index 6f2cbc7..47d6c92 100644 --- a/src/SparkFun_Qwiic_KX13X.cpp +++ b/src/SparkFun_Qwiic_KX13X.cpp @@ -119,7 +119,7 @@ bool QwDevKX13X::enableAccel(bool enable) int retVal; retVal = readRegisterRegion(SFE_KX13X_CNTL1, &tempVal, 1); - + if( retVal != 0 ) return false; @@ -205,6 +205,7 @@ bool QwDevKX13X::enableDataEngine(bool enable) if( retVal != 0 ) return false; + return true; } diff --git a/src/sfe_bus.cpp b/src/sfe_bus.cpp index f205aef..32b1aca 100644 --- a/src/sfe_bus.cpp +++ b/src/sfe_bus.cpp @@ -192,7 +192,7 @@ int QwI2C::readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t for (i = 0; i < nReturned; i++){ *data++ = _i2cPort->read(); } - + // Decrement the amount of data recieved from the overall data request amount numBytes = numBytes - nReturned;