Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
imu_icm42688.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Freek van tieen <freek.v.tienen@gmail.com>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
28 #include "modules/imu/imu.h"
29 #include "modules/core/abi.h"
30 #include "mcu_periph/spi.h"
32 
33 
34 #ifndef INVENSENSE3_GYRO_AAF
35 #define INVENSENSE3_GYRO_AAF 977
36 #endif
37 
38 #ifndef INVENSENSE3_ACCEL_AAF
39 #define INVENSENSE3_ACCEL_AAF 213
40 #endif
41 
42 static struct invensense3_t imu_icm42688;
43 
45 {
47  //imu_icm42688.parser = INVENSENSE3_PARSER_REGISTERS;
49 
51  imu_icm42688.spi.p = &IMU_SPI_DEV;
52  imu_icm42688.spi.slave_idx = IMU_SPI_SLAVE_IDX;
53 
54  imu_icm42688.gyro_odr = INVENSENSE3_GYRO_ODR;
55  imu_icm42688.gyro_range = INVENSENSE3_GYRO_RANGE;
56  imu_icm42688.accel_odr = INVENSENSE3_ACCEL_ODR;
57  imu_icm42688.accel_range = INVENSENSE3_ACCEL_RANGE;
58 
59  // The AAF freq needs to be high enough to avoid group delay and low enough to minimise noise and clipping
62 
64 }
65 
67 {
69 }
70 
72 {
74 }
75 
76 
77 
Main include for ABI (AirBorneInterface).
#define IMU_ICM42688_ID
Inertial Measurement Unit interface.
void imu_icm42688_event(void)
Definition: imu_icm42688.c:71
static struct invensense3_t imu_icm42688
Definition: imu_icm42688.c:42
void imu_icm42688_periodic(void)
Definition: imu_icm42688.c:66
void imu_icm42688_init(void)
Definition: imu_icm42688.c:44
#define INVENSENSE3_GYRO_AAF
Definition: imu_icm42688.c:35
#define INVENSENSE3_ACCEL_AAF
Definition: imu_icm42688.c:39
Driver for the IMU ICM42688.
void invensense3_periodic(struct invensense3_t *inv)
Should be called periodically to request sensor readings.
Definition: invensense3.c:275
void invensense3_event(struct invensense3_t *inv)
Should be called in the event thread.
Definition: invensense3.c:327
void invensense3_init(struct invensense3_t *inv)
Initialize the invensense v3 sensor instance.
Definition: invensense3.c:223
Driver for the Invensense V3 IMUs ICM40605, ICM40609, ICM42605, IIM42652 and ICM42688.
enum invensense3_gyro_range_t gyro_range
Gyro range configuration.
Definition: invensense3.h:174
enum invensense3_parser_t parser
Parser of the device.
Definition: invensense3.h:158
uint16_t accel_aaf
Accelerometer Anti-alias filter 3dB Bandwidth configuration [Hz].
Definition: invensense3.h:179
@ INVENSENSE3_PARSER_FIFO
Definition: invensense3.h:74
enum invensense3_accel_odr_t accel_odr
Accelerometer Output Data Rate configuration.
Definition: invensense3.h:177
enum invensense3_bus_t bus
The communication bus used to connect the device SPI/I2C.
Definition: invensense3.h:160
@ INVENSENSE3_SPI
Definition: invensense3.h:60
enum invensense3_accel_range_t accel_range
Accelerometer range configuration.
Definition: invensense3.h:178
uint8_t abi_id
The ABI id used to broadcast the device measurements.
Definition: invensense3.h:155
uint16_t gyro_aaf
Gyro Anti-alias filter 3dB Bandwidth configuration [Hz].
Definition: invensense3.h:175
enum invensense3_gyro_odr_t gyro_odr
Gyro Output Data Rate configuration.
Definition: invensense3.h:173
Architecture independent SPI (Serial Peripheral Interface) API.