This repository was archived by the owner on May 17, 2019. It is now read-only.
Added accelerometer configuration methods #14
Closed
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 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 defaultself._mode
value is not set until thebegin()
method is called, though it really should be set in the__init__()
method. The default value is the same specified bybegin()
.If these changes are acceptable, I can also add configuration methods for the gyroscope and other sensor modules as well.