Paparazzi UAS  v5.15_devel-164-g81d4ceb
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
32 /* Include address and register definition */
34 
36 #define BMI088_DEFAULT_GYRO_RANGE BMI088_GYRO_RANGE_1000
37 #define BMI088_DEFAULT_GYRO_ODR BMI088_GYRO_ODR_400_BW_47
39 #define BMI088_DEFAULT_ACCEL_RANGE BMI088_ACCEL_RANGE_6G
41 #define BMI088_DEFAULT_ACCEL_ODR BMI088_ACCEL_ODR_400
43 #define BMI088_DEFAULT_ACCEL_BW BMI088_ACCEL_BW_NORMAL
45 
51 #define BMI088_GYRO_SENS_125 0.272442 // FIXME
52 #define BMI088_GYRO_SENS_125_NUM 19327
53 #define BMI088_GYRO_SENS_125_DEN 17735
54 #define BMI088_GYRO_SENS_250 0.544883
55 #define BMI088_GYRO_SENS_250_NUM 19327
56 #define BMI088_GYRO_SENS_250_DEN 35470
57 #define BMI088_GYRO_SENS_500 1.08977
58 #define BMI088_GYRO_SENS_500_NUM 57663
59 #define BMI088_GYRO_SENS_500_DEN 52913
60 #define BMI088_GYRO_SENS_1000 2.17953
61 #define BMI088_GYRO_SENS_1000_NUM 18271
62 #define BMI088_GYRO_SENS_1000_DEN 8383
63 #define BMI088_GYRO_SENS_2000 4.35906
64 #define BMI088_GYRO_SENS_2000_NUM 36542
65 #define BMI088_GYRO_SENS_2000_DEN 8383
66 
67 // Get default sensitivity from a table
68 extern const float BMI088_GYRO_SENS[5];
69 // Get default sensitivity numerator and denominator from a table
70 extern const int32_t BMI088_GYRO_SENS_FRAC[5][2];
71 
77 // FIXME
78 #define BMI088_ACCEL_SENS_3G 0.919687
79 #define BMI088_ACCEL_SENS_3G_NUM 9197
80 #define BMI088_ACCEL_SENS_3G_DEN 10000
81 #define BMI088_ACCEL_SENS_6G 1.83937
82 #define BMI088_ACCEL_SENS_6G_NUM 18394
83 #define BMI088_ACCEL_SENS_6G_DEN 10000
84 #define BMI088_ACCEL_SENS_12G 3.67875
85 #define BMI088_ACCEL_SENS_12G_NUM 36787
86 #define BMI088_ACCEL_SENS_12G_DEN 10000
87 #define BMI088_ACCEL_SENS_24G 7.3575
88 #define BMI088_ACCEL_SENS_24G_NUM 7357
89 #define BMI088_ACCEL_SENS_24G_DEN 1000
90 
91 // Get default sensitivity from a table
92 extern const float BMI088_ACCEL_SENS[4];
93 // Get default sensitivity numerator and denominator from a table
94 extern const int32_t BMI088_ACCEL_SENS_FRAC[4][2];
95 
106 };
107 
108 #define BMI088_CONFIG_ACCEL 0
109 #define BMI088_CONFIG_GYRO 1
110 typedef void (*Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type);
112 
113 struct Bmi088Config {
120  bool initialized;
121 };
122 
123 extern void bmi088_set_default_config(struct Bmi088Config *c);
124 
126 extern void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config);
127 
128 #endif // BMI088_H
Bmi088ConfStatus
Definition: bmi088.h:96
const int32_t BMI088_GYRO_SENS_FRAC[5][2]
Definition: bmi088.c:39
enum Bmi088GyroRanges gyro_range
deg/s Range
Definition: bmi088.h:114
Bmi088AccelODR
Accel outpur data rate.
Definition: bmi088_regs.h:107
enum Bmi088AccelRanges accel_range
g Range
Definition: bmi088.h:116
void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config)
Configuration sequence called once before normal use.
Definition: bmi088.c:70
enum Bmi088AccelODR accel_odr
output data rate
Definition: bmi088.h:117
Bmi088AccelBW
Accel bandwith.
Definition: bmi088_regs.h:121
void(* Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type)
Configuration function prototype.
Definition: bmi088.h:111
Register and address definitions for BMI088.
const int32_t BMI088_ACCEL_SENS_FRAC[4][2]
Definition: bmi088.c:54
signed long int32_t
Definition: types.h:19
void bmi088_set_default_config(struct Bmi088Config *c)
Definition: bmi088.c:61
const float BMI088_ACCEL_SENS[4]
Definition: bmi088.c:47
unsigned char uint8_t
Definition: types.h:14
Bmi088GyroODR
Gyro output data rate and bandwidth.
Definition: bmi088_regs.h:157
static const struct usb_config_descriptor config
Definition: usb_ser_hw.c:199
Bmi088AccelRanges
Accel output range.
Definition: bmi088_regs.h:97
enum Bmi088AccelBW accel_bw
bandwidth
Definition: bmi088.h:118
bool initialized
config done flag
Definition: bmi088.h:120
const float BMI088_GYRO_SENS[5]
Definition: bmi088.c:31
enum Bmi088ConfStatus init_status
init status
Definition: bmi088.h:119
enum Bmi088GyroODR gyro_odr
output data rate
Definition: bmi088.h:115
Bmi088GyroRanges
Gyro output range.
Definition: bmi088_regs.h:146