Paparazzi UAS  v5.18.0_stable
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 
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_1000_BW_116
39 #define BMI088_DEFAULT_ACCEL_RANGE BMI088_ACCEL_RANGE_12G
41 #define BMI088_DEFAULT_ACCEL_ODR BMI088_ACCEL_ODR_1600
43 #define BMI088_DEFAULT_ACCEL_BW BMI088_ACCEL_BW_OSR4
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.919912
79 #define BMI088_ACCEL_SENS_3G_NUM 9199
80 #define BMI088_ACCEL_SENS_3G_DEN 10000
81 #define BMI088_ACCEL_SENS_6G 1.83982
82 #define BMI088_ACCEL_SENS_6G_NUM 18398
83 #define BMI088_ACCEL_SENS_6G_DEN 10000
84 #define BMI088_ACCEL_SENS_12G 3.67965
85 #define BMI088_ACCEL_SENS_12G_NUM 36797
86 #define BMI088_ACCEL_SENS_12G_DEN 10000
87 #define BMI088_ACCEL_SENS_24G 7.3593
88 #define BMI088_ACCEL_SENS_24G_NUM 7359
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
c
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
BMI088_CONF_UNINIT
@ BMI088_CONF_UNINIT
Definition: bmi088.h:97
Bmi088Config::accel_bw
enum Bmi088AccelBW accel_bw
bandwidth
Definition: bmi088.h:118
BMI088_CONF_GYRO_RANGE
@ BMI088_CONF_GYRO_RANGE
Definition: bmi088.h:102
BMI088_CONF_GYRO_PWR
@ BMI088_CONF_GYRO_PWR
Definition: bmi088.h:104
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:61
BMI088_GYRO_SENS_FRAC
const int32_t BMI088_GYRO_SENS_FRAC[5][2]
Definition: bmi088.c:39
BMI088_ACCEL_SENS_FRAC
const int32_t BMI088_ACCEL_SENS_FRAC[4][2]
Definition: bmi088.c:54
BMI088_ACCEL_SENS
const float BMI088_ACCEL_SENS[4]
Definition: bmi088.c:47
Bmi088Config::gyro_range
enum Bmi088GyroRanges gyro_range
deg/s Range
Definition: bmi088.h:114
bmi088_regs.h
Bmi088Config::init_status
enum Bmi088ConfStatus init_status
init status
Definition: bmi088.h:119
BMI088_CONF_ACCEL_PWR_CTRL
@ BMI088_CONF_ACCEL_PWR_CTRL
Definition: bmi088.h:101
Bmi088ConfStatus
Bmi088ConfStatus
Definition: bmi088.h:96
BMI088_CONF_ACCEL_ODR
@ BMI088_CONF_ACCEL_ODR
Definition: bmi088.h:99
std.h
Bmi088Config::accel_odr
enum Bmi088AccelODR accel_odr
output data rate
Definition: bmi088.h:117
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:103
uint8_t
unsigned char uint8_t
Definition: types.h:14
Bmi088Config::initialized
bool initialized
config done flag
Definition: bmi088.h:120
Bmi088Config
Definition: bmi088.h:113
Bmi088AccelODR
Bmi088AccelODR
Accel outpur data rate.
Definition: bmi088_regs.h:107
Bmi088Config::gyro_odr
enum Bmi088GyroODR gyro_odr
output data rate
Definition: bmi088.h:115
BMI088_CONF_ACCEL_RANGE
@ BMI088_CONF_ACCEL_RANGE
Definition: bmi088.h:98
int32_t
signed long int32_t
Definition: types.h:19
Bmi088AccelBW
Bmi088AccelBW
Accel bandwith.
Definition: bmi088_regs.h:121
BMI088_CONF_DONE
@ BMI088_CONF_DONE
Definition: bmi088.h:105
Bmi088Config::accel_range
enum Bmi088AccelRanges accel_range
g Range
Definition: bmi088.h:116
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:70
BMI088_CONF_ACCEL_PWR_CONF
@ BMI088_CONF_ACCEL_PWR_CONF
Definition: bmi088.h:100
Bmi088ConfigSet
void(* Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type)
Configuration function prototype.
Definition: bmi088.h:111