BMI270 Library

Hi All:

I am using the Sparkfun BMI270 IMU with the library located here:https://github.com/sparkfun/SparkFun_BM … no_Library

The current library allows for an interrupt if ANY of the wrist gestures are detected. I was wondering if it is possible to “tweak” the library to create an interrupt if only a single, desired wrist gesture is detected. I see in the datasheet there is a register for INT1_MAP_FEAT wrist_gesture_out. Since wrist_gesture_out can take values based on the type of gesture.

I am not good at coding but was wondering if someone on here smarter than me could weigh in on whether this is possible. I think I have it narrowed to this subroutine in the API (file bmi2.c):

/*!
 * @brief This API maps/unmaps feature interrupts to that of interrupt pins.
 */
int8_t bmi2_map_feat_int(uint8_t type, enum bmi2_hw_int_pin hw_int_pin, struct bmi2_dev *dev)
{
    /* Variable to define error */
    int8_t rslt;

    /* Variable to define the value of feature interrupts */
    uint8_t feat_int = 0;

    /* Array to store the interrupt mask bits */
    uint8_t data_array[2] = { 0 };

    /* Structure to define map the interrupts */
    struct bmi2_map_int map_int = { 0 };

    /* Null-pointer check */
    rslt = null_ptr_check(dev);
    if (rslt == BMI2_OK)
    {
        /* Read interrupt map1 and map2 and register */
        rslt = bmi2_get_regs(BMI2_INT1_MAP_FEAT_ADDR, data_array, 2, dev);

        if (rslt == BMI2_OK)
        {
            /* Get the value of the feature interrupt to be mapped */
            extract_feat_int_map(&map_int, type, dev);

            feat_int = map_int.sens_map_int;

            /* Map the interrupts */
            rslt = map_feat_int(data_array, hw_int_pin, feat_int);

            /* Map the interrupts to INT1 and INT2 map register */
            if (rslt == BMI2_OK)
            {
                rslt = bmi2_set_regs(BMI2_INT1_MAP_FEAT_ADDR, &data_array[0], 1, dev);
                if (rslt == BMI2_OK)
                {
                    rslt = bmi2_set_regs(BMI2_INT2_MAP_FEAT_ADDR, &data_array[1], 1, dev);
                }
            }
        }
    }
    else
    {
        rslt = BMI2_E_NULL_PTR;
    }

    return rslt;
}

Any help is appreciated.

Mark

To modify the library, you will have to identify the specific value for the desired wrist gesture. These values will be different for various gestures like flick, double flick, etc.