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 FIFO, gyroscrope calibration support #14

Closed
wants to merge 11 commits into from

Conversation

kaiiorg
Copy link

@kaiiorg kaiiorg commented Jun 21, 2020

I got a little carried away while I was working on this:

FIFO Support (Issue #5):

Added methods to allow enable, disable, and reset of FIFO control registers. Allows reading of FIFO length from status registers and read accelerometer/gyroscope data out of the FIFO output registers. At the current 104Hz setting for both the accelerometer/gyroscope, the FIFO fills up in about 5 seconds.

The fifoRead() method takes a 2D array that is currently set to be 6 floats wide and has to read from two registers (LSM6DS3_FIFO_STATUS3 and LSM6DS3_FIFO_STATUS4) to know what position in the current sample the next value in two registers (LSM6DS3_FIFO_DATA_OUT_L and LSM6DS3_FIFO_DATA_OUT_H) is supposed to be, then reads those registers to get the data. Any changes to the ODR of anything will probably break this.

Probably should look into some dynamic way of tracking what's supposed to go into the FIFO based on other register settings to help know what we're actually reading, but I'm not ready to stare that far into the abyss.

Addressing Issue #13:

Removes the code that mistakenly sets an invalid bit to 1. Added enum to allow selection of low pass, high pass, and slope filters (or none of those).

Addressing Issue #2:

Adds gyroscope calibration method along with set and get methods to persist and restore of those values. If the method isn't called, the gyroscope is read normally and not adjusted.

Other changes:

  • Reset the chip in begin() because (in my experience) the reset button on the Nano IoT doesn't reset the chip!
  • Remove a writeRegister() call that was setting LSM6DS3_CTRL7_G to 0x00, even though that's the default value of that register
  • Minor changes to a few comments when configuring accelerometer and gyroscope ODRs to match what they're actually doing according to the datasheet.

@kaiiorg
Copy link
Author

kaiiorg commented Jun 21, 2020

Looks like the Compile Examples build check fails because it can't find the arduino:megaavr:uno2018 core:

Running command: /github/home/bin/arduino-cli core install arduino:megaavr:uno2018 
   Invalid argument passed: invalid item arduino:megaavr:uno2018

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@LazaroFilm
Copy link

Any updates on this?

@kaiiorg kaiiorg closed this Nov 15, 2024
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.

3 participants