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