Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

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

1 participant