Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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 {
63  c->gyro_range = BMI088_DEFAULT_GYRO_RANGE;
64  c->gyro_odr = BMI088_DEFAULT_GYRO_ODR;
65  c->accel_range = BMI088_DEFAULT_ACCEL_RANGE;
66  c->accel_odr = BMI088_DEFAULT_ACCEL_ODR;
67  c->accel_bw = BMI088_DEFAULT_ACCEL_BW;
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 
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_GYRO_SENS_1000_DEN
#define BMI088_GYRO_SENS_1000_DEN
Definition: bmi088.h:62
bmi088_set_default_config
void bmi088_set_default_config(struct Bmi088Config *c)
Definition: bmi088.c:61
BMI088_DEFAULT_ACCEL_ODR
#define BMI088_DEFAULT_ACCEL_ODR
Default accel output rate.
Definition: bmi088.h:42
BMI088_GYRO_SENS_FRAC
const int32_t BMI088_GYRO_SENS_FRAC[5][2]
Definition: bmi088.c:39
BMI088_ACCEL_SENS
const float BMI088_ACCEL_SENS[4]
Definition: bmi088.c:47
BMI088_CONFIG_GYRO
#define BMI088_CONFIG_GYRO
Definition: bmi088.h:109
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_NORMAL
@ BMI088_GYRO_NORMAL
Definition: bmi088_regs.h:173
BMI088_ACCEL_SENS_6G
#define BMI088_ACCEL_SENS_6G
Definition: bmi088.h:81
BMI088_ACCEL_SENS_24G
#define BMI088_ACCEL_SENS_24G
Definition: bmi088.h:87
BMI088_ACCEL_SENS_FRAC
const int32_t BMI088_ACCEL_SENS_FRAC[4][2]
Definition: bmi088.c:54
BMI088_GYRO_SENS_500_DEN
#define BMI088_GYRO_SENS_500_DEN
Definition: bmi088.h:59
BMI088_ACCEL_SENS_12G
#define BMI088_ACCEL_SENS_12G
Definition: bmi088.h:84
BMI088_GYRO_SENS_125_NUM
#define BMI088_GYRO_SENS_125_NUM
Definition: bmi088.h:52
BMI088_ACCEL_ACTIVE
@ BMI088_ACCEL_ACTIVE
Definition: bmi088_regs.h:132
BMI088_CONF_ACCEL_PWR_CTRL
@ BMI088_CONF_ACCEL_PWR_CTRL
Definition: bmi088.h:101
BMI088_CONF_ACCEL_ODR
@ BMI088_CONF_ACCEL_ODR
Definition: bmi088.h:99
BMI088_ACCEL_SENS_3G
#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
BMI088_GYRO_SENS_500_NUM
#define BMI088_GYRO_SENS_500_NUM
Definition: bmi088.h:58
BMI088_GYRO_SENS_250_DEN
#define BMI088_GYRO_SENS_250_DEN
Definition: bmi088.h:56
BMI088_GYRO_SENS_2000_DEN
#define BMI088_GYRO_SENS_2000_DEN
Definition: bmi088.h:65
BMI088_ACCEL_SENS_12G_DEN
#define BMI088_ACCEL_SENS_12G_DEN
Definition: bmi088.h:86
BMI088_ACCEL_SENS_3G_NUM
#define BMI088_ACCEL_SENS_3G_NUM
Definition: bmi088.h:79
BMI088_ACCEL_RANGE
#define BMI088_ACCEL_RANGE
Definition: bmi088_regs.h:55
BMI088_DEFAULT_GYRO_RANGE
#define BMI088_DEFAULT_GYRO_RANGE
Default gyro full scale range +- 1000°/s.
Definition: bmi088.h:36
BMI088_GYRO_BAND_WIDTH
#define BMI088_GYRO_BAND_WIDTH
Definition: bmi088_regs.h:83
config
static const struct usb_config_descriptor config
Definition: usb_ser_hw.c:200
BMI088_ACCEL_SENS_6G_DEN
#define BMI088_ACCEL_SENS_6G_DEN
Definition: bmi088.h:83
BMI088_ACCEL_POWER_ON
@ BMI088_ACCEL_POWER_ON
Definition: bmi088_regs.h:141
BMI088_CONF_GYRO_ODR
@ BMI088_CONF_GYRO_ODR
Definition: bmi088.h:103
BMI088_ACCEL_PWR_CTRl
#define BMI088_ACCEL_PWR_CTRl
Definition: bmi088_regs.h:64
Bmi088Config
Definition: bmi088.h:113
BMI088_DEFAULT_ACCEL_RANGE
#define BMI088_DEFAULT_ACCEL_RANGE
Default accel full scale range +- 6g.
Definition: bmi088.h:40
BMI088_ACCEL_CONF
#define BMI088_ACCEL_CONF
Definition: bmi088_regs.h:54
BMI088_GYRO_SENS_1000
#define BMI088_GYRO_SENS_1000
Definition: bmi088.h:60
BMI088_ACCEL_SENS_24G_NUM
#define BMI088_ACCEL_SENS_24G_NUM
Definition: bmi088.h:88
BMI088_ACCEL_SENS_12G_NUM
#define BMI088_ACCEL_SENS_12G_NUM
Definition: bmi088.h:85
BMI088_CONF_ACCEL_RANGE
@ BMI088_CONF_ACCEL_RANGE
Definition: bmi088.h:98
BMI088_GYRO_SENS_1000_NUM
#define BMI088_GYRO_SENS_1000_NUM
Definition: bmi088.h:61
int32_t
signed long int32_t
Definition: types.h:19
BMI088_GYRO_SENS_125
#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
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_GYRO_SENS_125_DEN
#define BMI088_GYRO_SENS_125_DEN
Definition: bmi088.h:53
BMI088_GYRO_SENS_2000
#define BMI088_GYRO_SENS_2000
Definition: bmi088.h:63
BMI088_CONF_DONE
@ BMI088_CONF_DONE
Definition: bmi088.h:105
BMI088_DEFAULT_ACCEL_BW
#define BMI088_DEFAULT_ACCEL_BW
Default accel bandwidth.
Definition: bmi088.h:44
BMI088_ACCEL_SENS_24G_DEN
#define BMI088_ACCEL_SENS_24G_DEN
Definition: bmi088.h:89
BMI088_GYRO_SENS_500
#define BMI088_GYRO_SENS_500
Definition: bmi088.h:57
BMI088_GYRO_SENS
const float BMI088_GYRO_SENS[5]
Definition: bmi088.c:31
BMI088_GYRO_SENS_250_NUM
#define BMI088_GYRO_SENS_250_NUM
Definition: bmi088.h:55
BMI088_GYRO_LPM_1
#define BMI088_GYRO_LPM_1
Definition: bmi088_regs.h:85
BMI088_ACCEL_PWR_CONF
#define BMI088_ACCEL_PWR_CONF
Definition: bmi088_regs.h:63
bmi088.h
BMI088_CONF_ACCEL_PWR_CONF
@ BMI088_CONF_ACCEL_PWR_CONF
Definition: bmi088.h:100
BMI088_GYRO_SENS_2000_NUM
#define BMI088_GYRO_SENS_2000_NUM
Definition: bmi088.h:64
BMI088_GYRO_RANGE
#define BMI088_GYRO_RANGE
Definition: bmi088_regs.h:82
Bmi088ConfigSet
void(* Bmi088ConfigSet)(void *bmi, uint8_t _reg, uint8_t _val, uint8_t _type)
Configuration function prototype.
Definition: bmi088.h:111
BMI088_DEFAULT_GYRO_ODR
#define BMI088_DEFAULT_GYRO_ODR
Default gyro output rate.
Definition: bmi088.h:38
BMI088_CONFIG_ACCEL
#define BMI088_CONFIG_ACCEL
Definition: bmi088.h:108
BMI088_GYRO_SENS_250
#define BMI088_GYRO_SENS_250
Definition: bmi088.h:54
BMI088_ACCEL_SENS_6G_NUM
#define BMI088_ACCEL_SENS_6G_NUM
Definition: bmi088.h:82
BMI088_ACCEL_SENS_3G_DEN
#define BMI088_ACCEL_SENS_3G_DEN
Definition: bmi088.h:80