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

Implemented multi-interrupt channel support #64

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

peakBreaker
Copy link

Was stuck for a while during development for the BMI160 sensor due to using the BMI160_INT_CHANNEL_BOTH define which can be found in: https://github.com/BoschSensortec/BMI160_driver/blob/44f0df94d6b000a821afd7ed31c432bc677cd723/bmi160_defs.h#L1004

The define is there, however when configuring the sensor, the code for configuring both interrupt channels is lacking in the driver library. Since the current library implementation defaults to configuring interrupt channel 2 for every value other than BMI160_INT_CHANNEL_1, it will configure interrupt channel 2 - not both - when setting int_channel to BMI160_INT_CHANNEL_BOTH. This is very misleading.

This PR implements support for both interrupt channels for the sensor, and it implements a guard statement to return an error code in case an invalid configuration is provided instead of defaulting to interrupt channel 2.

After testing my fork of the library with these changes on our device I get the following value in the INT_OUT_CTRL register (0x53):

BMI160_INT_OUT_CTRL_ADDR  (0x53) :: 0x88

This means that the output enable for both interrupt channel 1 and 2 is set to enabled. For more details on this, see the BMI160 datasheet on page 63.

Anders L. Hurum added 4 commits June 12, 2018 15:00
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.

1 participant