Implemented multi-interrupt channel support #64
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.
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#L1004The 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 toBMI160_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):
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.