Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bmi088.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 "peripherals/bmi088.h"
30 
31 const float BMI088_GYRO_SENS[5] = {
37 };
38 
45 };
46 
47 const float BMI088_ACCEL_SENS[4] = {
52 };
53 
59 };
60 
62 {
68 }
69 
70 void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config)
71 {
72  switch (config->init_status) {
74  /* configure accelerometer range */
75  bmi_set(bmi, BMI088_ACCEL_RANGE, config->accel_range, BMI088_CONFIG_ACCEL);
76  config->init_status++;
77  break;
79  /* configure accelerometer odr and bw */
80  bmi_set(bmi, BMI088_ACCEL_CONF, ((config->accel_bw << 4) | config->accel_odr), BMI088_CONFIG_ACCEL);
81  config->init_status++;
82  break;
84  /* switch on accel */
86  config->init_status++;
87  break;
89  /* switch on accel */
91  config->init_status++;
92  break;
94  /* configure gyro range */
95  bmi_set(bmi, BMI088_GYRO_RANGE, config->gyro_range, BMI088_CONFIG_GYRO);
96  config->init_status++;
97  break;
99  /* configure gyro odr */
100  bmi_set(bmi, BMI088_GYRO_BAND_WIDTH, config->gyro_odr, BMI088_CONFIG_GYRO);
101  config->init_status++;
102  break;
104  /* switch on gyro */
106  config->init_status++;
107  break;
108  case BMI088_CONF_DONE:
109  config->initialized = true;
110  break;
111  default:
112  break;
113  }
114 }
115 
#define BMI088_ACCEL_RANGE
Definition: bmi088_regs.h:55
void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config)
Configuration sequence called once before normal use.
Definition: bmi088.c:70
#define BMI088_GYRO_SENS_125_DEN
Definition: bmi088.h:53
#define BMI088_ACCEL_SENS_24G_NUM
Definition: bmi088.h:88
#define BMI088_DEFAULT_ACCEL_BW
Default accel bandwidth.
Definition: bmi088.h:44
#define BMI088_GYRO_SENS_1000_NUM
Definition: bmi088.h:61
#define BMI088_ACCEL_SENS_3G
default accel sensitivy from the datasheet sens = 9.81 [m/s^2] / [LSB/g] * 2^INT32_ACCEL_FRAC ex: BMI...
Definition: bmi088.h:78
#define BMI088_ACCEL_CONF
Definition: bmi088_regs.h:54
enum Bmi088GyroRanges gyro_range
deg/s Range
Definition: bmi088.h:114
#define BMI088_GYRO_SENS_250_DEN
Definition: bmi088.h:56
#define BMI088_GYRO_SENS_500
Definition: bmi088.h:57
#define BMI088_ACCEL_PWR_CTRl
Definition: bmi088_regs.h:64
#define BMI088_GYRO_SENS_2000_DEN
Definition: bmi088.h:65
enum Bmi088AccelRanges accel_range
g Range
Definition: bmi088.h:116
#define BMI088_GYRO_SENS_500_NUM
Definition: bmi088.h:58
#define BMI088_GYRO_SENS_250_NUM
Definition: bmi088.h:55
enum Bmi088AccelODR accel_odr
output data rate
Definition: bmi088.h:117
#define BMI088_ACCEL_SENS_6G_DEN
Definition: bmi088.h:83
#define BMI088_ACCEL_SENS_3G_DEN
Definition: bmi088.h:80
#define BMI088_GYRO_SENS_2000_NUM
Definition: bmi088.h:64
#define BMI088_GYRO_LPM_1
Definition: bmi088_regs.h:85
#define BMI088_ACCEL_PWR_CONF
Definition: bmi088_regs.h:63
#define BMI088_GYRO_SENS_250
Definition: bmi088.h:54
#define BMI088_CONFIG_ACCEL
Definition: bmi088.h:108
#define BMI088_ACCEL_SENS_6G_NUM
Definition: bmi088.h:82
#define BMI088_GYRO_SENS_1000
Definition: bmi088.h:60
#define BMI088_GYRO_SENS_125
default gyro sensitivy from the datasheet sens = 1/ [LSB/(deg/s)] * pi/180 * 2^INT32_RATE_FRAC ex: BM...
Definition: bmi088.h:51
void bmi088_set_default_config(struct Bmi088Config *c)
Definition: bmi088.c:61
#define BMI088_GYRO_SENS_2000
Definition: bmi088.h:63
const float BMI088_ACCEL_SENS[4]
Definition: bmi088.c:47
void(* Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type)
Configuration function prototype.
Definition: bmi088.h:111
#define BMI088_ACCEL_SENS_24G
Definition: bmi088.h:87
#define BMI088_GYRO_RANGE
Definition: bmi088_regs.h:82
const int32_t BMI088_ACCEL_SENS_FRAC[4][2]
Definition: bmi088.c:54
#define BMI088_ACCEL_SENS_24G_DEN
Definition: bmi088.h:89
const float BMI088_GYRO_SENS[5]
Definition: bmi088.c:31
#define BMI088_ACCEL_SENS_6G
Definition: bmi088.h:81
#define BMI088_DEFAULT_GYRO_ODR
Default gyro output rate.
Definition: bmi088.h:38
signed long int32_t
Definition: types.h:19
#define BMI088_DEFAULT_ACCEL_ODR
Default accel output rate.
Definition: bmi088.h:42
#define BMI088_ACCEL_SENS_12G_DEN
Definition: bmi088.h:86
#define BMI088_DEFAULT_GYRO_RANGE
Default gyro full scale range +- 1000°/s.
Definition: bmi088.h:36
#define BMI088_ACCEL_SENS_3G_NUM
Definition: bmi088.h:79
static const struct usb_config_descriptor config
Definition: usb_ser_hw.c:199
#define BMI088_GYRO_SENS_1000_DEN
Definition: bmi088.h:62
const int32_t BMI088_GYRO_SENS_FRAC[5][2]
Definition: bmi088.c:39
BMI088 driver common interface (I2C and SPI).
#define BMI088_DEFAULT_ACCEL_RANGE
Default accel full scale range +- 6g.
Definition: bmi088.h:40
enum Bmi088AccelBW accel_bw
bandwidth
Definition: bmi088.h:118
#define BMI088_CONFIG_GYRO
Definition: bmi088.h:109
bool initialized
config done flag
Definition: bmi088.h:120
#define BMI088_ACCEL_SENS_12G_NUM
Definition: bmi088.h:85
#define BMI088_GYRO_SENS_125_NUM
Definition: bmi088.h:52
#define BMI088_GYRO_BAND_WIDTH
Definition: bmi088_regs.h:83
enum Bmi088ConfStatus init_status
init status
Definition: bmi088.h:119
#define BMI088_GYRO_SENS_500_DEN
Definition: bmi088.h:59
enum Bmi088GyroODR gyro_odr
output data rate
Definition: bmi088.h:115
#define BMI088_ACCEL_SENS_12G
Definition: bmi088.h:84