Paparazzi UAS  v7.0_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
39 #define BMI088_DEFAULT_GYRO_ODR BMI088_GYRO_ODR_1000_BW_116
41 #define BMI088_DEFAULT_ACCEL_RANGE BMI088_ACCEL_RANGE_12G
43 #define BMI088_DEFAULT_ACCEL_ODR BMI088_ACCEL_ODR_1600
45 #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
112 typedef void (*Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type);
113 
114 struct Bmi088Config {
116  enum Bmi088GyroODR gyro_odr;
119  enum Bmi088AccelBW accel_bw;
121  bool initialized;
122 
125 };
126 
127 extern void bmi088_set_default_config(struct Bmi088Config *c);
128 
130 extern void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config);
131 
132 #endif // BMI088_H
void bmi088_set_default_config(struct Bmi088Config *c)
Definition: bmi088.c:70
const float BMI088_ACCEL_SENS[4]
Definition: bmi088.c:52
enum Bmi088AccelODR accel_odr
output data rate
Definition: bmi088.h:118
void(* Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type)
Configuration function prototype.
Definition: bmi088.h:112
enum Bmi088AccelRanges accel_range
g Range
Definition: bmi088.h:117
const struct Int32Vect3 BMI088_ACCEL_SENS_FRAC[4][2]
Definition: bmi088.c:59
enum Bmi088GyroODR gyro_odr
output data rate
Definition: bmi088.h:116
enum Bmi088AccelBW accel_bw
bandwidth
Definition: bmi088.h:119
void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config)
Configuration sequence called once before normal use.
Definition: bmi088.c:79
bool initialized
config done flag
Definition: bmi088.h:121
const struct Int32Rates BMI088_GYRO_SENS_FRAC[5][2]
Definition: bmi088.c:39
enum Bmi088ConfStatus init_status
init status
Definition: bmi088.h:120
Bmi088ConfStatus
Definition: bmi088.h:97
@ BMI088_CONF_ACCEL_RANGE
Definition: bmi088.h:99
@ BMI088_CONF_GYRO_PWR
Definition: bmi088.h:105
@ BMI088_CONF_ACCEL_ODR
Definition: bmi088.h:100
@ BMI088_CONF_GYRO_ODR
Definition: bmi088.h:104
@ BMI088_CONF_ACCEL_PWR_CTRL
Definition: bmi088.h:102
@ BMI088_CONF_DONE
Definition: bmi088.h:106
@ BMI088_CONF_GYRO_RANGE
Definition: bmi088.h:103
@ BMI088_CONF_ACCEL_PWR_CONF
Definition: bmi088.h:101
@ BMI088_CONF_UNINIT
Definition: bmi088.h:98
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
const float BMI088_GYRO_SENS[5]
Definition: bmi088.c:31
Register and address definitions for BMI088.
Bmi088GyroODR
Gyro output data rate and bandwidth.
Definition: bmi088_regs.h:158
Bmi088GyroRanges
Gyro output range.
Definition: bmi088_regs.h:147
Bmi088AccelODR
Accel outpur data rate.
Definition: bmi088_regs.h:108
Bmi088AccelRanges
Accel output range.
Definition: bmi088_regs.h:98
Bmi088AccelBW
Accel bandwith.
Definition: bmi088_regs.h:122
angular rates
Paparazzi fixed point algebra.
static const struct usb_config_descriptor config
Definition: usb_ser_hw.c:200
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98