Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions bmi160.c
Original file line number Diff line number Diff line change
Expand Up @@ -4498,11 +4498,23 @@ static int8_t config_int_out_ctrl(const struct bmi160_int_settg *int_config, con
rslt = bmi160_get_regs(BMI160_INT_OUT_CTRL_ADDR, &data, 1, dev);

if (rslt == BMI160_OK) {

/* guard statement to ensure a valid pin channel is configured */
switch (int_config->int_channel) {
case BMI160_INT_CHANNEL_1:
case BMI160_INT_CHANNEL_2:
case BMI160_INT_CHANNEL_BOTH:
break;
default: // invalid pin channel
return BMI160_E_DEV_NOT_FOUND;
}

/* updating the interrupt pin structure to local structure */
const struct bmi160_int_pin_settg *intr_pin_sett = &(int_config->int_pin_settg);

/* Configuring channel 1 */
if (int_config->int_channel == BMI160_INT_CHANNEL_1) {
if ((int_config->int_channel == BMI160_INT_CHANNEL_1) ||
(int_config->int_channel == BMI160_INT_CHANNEL_BOTH)) {

/* Output enable */
temp = data & ~BMI160_INT1_OUTPUT_EN_MASK;
Expand All @@ -4519,9 +4531,12 @@ static int8_t config_int_out_ctrl(const struct bmi160_int_settg *int_config, con
/* edge control */
temp = data & ~BMI160_INT1_EDGE_CTRL_MASK;
data = temp | ((intr_pin_sett->edge_ctrl) & BMI160_INT1_EDGE_CTRL_MASK);
}

/* Configuring channel 2 */
if ((int_config->int_channel == BMI160_INT_CHANNEL_2) ||
(int_config->int_channel == BMI160_INT_CHANNEL_BOTH)) {

} else {
/* Configuring channel 2 */
/* Output enable */
temp = data & ~BMI160_INT2_OUTPUT_EN_MASK;
data = temp | ((intr_pin_sett->output_en << 7) & BMI160_INT2_OUTPUT_EN_MASK);
Expand Down