Add Low Power / Normal / High Resolution modes, along with frequency constructor argument #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the option to switch down to low power mode (8bit),

lis.setPerformanceMode(LIS3DH_MODE_LOW_POWER);
which then gives you the higher frequency values for any that have different data rates between high-resolution/normal and low power modes, i.e. allowing 5.3kHz data rate.Tested using 2MHz SPI instead of the default 500kHz, via an extra constructor argument added for frequency. I switched through each of the Performance modes (Low Power / Normal / High Resolution) at the fastest data rate (LP_5K = ~5.3/1.3khz - plus a couple of other rates), along with each of the force sensitivity modes (2G/4G/8G/16G) and checked each axis approximated +/-gravity when correctly rotated.
It was in a loop with 5 prints for each combination (allowing 3 axis measurements and two mistakes) and 3seconds between prints, so I missed one or two out of the many axis measurements, but always got at least one axis measuring approximately gravity per combination
Likely I made a mistake as I'm new to these accelerometers and not the king of bit shifters, but think it's alright. Either way would really appreciate some user testing so please take a look / have a go.
The acceldemo.ino has been updated to print the performance mode (along with the set example commmented out).