Paparazzi UAS v7.0_unstable
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
38
46
53
60
69
71{
72 switch (config->init_status) {
74 /* configure accelerometer range */
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 */
96 config->init_status++;
97 break;
99 /* configure gyro odr */
101 config->init_status++;
102 break;
104 /* switch on gyro */
106 config->init_status++;
107 break;
108 case BMI088_CONF_DONE:
109 /* Set the samplerates from the ODR */
110 switch(config->gyro_odr) {
113 config->gyro_samplerate = 2000;
114 break;
116 config->gyro_samplerate = 1000;
117 break;
119 config->gyro_samplerate = 400;
120 break;
123 config->gyro_samplerate = 200;
124 break;
127 config->gyro_samplerate = 100;
128 break;
129 }
130 switch(config->accel_odr) {
132 config->accel_samplerate = 1600;
133 break;
135 config->accel_samplerate = 800;
136 break;
138 config->accel_samplerate = 400;
139 break;
141 config->accel_samplerate = 200;
142 break;
144 config->accel_samplerate = 100;
145 break;
147 config->accel_samplerate = 50;
148 break;
150 config->accel_samplerate = 25;
151 break;
153 config->accel_samplerate = 12;
154 break;
155 }
156
157 config->initialized = true;
158 break;
159 default:
160 break;
161 }
162}
163
void bmi088_set_default_config(struct Bmi088Config *c)
Definition bmi088.c:61
const float BMI088_ACCEL_SENS[4]
Definition bmi088.c:47
const struct FloatRates BMI088_GYRO_SENS_F[5]
Definition bmi088.c:39
void bmi088_send_config(Bmi088ConfigSet bmi_set, void *bmi, struct Bmi088Config *config)
Configuration sequence called once before normal use.
Definition bmi088.c:70
const struct FloatVect3 BMI088_ACCEL_SENS_F[4]
Definition bmi088.c:54
const float BMI088_GYRO_SENS[5]
Definition bmi088.c:31
BMI088 driver common interface (I2C and SPI).
#define BMI088_DEFAULT_ACCEL_BW
Default accel bandwidth.
Definition bmi088.h:46
#define BMI088_GYRO_SENS_500
Definition bmi088.h:59
#define BMI088_ACCEL_SENS_6G
Definition bmi088.h:83
#define BMI088_ACCEL_SENS_12G
Definition bmi088.h:86
enum Bmi088AccelODR accel_odr
output data rate
Definition bmi088.h:119
#define BMI088_CONFIG_ACCEL
Definition bmi088.h:110
void(* Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type)
Configuration function prototype.
Definition bmi088.h:113
#define BMI088_ACCEL_SENS_24G
Definition bmi088.h:89
enum Bmi088AccelRanges accel_range
g Range
Definition bmi088.h:118
#define BMI088_DEFAULT_GYRO_RANGE
Default gyro full scale range +- 1000°/s.
Definition bmi088.h:38
enum Bmi088GyroODR gyro_odr
output data rate
Definition bmi088.h:117
enum Bmi088AccelBW accel_bw
bandwidth
Definition bmi088.h:120
#define BMI088_CONFIG_GYRO
Definition bmi088.h:111
#define BMI088_GYRO_SENS_2000
Definition bmi088.h:65
#define BMI088_DEFAULT_ACCEL_RANGE
Default accel full scale range +- 6g.
Definition bmi088.h:42
@ BMI088_CONF_ACCEL_RANGE
Definition bmi088.h:100
@ BMI088_CONF_GYRO_PWR
Definition bmi088.h:106
@ BMI088_CONF_ACCEL_ODR
Definition bmi088.h:101
@ BMI088_CONF_GYRO_ODR
Definition bmi088.h:105
@ BMI088_CONF_ACCEL_PWR_CTRL
Definition bmi088.h:103
@ BMI088_CONF_DONE
Definition bmi088.h:107
@ BMI088_CONF_GYRO_RANGE
Definition bmi088.h:104
@ BMI088_CONF_ACCEL_PWR_CONF
Definition bmi088.h:102
#define BMI088_GYRO_SENS_1000
Definition bmi088.h:62
#define BMI088_DEFAULT_GYRO_ODR
Default gyro output rate.
Definition bmi088.h:40
enum Bmi088GyroRanges gyro_range
deg/s Range
Definition bmi088.h:116
#define BMI088_GYRO_SENS_250
Definition bmi088.h:56
#define BMI088_DEFAULT_ACCEL_ODR
Default accel output rate.
Definition bmi088.h:44
#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:80
#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:53
#define BMI088_ACCEL_RANGE
Definition bmi088_regs.h:55
#define BMI088_GYRO_RANGE
Definition bmi088_regs.h:82
@ BMI088_ACCEL_ACTIVE
#define BMI088_GYRO_LPM_1
Definition bmi088_regs.h:85
@ BMI088_GYRO_ODR_400_BW_47
@ BMI088_GYRO_ODR_1000_BW_116
@ BMI088_GYRO_ODR_100_BW_12
@ BMI088_GYRO_ODR_2000_BW_532
@ BMI088_GYRO_ODR_100_BW_32
@ BMI088_GYRO_ODR_200_BW_23
@ BMI088_GYRO_ODR_2000_BW_230
@ BMI088_GYRO_ODR_200_BW_64
#define BMI088_GYRO_BAND_WIDTH
Definition bmi088_regs.h:83
#define BMI088_ACCEL_PWR_CONF
Definition bmi088_regs.h:63
@ BMI088_ACCEL_ODR_400
@ BMI088_ACCEL_ODR_200
@ BMI088_ACCEL_ODR_12
@ BMI088_ACCEL_ODR_50
@ BMI088_ACCEL_ODR_100
@ BMI088_ACCEL_ODR_25
@ BMI088_ACCEL_ODR_800
@ BMI088_ACCEL_ODR_1600
#define BMI088_ACCEL_CONF
Definition bmi088_regs.h:54
@ BMI088_GYRO_NORMAL
@ BMI088_ACCEL_POWER_ON
#define BMI088_ACCEL_PWR_CTRl
Definition bmi088_regs.h:64
angular rates
uint16_t foo
Definition main_demo5.c:58
static const struct usb_config_descriptor config
Definition usb_ser_hw.c:200