# BMI270 Library

**URL:** <https://community.sparkfun.com/t/bmi270-library/47523>\
**Category:** IMU & Motion\
**Created:** [June 4, 2024, 3:58pm UTC](https://community.sparkfun.com/t/bmi270-library/47523 "2024-06-04T15:58:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![markbeeman](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@markbeeman](https://community.sparkfun.com/u/markbeeman)\
**Post date:** [June 4, 2024, 3:58pm UTC](https://community.sparkfun.com/t/bmi270-library/47523/1 "2024-06-04T15:58:23Z")

</div>

Hi All:

I am using the Sparkfun BMI270 IMU with the library located here:[https://github.com/sparkfun/SparkFun\_BM … no\_Library](https://github.com/sparkfun/SparkFun_BMI270_Arduino_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):

```auto
/*!
 * @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

---

<div class="post-metadata">

**Author:** ![aliarifat794](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@aliarifat794](https://community.sparkfun.com/u/aliarifat794)\
**Post date:** [June 5, 2024, 8:26am UTC](https://community.sparkfun.com/t/bmi270-library/47523/2 "2024-06-05T08:26:41Z")

</div>

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.
