# accelerometer_gyroscope_bmi160

Accelerometer & Gyroscope BMI160

Author | Matthew Schinkel, copyright © 2017, all rights reserved.
Adapted-by |
Compiler | >=2.4q5

Description

    This library provides routines to read x,y,z values from
                 BMI160's accelerometer & gyroscope using SPI.

Sources

    http://www.mouser.com/ds/2/783/BST-BMI160-DS000-07-786474.pdf

Dependencies

- delay

## Summary

### Global variables/contants

- `const byte BMI160_REG_CMD = 0x7E`
- `const byte BMI160_READ = 0x80`
- `const byte BMI160_REG_GYR_RANGE = 0x43`
- `const byte BMI160_SOFT_RESET = 0xB6`
- `const byte BMI160_REG_STATUS = 0x1B`
- `const byte BMI160_REG_ACC_RANGE = 0x41`
- `const byte BMI160_WRITE = 0x00`
- `const byte BMI160_REG_DEVICE_ID = 0x00`

### Procedures

- `bmi160_init()`
- `bmi160_write_reg(byte in register, byte in data)`

### Functions

- `bmi_160_gyro_y() return word`
- `bmi_160_gyro_x() return word`
- `bmi_160_accelerometer_x() return word`
- `bmi_160_accelerometer_y() return word`
- `bmi_160_communication_test() return bit`
- `bmi_160_gyro_z() return word`
- `bmi_160_accelerometer_z() return word`
- `bmi160_read_reg(byte in register) return byte`

## API details

### Global variables/contants

- `const byte BMI160_REG_CMD = 0x7E`

  No documentation found

- `const byte BMI160_READ = 0x80`

      general constants

- `const byte BMI160_REG_GYR_RANGE = 0x43`

  No documentation found

- `const byte BMI160_SOFT_RESET = 0xB6`

      commands for the command register

- `const byte BMI160_REG_STATUS = 0x1B`

  No documentation found

- `const byte BMI160_REG_ACC_RANGE = 0x41`

  No documentation found

- `const byte BMI160_WRITE = 0x00`

  No documentation found

- `const byte BMI160_REG_DEVICE_ID = 0x00`

      registers

### Procedures

- `bmi160_init()`

      Initialize BMI160

- `bmi160_write_reg(byte in register, byte in data)`

      write to a register

### Functions

- `bmi_160_gyro_y() return word`

      Read gyro Z axis

- `bmi_160_gyro_x() return word`

      Read gyro Z axis

- `bmi_160_accelerometer_x() return word`

      Read accelerometer X axis

- `bmi_160_accelerometer_y() return word`

      Read accelerometer Y axis

- `bmi_160_communication_test() return bit`

      communication test

- `bmi_160_gyro_z() return word`

      Read gyro Z axis

- `bmi_160_accelerometer_z() return word`

      Read accelerometer Z axis

- `bmi160_read_reg(byte in register) return byte`

      read a register

## Related samples

Here are the list of samples which use this library:

18f4620 | 18f4620_accelerometer_gyroscope_bmi160.jal