Skip to content

Easier code #10

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 6 additions & 4 deletions src/SparkFunLIS3DH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ status_t LIS3DHCore::readRegisterRegion(uint8_t *outputPointer , uint8_t offset,
//****************************************************************************//
status_t LIS3DHCore::readRegister(uint8_t* outputPointer, uint8_t offset) {
//Return value
uint8_t result;
uint8_t result=0;
uint8_t numBytes = 1;
status_t returnError = IMU_SUCCESS;

Expand Down Expand Up @@ -296,7 +296,7 @@ status_t LIS3DHCore::readRegisterInt16( int16_t* outputPointer, uint8_t offset )
{
{
//offset |= 0x80; //turn auto-increment bit on
uint8_t myBuffer[2];
uint8_t myBuffer[2] = {0,0};
status_t returnError = readRegisterRegion(myBuffer, offset, 2); //Does memory transfer
int16_t output = (int16_t)myBuffer[0] | int16_t(myBuffer[1] << 8);
*outputPointer = output;
Expand Down Expand Up @@ -390,12 +390,14 @@ LIS3DH::LIS3DH( uint8_t busType, uint8_t inputArg ) : LIS3DHCore( busType, input
// This starts the lower level begin, then applies settings
//
//****************************************************************************//
status_t LIS3DH::begin( void )
status_t LIS3DH::begin( bool applySettingsAtStart )
{
//Begin the inherited core. This gets the physical wires connected
status_t returnError = beginCore();

applySettings();
if (applySettingsAtStart) {
applySettings();
}

return returnError;
}
Expand Down
Loading