Skip to content

Commit

Permalink
Adds delay to all examples after software reset, rolls version
Browse files Browse the repository at this point in the history
  • Loading branch information
edspark committed Jan 11, 2023
1 parent 2096441 commit 3b4b66b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 7 deletions.
5 changes: 5 additions & 0 deletions examples/example1_basic_readings/example1_basic_readings.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -80,6 +84,7 @@ void setup()
kxAccel.enableAccel();



}

void loop()
Expand Down
14 changes: 10 additions & 4 deletions examples/example2_interrupts/example2_interrupts.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions examples/example3_buffer/example3_buffer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions examples/example4_tap/example4_tap.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions examples/example5_spi/example5_spi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun KX13X Arduino Library
version=2.0.1
version=2.0.2
author=SparkFun Electronics <[email protected]>
maintainer=Elias Santistevan @ SparkFun Electronics
sentence=Communicates and configures the SparkFun KX132/KX134 Accelerometer.
Expand Down
3 changes: 2 additions & 1 deletion src/SparkFun_Qwiic_KX13X.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool QwDevKX13X::enableAccel(bool enable)
int retVal;

retVal = readRegisterRegion(SFE_KX13X_CNTL1, &tempVal, 1);

if( retVal != 0 )
return false;

Expand Down Expand Up @@ -205,6 +205,7 @@ bool QwDevKX13X::enableDataEngine(bool enable)
if( retVal != 0 )
return false;


return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/sfe_bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 3b4b66b

Please sign in to comment.