Skip to content
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

Add Low Power / Normal / High Resolution modes, along with frequency constructor argument #50

Merged
merged 7 commits into from
Jul 16, 2024

Conversation

tyeth
Copy link
Contributor

@tyeth tyeth commented Jul 1, 2024

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.
image

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).

tyeth added 6 commits June 27, 2024 12:10
Resolves issue #14 by adding additional operational modes and adjusting read method.
Original issue "LIS3DH_DATARATE_LOWPOWER_5KHZ mode is not setting the accelerometer in 5kHz low power mode but in 1.344 kHz High resolution mode "
Fixes #14
@tyeth tyeth requested review from ladyada and caternuson July 1, 2024 15:04
Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best to get someone to test also!

@tyeth tyeth merged commit 7267611 into master Jul 16, 2024
2 checks passed
@tyeth tyeth deleted the tyeth/issue14 branch July 16, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants