Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
imu_bmi088_i2c.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Gautier Hattenberger <gautier.hattenberger@enac.fr>
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, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
29#include "modules/imu/imu.h"
30#include "mcu_periph/i2c.h"
31#include "mcu_periph/sys_time.h"
32#include "modules/core/abi.h"
33
36
37#ifndef IMU_BMI088_GYRO_ODR
38#define IMU_BMI088_GYRO_ODR BMI088_GYRO_ODR_1000_BW_116
39#endif
41
42#ifndef IMU_BMI088_ACCEL_ODR
43#define IMU_BMI088_ACCEL_ODR BMI088_ACCEL_ODR_1600
44#endif
46
47#ifndef IMU_BMI088_ACCEL_BW
48#define IMU_BMI088_ACCEL_BW BMI088_ACCEL_BW_OSR4
49#endif
51
52#ifndef IMU_BMI088_GYRO_I2C_ADDR
53#define IMU_BMI088_GYRO_I2C_ADDR BMI088_GYRO_ADDR
54#endif
56
57#ifndef IMU_BMI088_ACCEL_I2C_ADDR
58#define IMU_BMI088_ACCEL_I2C_ADDR BMI088_ACCEL_ADDR
59#endif
61
62// Default channels order
63#ifndef IMU_BMI088_CHAN_X
64#define IMU_BMI088_CHAN_X 0
65#endif
67#ifndef IMU_BMI088_CHAN_Y
68#define IMU_BMI088_CHAN_Y 1
69#endif
71#ifndef IMU_BMI088_CHAN_Z
72#define IMU_BMI088_CHAN_Z 2
73#endif
75
76#ifndef IMU_BMI088_X_SIGN
77#define IMU_BMI088_X_SIGN 1
78#endif
80#ifndef IMU_BMI088_Y_SIGN
81#define IMU_BMI088_Y_SIGN 1
82#endif
84#ifndef IMU_BMI088_Z_SIGN
85#define IMU_BMI088_Z_SIGN 1
86#endif
88
89
91
107
112
142
Main include for ABI (AirBorneInterface).
#define IMU_BMI088_ID
const struct Int32Vect3 BMI088_ACCEL_SENS_FRAC[4][2]
Definition bmi088.c:59
const struct Int32Rates BMI088_GYRO_SENS_FRAC[5][2]
Definition bmi088.c:39
enum Bmi088AccelODR accel_odr
output data rate
Definition bmi088.h:118
enum Bmi088AccelRanges accel_range
g Range
Definition bmi088.h:117
enum Bmi088GyroODR gyro_odr
output data rate
Definition bmi088.h:116
enum Bmi088AccelBW accel_bw
bandwidth
Definition bmi088.h:119
float accel_samplerate
samplerate in Hz from accel_odr
Definition bmi088.h:124
float gyro_samplerate
samplerate in Hz from gyro_odr
Definition bmi088.h:123
enum Bmi088GyroRanges gyro_range
deg/s Range
Definition bmi088.h:115
void bmi088_i2c_init(struct Bmi088_I2c *bmi, struct i2c_periph *i2c_p, uint8_t gyro_addr, uint8_t accel_addr)
Definition bmi088_i2c.c:30
void bmi088_i2c_event(struct Bmi088_I2c *bmi)
Definition bmi088_i2c.c:93
static void bmi088_i2c_periodic(struct Bmi088_I2c *bmi)
convenience function: read or start configuration if not already initialized
Definition bmi088_i2c.h:61
volatile bool accel_available
accel data ready flag
Definition bmi088_i2c.h:42
union Bmi088_I2c::@312 data_accel
struct Bmi088Config config
Definition bmi088_i2c.h:51
union Bmi088_I2c::@313 data_rates
volatile bool gyro_available
gyro data ready flag
Definition bmi088_i2c.h:41
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
angular rates
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
void imu_set_defaults_accel(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct Int32Vect3 *scale)
Set the defaults for a accel sensor WARNING: Should be called before sensor is publishing messages to...
Definition imu.c:610
void imu_set_defaults_gyro(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Rates *neutral, const struct Int32Rates *scale)
Set the defaults for a gyro sensor WARNING: Should be called before sensor is publishing messages to ...
Definition imu.c:580
Inertial Measurement Unit interface.
#define IMU_BMI088_ACCEL_I2C_ADDR
#define IMU_BMI088_Z_SIGN
void imu_bmi088_init(void)
#define IMU_BMI088_Y_SIGN
#define IMU_BMI088_ACCEL_BW
void imu_bmi088_event(void)
#define IMU_BMI088_X_SIGN
#define IMU_BMI088_CHAN_Y
#define IMU_BMI088_ACCEL_ODR
struct ImuBmi088 imu_bmi088
#define IMU_BMI088_GYRO_I2C_ADDR
void imu_bmi088_periodic(void)
#define IMU_BMI088_CHAN_Z
#define IMU_BMI088_CHAN_X
#define IMU_BMI088_GYRO_ODR
IMU driver for the BMI088 using I2C.
struct Bmi088_I2c bmi
#define IMU_BMI088_GYRO_RANGE
#define IMU_BMI088_ACCEL_RANGE
uint16_t foo
Definition main_demo5.c:58
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
Architecture independent timing functions.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.