Merge pull request #11297 from SteveCEvans/baro_state
[betaflight.git] / src / main / drivers / accgyro / accgyro_spi_bmi160.h
blob705c77754e016761f6be0e9160ae82d1472564c9
1 /**
2 ******************************************************************************
3 * @addtogroup PIOS PIOS Core hardware abstraction layer
4 * @{
5 * @addtogroup PIOS_BMI160 BMI160 Functions
6 * @brief Hardware functions to deal with the 6DOF gyro / accel sensor
7 * @{
9 * @file pios_bmi160.c
10 * @author dRonin, http://dRonin.org/, Copyright (C) 2016
11 * @brief BMI160 Gyro / Accel Sensor Routines
12 * @see The GNU Public License (GPL) Version 3
13 ******************************************************************************/
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * for more details.
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 * Additional note on redistribution: The copyright and license notices above
31 * must be maintained in each individual source file that is a derivative work
32 * of this source file; otherwise redistribution is prohibited.
35 #pragma once
37 #include "drivers/bus.h"
39 enum pios_bmi160_orientation { // clockwise rotation from board forward
40 PIOS_BMI160_TOP_0DEG,
41 PIOS_BMI160_TOP_90DEG,
42 PIOS_BMI160_TOP_180DEG,
43 PIOS_BMI160_TOP_270DEG,
44 PIOS_BMI160_BOTTOM_0DEG,
45 PIOS_BMI160_BOTTOM_90DEG,
46 PIOS_BMI160_BOTTOM_180DEG,
47 PIOS_BMI160_BOTTOM_270DEG,
50 enum bmi160_odr {
51 BMI160_ODR_800_Hz = 0x0B,
52 BMI160_ODR_1600_Hz = 0x0C,
53 BMI160_ODR_3200_Hz = 0x0D,
56 enum bmi160_acc_range {
57 BMI160_RANGE_2G = 0x03,
58 BMI160_RANGE_4G = 0x05,
59 BMI160_RANGE_8G = 0x08,
60 BMI160_RANGE_16G = 0x0C,
63 enum bmi160_gyro_range {
64 BMI160_RANGE_125DPS = 0x04,
65 BMI160_RANGE_250DPS = 0x03,
66 BMI160_RANGE_500DPS = 0x02,
67 BMI160_RANGE_1000DPS = 0x01,
68 BMI160_RANGE_2000DPS = 0x00,
71 uint8_t bmi160Detect(const extDevice_t *dev);
72 bool bmi160SpiAccDetect(accDev_t *acc);
73 bool bmi160SpiGyroDetect(gyroDev_t *gyro);