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
lsm6ds33.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Alexis Cornard <alexiscornard@gmail.com>
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, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
27 #ifndef LSM6_H
28 #define LSM6_H
29 
30 #ifndef LSM6_XL_DEFAULT_ODR
31 #define LSM6_XL_DEFAULT_ODR (LSM6_ODR_XL_1_6KHZ << 4)
32 #endif
33 
34 #ifndef LSM6_XL_DEFAULT_FS
35 #define LSM6_XL_DEFAULT_FS (LSM6_FS_XL_16G << 2)
36 #endif
37 
38 
39 #ifndef LSM6_G_DEFAULT_ODR
40 #define LSM6_G_DEFAULT_ODR (LSM6_ODR_G_1_6KHZ << 4)
41 #endif
42 
43 #ifndef LSM6_G_DEFAULT_FS
44 #define LSM6_G_DEFAULT_FS (LSM6_FS_G_1000 << 2)
45 #endif
46 
47 #ifndef LSM6_C_DEFAULT
48 #define LSM6_C_DEFAULT (0x04)
49 #endif
50 
51 #ifndef LSM6_ORIENT
52 #define LSM6_ORIENT (0x02)
53 #endif
54 
55 #ifndef GYRO_SENS_H
56 #define GYRO_SENS_H
57 
63 #define LSM6_GYRO_SENS_245 0.3127
64 #define LSM6_GYRO_SENS_245_NUM 3127
65 #define LSM6_GYRO_SENS_245_DEN 1000
66 #define LSM6_GYRO_SENS_500 0.6255
67 #define LSM6_GYRO_SENS_500_NUM 6255
68 #define LSM6_GYRO_SENS_500_DEN 1000
69 #define LSM6_GYRO_SENS_1000 2.5021
70 #define LSM6_GYRO_SENS_1000_NUM 25021
71 #define LSM6_GYRO_SENS_1000_DEN 1000
72 #define LSM6_GYRO_SENS_2000 5.0042
73 #define LSM6_GYRO_SENS_2000_NUM 50042
74 #define LSM6_GYRO_SENS_2000_DEN 1000
75 
76 #endif
77 
78 #ifndef ACCEL_SENS_H
79 #define ACCEL_SENS_H
80 
81 #define LSM6_ACCEL_SENS_2G 0.613125
82 #define LSM6_ACCEL_SENS_2G_NUM 981
83 #define LSM6_ACCEL_SENS_2G_DEN 1600
84 #define LSM6_ACCEL_SENS_4G 1.22625
85 #define LSM6_ACCEL_SENS_4G_NUM 981
86 #define LSM6_ACCEL_SENS_4G_DEN 800
87 #define LSM6_ACCEL_SENS_8G 2.4525
88 #define LSM6_ACCEL_SENS_8G_NUM 981
89 #define LSM6_ACCEL_SENS_8G_DEN 400
90 #define LSM6_ACCEL_SENS_16G 4.905
91 #define LSM6_ACCEL_SENS_16G_NUM 981
92 #define LSM6_ACCEL_SENS_16G_DEN 200
93 
94 #endif
95 
96 
97 #include "std.h"
98 
99 /* Include address and register definition */
101 
109 };
110 
111 struct Lsm6Config {
112  uint8_t xl; // Accelerometer configuration
113  uint8_t g; // Gyroscope configuration
114  uint8_t c; // Common configuration
115  uint8_t orient; // Axes orientation
116 
117 };
118 
119 static inline void lsm6_set_default_config(struct Lsm6Config *c)
120 {
123  c->c = LSM6_C_DEFAULT;
124  c->orient = LSM6_ORIENT;
125 }
126 
127 
128 #endif // LSM6_H
Register defs for ST LSM6DS33 3D accelerometer and gyroscope.
#define LSM6_C_DEFAULT
Definition: lsm6ds33.h:48
#define LSM6_ORIENT
Definition: lsm6ds33.h:52
uint8_t c
Definition: lsm6ds33.h:114
#define LSM6_G_DEFAULT_FS
Definition: lsm6ds33.h:44
#define LSM6_XL_DEFAULT_ODR
Definition: lsm6ds33.h:31
uint8_t g
Definition: lsm6ds33.h:113
#define LSM6_XL_DEFAULT_FS
Definition: lsm6ds33.h:35
uint8_t xl
Definition: lsm6ds33.h:112
uint8_t orient
Definition: lsm6ds33.h:115
unsigned char uint8_t
Definition: types.h:14
#define LSM6_G_DEFAULT_ODR
Definition: lsm6ds33.h:40
static void lsm6_set_default_config(struct Lsm6Config *c)
Definition: lsm6ds33.h:119
Lsm6ConfStatus
Definition: lsm6ds33.h:102