Skip to content
This repository was archived by the owner on May 17, 2019. It is now read-only.

Added accelerometer configuration methods #14

Closed
wants to merge 13 commits into from

Conversation

scottmudge
Copy link

@scottmudge scottmudge commented Apr 22, 2019

This code provides access to the accelerometer configuration, according to the specifications described by the BNO055 datasheet..

Changes:

New class members were added to keep track of the accelerometer configuration state (defaults are the defaults specified in the BNO055 datasheet), setter methods were added to provide access to the configuration parameters, and an internal/private method was added to send the accelerometer configuration state to the device (regardless of current operational mode -- the methods puts the IC into the configuration mode, updates the configuration, and sets it back to the previous operational mode). New constants/enums were also added to both provide a more accessible understanding of the parameter options, and also store the bits associated with said parameters.

The configuration upload/update method requires the IC be set to configuration mode, then sets the data page to page 0x01, followed by sending the packed configuration byte. Following this, the configuration page is set back to 0x00 (default), and the operational mode is returned to that stored by self._mode.

Limitations:

It may be my machine, but I cannot exceed an I2C update rate of ~260 Hz. This may be a limitation of the system more than the I2C interface implementation used by this library. The accelerometer configuration provides bandwidth/refresh-rates of up to ~1024 Hz (additionally 512, 256, and so on down to 8 Hz). The higher modes may be redundant on machines where the basal I2C rate is the limiting factor.

Other Changes:

I added the change at line 263 in order to prevent an exception being raised if the user calls any of the setter methods before the begin() method is called. For whatever reason, the default self._mode value is not set until the begin() method is called, though it really should be set in the __init__() method. The default value is the same specified by begin().

If these changes are acceptable, I can also add configuration methods for the gyroscope and other sensor modules as well.

@caternuson
Copy link
Contributor

Thanks for these updates. This library is being deprecated. Unfortunately this PR won't directly work in the new library. I have opened an issue there to reference your PR here:
adafruit/Adafruit_CircuitPython_BNO055#32

If you want to work up a new PR for that library, please do.

@caternuson caternuson closed this May 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants