New SPI API supporting DMA
[betaflight.git] / src / main / drivers / accgyro / accgyro_spi_icm20649.h
bloba26aabff3f7da3683dd5b30d6dc0972c2a54c11a
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #include "drivers/bus.h"
25 #define ICM20649_BIT_RESET (0x80)
27 #define ICM20649_RA_REG_BANK_SEL 0x7F
29 // BANK 0
30 #define ICM20649_RA_WHO_AM_I 0x00
31 #define ICM20649_RA_PWR_MGMT_1 0x06
32 #define ICM20649_RA_PWR_MGMT_2 0x07
33 #define ICM20649_RA_INT_PIN_CFG 0x0F
34 #define ICM20649_RA_INT_ENABLE_1 0x11
35 #define ICM20649_RA_GYRO_XOUT_H 0x33
36 #define ICM20649_RA_ACCEL_XOUT_H 0x2D
38 // BANK 2
39 #define ICM20649_RA_GYRO_SMPLRT_DIV 0x00
40 #define ICM20649_RA_GYRO_CONFIG_1 0x01
41 #define ICM20649_RA_ACCEL_CONFIG 0x14
43 enum icm20649_gyro_fsr_e {
44 ICM20649_FSR_500DPS = 0,
45 ICM20649_FSR_1000DPS,
46 ICM20649_FSR_2000DPS,
47 ICM20649_FSR_4000DPS,
48 NUM_ICM20649_GYRO_FSR
51 enum icm20649_accel_fsr_e {
52 ICM20649_FSR_4G = 0,
53 ICM20649_FSR_8G,
54 ICM20649_FSR_16G,
55 ICM20649_FSR_30G,
56 NUM_ICM20649_ACCEL_FSR
59 void icm20649AccInit(accDev_t *acc);
60 void icm20649GyroInit(gyroDev_t *gyro);
62 uint8_t icm20649SpiDetect(const busDevice_t *bus);
64 bool icm20649SpiAccDetect(accDev_t *acc);
65 bool icm20649SpiGyroDetect(gyroDev_t *gyro);
67 bool icm20649GyroReadSPI(gyroDev_t *gyro);
68 bool icm20649AccRead(accDev_t *acc);