# Userspace i2c - BMI160 example in C

**URL:** <https://mangoh.discourse.group/t/userspace-i2c-bmi160-example-in-c/6179>\
**Category:** Uncategorized\
**Created:** [February 17, 2021, 7:58am UTC](https://mangoh.discourse.group/t/userspace-i2c-bmi160-example-in-c/6179 "2021-02-17T07:58:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CT1](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CT1](https://mangoh.discourse.group/u/CT1)\
**Post date:** [February 17, 2021, 7:58am UTC](https://mangoh.discourse.group/t/userspace-i2c-bmi160-example-in-c/6179/1 "2021-02-17T07:58:16Z")

</div>

I was having a lot of trouble sending and receiving i2c data from userspace in my apps, so I wrote this wrapper. In accel\_test/accel.c it goes over the function arguments. The program saves ~20s worth of IMU data into the root home directory. If anyone else finds it useful please let me know.

Things to note: I wrote it so I could send/receive multiply bytes. It’s only been tested on a mangoh red with a WP7702.

> **[cloudtrac/wp77xx\_i2c](https://github.com/cloudtrac/wp77xx_i2c)**
>
> Library to facilitate userspace access to i2c on Mangoh dev boards from SWI
