LSD9DS1 library for TMS570LS12x
LSM9DS1_Types.h
1 /******************************************************************************
2  LSM9DS1_Types.h
3  SFE_LSM9DS1 Library - LSM9DS1 Types and Enumerations
4  Jim Lindblom @ SparkFun Electronics
5  Original Creation Date: April 21, 2015
6 https://github.com/sparkfun/LSM9DS1_Breakout
7 
8 This file defines all types and enumerations used by the LSM9DS1 class.
9 
10 Development environment specifics:
11 IDE: Arduino 1.6.0
12 Hardware Platform: Arduino Uno
13 LSM9DS1 Breakout Version: 1.0
14 
15 This code is beerware; if you see me (or any other SparkFun employee) at the
16 local, and you've found our code helpful, please buy us a round!
17 
18 Distributed as-is; no warranty is given.
19  ******************************************************************************/
20 
21 #ifndef __LSM9DS1_Types_H__
22 #define __LSM9DS1_Types_H__
23 
24 #include "LSM9DS1_Registers.h"
25 #include "hal_stdtypes.h"
26 
27 // The LSM9DS1 functions over both I2C or SPI. This library supports both.
28 // But the interface mode used must be sent to the LSM9DS1 constructor. Use
29 // one of these two as the first parameter of the constructor.
30 enum interface_mode
31 {
32  IMU_MODE_SPI,
33  IMU_MODE_I2C,
34 };
35 
36 // accel_scale defines all possible FSR's of the accelerometer:
37 enum accel_scale
38 {
39  A_SCALE_2G, // 00: 2g
40  A_SCALE_16G,// 01: 16g
41  A_SCALE_4G, // 10: 4g
42  A_SCALE_8G // 11: 8g
43 };
44 
45 // gyro_scale defines the possible full-scale ranges of the gyroscope:
46 enum gyro_scale
47 {
48  G_SCALE_245DPS, // 00: 245 degrees per second
49  G_SCALE_500DPS, // 01: 500 dps
50  G_SCALE_2000DPS, // 11: 2000 dps
51 };
52 
53 // mag_scale defines all possible FSR's of the magnetometer:
54 enum mag_scale
55 {
56  M_SCALE_4GS, // 00: 4Gs
57  M_SCALE_8GS, // 01: 8Gs
58  M_SCALE_12GS, // 10: 12Gs
59  M_SCALE_16GS, // 11: 16Gs
60 };
61 
62 // gyro_odr defines all possible data rate/bandwidth combos of the gyro:
63 enum gyro_odr
64 {
66  G_ODR_PD, // Power down (0)
67  G_ODR_149, // 14.9 Hz (1)
68  G_ODR_595, // 59.5 Hz (2)
69  G_ODR_119, // 119 Hz (3)
70  G_ODR_238, // 238 Hz (4)
71  G_ODR_476, // 476 Hz (5)
72  G_ODR_952 // 952 Hz (6)
73 };
74 // accel_oder defines all possible output data rates of the accelerometer:
75 enum accel_odr
76 {
77  XL_POWER_DOWN, // Power-down mode (0x0)
78  XL_ODR_10, // 10 Hz (0x1)
79  XL_ODR_50, // 50 Hz (0x02)
80  XL_ODR_119, // 119 Hz (0x3)
81  XL_ODR_238, // 238 Hz (0x4)
82  XL_ODR_476, // 476 Hz (0x5)
83  XL_ODR_952 // 952 Hz (0x6)
84 };
85 
86 // accel_abw defines all possible anti-aliasing filter rates of the accelerometer:
87 enum accel_abw
88 {
89  A_ABW_408, // 408 Hz (0x0)
90  A_ABW_211, // 211 Hz (0x1)
91  A_ABW_105, // 105 Hz (0x2)
92  A_ABW_50, // 50 Hz (0x3)
93 };
94 
95 
96 // mag_odr defines all possible output data rates of the magnetometer:
97 enum mag_odr
98 {
99  M_ODR_0625, // 0.625 Hz (0)
100  M_ODR_125, // 1.25 Hz (1)
101  M_ODR_250, // 2.5 Hz (2)
102  M_ODR_5, // 5 Hz (3)
103  M_ODR_10, // 10 Hz (4)
104  M_ODR_20, // 20 Hz (5)
105  M_ODR_40, // 40 Hz (6)
106  M_ODR_80 // 80 Hz (7)
107 };
108 
109 enum interrupt_select
110 {
111  XG_INT1 = INT1_CTRL,
112  XG_INT2 = INT2_CTRL
113 };
114 
115 enum interrupt_generators
116 {
117  INT_DRDY_XL = (1<<0), // Accelerometer data ready (INT1 & INT2)
118  INT_DRDY_G = (1<<1), // Gyroscope data ready (INT1 & INT2)
119  INT1_BOOT = (1<<2), // Boot status (INT1)
120  INT2_DRDY_TEMP = (1<<2),// Temp data ready (INT2)
121  INT_FTH = (1<<3), // FIFO threshold interrupt (INT1 & INT2)
122  INT_OVR = (1<<4), // Overrun interrupt (INT1 & INT2)
123  INT_FSS5 = (1<<5), // FSS5 interrupt (INT1 & INT2)
124  INT_IG_XL = (1<<6), // Accel interrupt generator (INT1)
125  INT1_IG_G = (1<<7), // Gyro interrupt enable (INT1)
126  INT2_INACT = (1<<7), // Inactivity interrupt output (INT2)
127 };
128 
129 enum accel_interrupt_generator
130 {
131  XLIE_XL = (1<<0),
132  XHIE_XL = (1<<1),
133  YLIE_XL = (1<<2),
134  YHIE_XL = (1<<3),
135  ZLIE_XL = (1<<4),
136  ZHIE_XL = (1<<5),
137  GEN_6D = (1<<6)
138 };
139 
140 enum gyro_interrupt_generator
141 {
142  XLIE_G = (1<<0),
143  XHIE_G = (1<<1),
144  YLIE_G = (1<<2),
145  YHIE_G = (1<<3),
146  ZLIE_G = (1<<4),
147  ZHIE_G = (1<<5)
148 };
149 
150 enum mag_interrupt_generator
151 {
152  ZIEN = (1<<5),
153  YIEN = (1<<6),
154  XIEN = (1<<7)
155 };
156 
157 enum h_lactive
158 {
159  INT_ACTIVE_HIGH,
160  INT_ACTIVE_LOW
161 };
162 
163 enum pp_od
164 {
165  INT_PUSH_PULL,
166  INT_OPEN_DRAIN
167 };
168 
169 enum fifoMode_type
170 {
171  FIFO_OFF = 0,
172  FIFO_THS = 1,
173  FIFO_CONT_TRIGGER = 3,
174  FIFO_OFF_TRIGGER = 4,
175  FIFO_CONT = 5
176 };
177 
179 {
180  // Gyroscope settings:
181  uint8_t enabled;
182  uint16_t scale; // Changed this to 16-bit
183  uint8_t sampleRate;
184  // New gyro stuff:
185  uint8_t bandwidth;
186  uint8_t lowPowerEnable;
187  uint8_t HPFEnable;
188  uint8_t HPFCutoff;
189  uint8_t flipX;
190  uint8_t flipY;
191  uint8_t flipZ;
192  uint8_t orientation;
193  uint8_t enableX;
194  uint8_t enableY;
195  uint8_t enableZ;
196  uint8_t latchInterrupt;
197 };
198 
200 {
201  uint8_t commInterface; // Can be I2C, SPI 4-wire or SPI 3-wire
202  uint8_t agAddress; // I2C address or SPI CS pin
203  uint8_t mAddress; // I2C address or SPI CS pin
204 };
205 
207 {
208  // Accelerometer settings:
209  uint8_t enabled;
210  uint8_t scale;
211  uint8_t sampleRate;
212  // New accel stuff:
213  uint8_t enableX;
214  uint8_t enableY;
215  uint8_t enableZ;
216  int8_t bandwidth;
217  uint8_t highResEnable;
218  uint8_t highResBandwidth;
219 };
220 
222 {
223  // Magnetometer settings:
224  uint8_t enabled;
225  uint8_t scale;
226  uint8_t sampleRate;
227  // New mag stuff:
228  uint8_t tempCompensationEnable;
229  uint8_t XYPerformance;
230  uint8_t ZPerformance;
231  uint8_t lowPowerEnable;
232  uint8_t operatingMode;
233 };
234 
236 {
237  // Temperature settings
238  uint8_t enabled;
239 };
240 
242 {
243  deviceSettings device;
244 
245  gyroSettings gyro;
246  accelSettings accel;
247  magSettings mag;
248 
249  temperatureSettings temp;
250 };
251 
252 #endif