Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
bmi088.h
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 
27 #ifndef BMI088_H
28 #define BMI088_H
29 
30 #include "std.h"
31 #include "math/pprz_algebra_int.h"
32 
33 /* Include address and register definition */
35 
37 #define BMI088_DEFAULT_GYRO_RANGE BMI088_GYRO_RANGE_1000
38 #define BMI088_DEFAULT_GYRO_ODR BMI088_GYRO_ODR_1000_BW_116
40 #define BMI088_DEFAULT_ACCEL_RANGE BMI088_ACCEL_RANGE_12G
42 #define BMI088_DEFAULT_ACCEL_ODR BMI088_ACCEL_ODR_1600
44 #define BMI088_DEFAULT_ACCEL_BW BMI088_ACCEL_BW_OSR4
46 
52 #define BMI088_GYRO_SENS_125 0.272442 // FIXME
53 #define BMI088_GYRO_SENS_125_NUM 19327
54 #define BMI088_GYRO_SENS_125_DEN 17735
55 #define BMI088_GYRO_SENS_250 0.544883
56 #define BMI088_GYRO_SENS_250_NUM 19327
57 #define BMI088_GYRO_SENS_250_DEN 35470
58 #define BMI088_GYRO_SENS_500 1.08977
59 #define BMI088_GYRO_SENS_500_NUM 57663
60 #define BMI088_GYRO_SENS_500_DEN 52913
61 #define BMI088_GYRO_SENS_1000 2.17953
62 #define BMI088_GYRO_SENS_1000_NUM 18271
63 #define BMI088_GYRO_SENS_1000_DEN 8383
64 #define BMI088_GYRO_SENS_2000 4.35906
65 #define BMI088_GYRO_SENS_2000_NUM 36542
66 #define BMI088_GYRO_SENS_2000_DEN 8383
67 
68 // Get default sensitivity from a table
69 extern const float BMI088_GYRO_SENS[5];
70 // Get default sensitivity numerator and denominator from a table
71 extern const struct Int32Rates BMI088_GYRO_SENS_FRAC[5][2];
72 
78 // FIXME
79 #define BMI088_ACCEL_SENS_3G 0.919912
80 #define BMI088_ACCEL_SENS_3G_NUM 9199
81 #define BMI088_ACCEL_SENS_3G_DEN 10000
82 #define BMI088_ACCEL_SENS_6G 1.83982
83 #define BMI088_ACCEL_SENS_6G_NUM 18398
84 #define BMI088_ACCEL_SENS_6G_DEN 10000
85 #define BMI088_ACCEL_SENS_12G 3.67965
86 #define BMI088_ACCEL_SENS_12G_NUM 36797
87 #define BMI088_ACCEL_SENS_12G_DEN 10000
88 #define BMI088_ACCEL_SENS_24G 7.3593
89 #define BMI088_ACCEL_SENS_24G_NUM 7359
90 #define BMI088_ACCEL_SENS_24G_DEN 1000
91 
92 // Get default sensitivity from a table
93 extern const float BMI088_ACCEL_SENS[4];
94 // Get default sensitivity numerator and denominator from a table
95 extern const struct Int32Vect3 BMI088_ACCEL_SENS_FRAC[4][2];
96 
107 };
108 
109 #define BMI088_CONFIG_ACCEL 0
110 #define BMI088_CONFIG_GYRO 1
111 typedef void (*Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type);
113 
114 struct Bmi088Config {
121  bool initialized;
122 };
123 
124 extern void bmi088_set_default_config(struct Bmi088Config *c);
125 
127 extern void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config);
128 
129 #endif // BMI088_H
BMI088_CONF_UNINIT
@ BMI088_CONF_UNINIT
Definition: bmi088.h:98
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
Bmi088Config::accel_bw
enum Bmi088AccelBW accel_bw
bandwidth
Definition: bmi088.h:119
Int32Rates
angular rates
Definition: pprz_algebra_int.h:179
BMI088_GYRO_SENS_FRAC
const struct Int32Rates BMI088_GYRO_SENS_FRAC[5][2]
Definition: bmi088.c:39
BMI088_CONF_GYRO_RANGE
@ BMI088_CONF_GYRO_RANGE
Definition: bmi088.h:103
BMI088_CONF_GYRO_PWR
@ BMI088_CONF_GYRO_PWR
Definition: bmi088.h:105
BMI088_GYRO_SENS
const float BMI088_GYRO_SENS[5]
Definition: bmi088.c:31
Bmi088AccelRanges
Bmi088AccelRanges
Accel output range.
Definition: bmi088_regs.h:97
Bmi088GyroODR
Bmi088GyroODR
Gyro output data rate and bandwidth.
Definition: bmi088_regs.h:157
bmi088_set_default_config
void bmi088_set_default_config(struct Bmi088Config *c)
Definition: bmi088.c:70
BMI088_ACCEL_SENS
const float BMI088_ACCEL_SENS[4]
Definition: bmi088.c:52
Bmi088Config::gyro_range
enum Bmi088GyroRanges gyro_range
deg/s Range
Definition: bmi088.h:115
bmi088_regs.h
Bmi088Config::init_status
enum Bmi088ConfStatus init_status
init status
Definition: bmi088.h:120
BMI088_CONF_ACCEL_PWR_CTRL
@ BMI088_CONF_ACCEL_PWR_CTRL
Definition: bmi088.h:102
pprz_algebra_int.h
Paparazzi fixed point algebra.
Bmi088ConfStatus
Bmi088ConfStatus
Definition: bmi088.h:97
BMI088_CONF_ACCEL_ODR
@ BMI088_CONF_ACCEL_ODR
Definition: bmi088.h:100
std.h
Bmi088Config::accel_odr
enum Bmi088AccelODR accel_odr
output data rate
Definition: bmi088.h:118
Bmi088GyroRanges
Bmi088GyroRanges
Gyro output range.
Definition: bmi088_regs.h:146
config
static const struct usb_config_descriptor config
Definition: usb_ser_hw.c:200
BMI088_CONF_GYRO_ODR
@ BMI088_CONF_GYRO_ODR
Definition: bmi088.h:104
Int32Vect3
Definition: pprz_algebra_int.h:88
BMI088_ACCEL_SENS_FRAC
const struct Int32Vect3 BMI088_ACCEL_SENS_FRAC[4][2]
Definition: bmi088.c:59
Bmi088Config::initialized
bool initialized
config done flag
Definition: bmi088.h:121
Bmi088Config
Definition: bmi088.h:114
Bmi088AccelODR
Bmi088AccelODR
Accel outpur data rate.
Definition: bmi088_regs.h:107
Bmi088Config::gyro_odr
enum Bmi088GyroODR gyro_odr
output data rate
Definition: bmi088.h:116
BMI088_CONF_ACCEL_RANGE
@ BMI088_CONF_ACCEL_RANGE
Definition: bmi088.h:99
Bmi088AccelBW
Bmi088AccelBW
Accel bandwith.
Definition: bmi088_regs.h:121
BMI088_CONF_DONE
@ BMI088_CONF_DONE
Definition: bmi088.h:106
Bmi088Config::accel_range
enum Bmi088AccelRanges accel_range
g Range
Definition: bmi088.h:117
bmi088_send_config
void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config)
Configuration sequence called once before normal use.
Definition: bmi088.c:79
BMI088_CONF_ACCEL_PWR_CONF
@ BMI088_CONF_ACCEL_PWR_CONF
Definition: bmi088.h:101
Bmi088ConfigSet
void(* Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type)
Configuration function prototype.
Definition: bmi088.h:112