How to Make SPI Demo #################### 1. Introduction --------------- This is a demo to show how to get the data of **BMI160** by **SPI ioctl** in **ROScube Pico**. The data includes: * CHIP ID * PMU STATUS * SENSOR DATA (ACCEL and GYRO). .. note:: In this BMI160 demo, by using ``/dev/spidev2.0``. 2. Build -------- Download the code from Github `Adlink-ROS/bmi160_spi_demo `_. .. code-block:: bash git clone https://github.com/Adlink-ROS/bmi160_spi_demo.git cd bmi160_spi_demo 1. Usage -------- Test the demo following the command. i) Compile the code by gcc .. code-block:: bash gcc -o bmi160_test main.c bmi160.c ii) Run the code .. code-block:: bash ./bmi160_test iii) Result If successfully worked, it will show data: * CHIP ID: ``0xD1`` * PMU STATUS: ``0x14`` * SENSOR DATA: **50 points** .. image:: images/bmi160-spi-demo.png :width: 80% :align: center .. note:: It will show **OK** message on the first line, that means ``bmi160_perform_self_test`` was successful. .. warning:: When occurred filed or error, please check the **Error Value** from `bmi160.h `_.