Skip to content

Commit a958204

Browse files
committed
Corrected FIFO_CONT value
* Updated FIFO_CONT to equal 6 based on datasheet values found in Table 84 on pg. 56 * Other formatting changes reflected from Visual Studio autoformatting
1 parent f482197 commit a958204

File tree

1 file changed

+78
-79
lines changed

1 file changed

+78
-79
lines changed

src/LSM9DS1_Types.h

Lines changed: 78 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -35,73 +35,72 @@ enum interface_mode
3535
// accel_scale defines all possible FSR's of the accelerometer:
3636
enum accel_scale
3737
{
38-
A_SCALE_2G, // 00: 2g
39-
A_SCALE_16G,// 01: 16g
40-
A_SCALE_4G, // 10: 4g
41-
A_SCALE_8G // 11: 8g
38+
A_SCALE_2G, // 00: 2g
39+
A_SCALE_16G, // 01: 16g
40+
A_SCALE_4G, // 10: 4g
41+
A_SCALE_8G // 11: 8g
4242
};
4343

4444
// gyro_scale defines the possible full-scale ranges of the gyroscope:
4545
enum gyro_scale
4646
{
47-
G_SCALE_245DPS, // 00: 245 degrees per second
48-
G_SCALE_500DPS, // 01: 500 dps
49-
G_SCALE_2000DPS, // 11: 2000 dps
47+
G_SCALE_245DPS, // 00: 245 degrees per second
48+
G_SCALE_500DPS, // 01: 500 dps
49+
G_SCALE_2000DPS, // 11: 2000 dps
5050
};
5151

5252
// mag_scale defines all possible FSR's of the magnetometer:
5353
enum mag_scale
5454
{
55-
M_SCALE_4GS, // 00: 4Gs
56-
M_SCALE_8GS, // 01: 8Gs
57-
M_SCALE_12GS, // 10: 12Gs
58-
M_SCALE_16GS, // 11: 16Gs
55+
M_SCALE_4GS, // 00: 4Gs
56+
M_SCALE_8GS, // 01: 8Gs
57+
M_SCALE_12GS, // 10: 12Gs
58+
M_SCALE_16GS, // 11: 16Gs
5959
};
6060

6161
// gyro_odr defines all possible data rate/bandwidth combos of the gyro:
6262
enum gyro_odr
6363
{
64-
//! TODO
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)
64+
//! TODO
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)
7272
};
7373
// accel_oder defines all possible output data rates of the accelerometer:
7474
enum accel_odr
7575
{
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)
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)
8383
};
8484

8585
// accel_abw defines all possible anti-aliasing filter rates of the accelerometer:
8686
enum accel_abw
8787
{
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)
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)
9292
};
9393

94-
9594
// mag_odr defines all possible output data rates of the magnetometer:
9695
enum mag_odr
9796
{
98-
M_ODR_0625, // 0.625 Hz (0)
99-
M_ODR_125, // 1.25 Hz (1)
100-
M_ODR_250, // 2.5 Hz (2)
97+
M_ODR_0625, // 0.625 Hz (0)
98+
M_ODR_125, // 1.25 Hz (1)
99+
M_ODR_250, // 2.5 Hz (2)
101100
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)
101+
M_ODR_10, // 10 Hz (4)
102+
M_ODR_20, // 20 Hz (5)
103+
M_ODR_40, // 40 Hz (6)
105104
M_ODR_80 // 80 Hz (7)
106105
};
107106

@@ -113,44 +112,44 @@ enum interrupt_select
113112

114113
enum interrupt_generators
115114
{
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-
};
115+
INT_DRDY_XL = (1 << 0), // Accelerometer data ready (INT1 & INT2)
116+
INT_DRDY_G = (1 << 1), // Gyroscope data ready (INT1 & INT2)
117+
INT1_BOOT = (1 << 2), // Boot status (INT1)
118+
INT2_DRDY_TEMP = (1 << 2), // Temp data ready (INT2)
119+
INT_FTH = (1 << 3), // FIFO threshold interrupt (INT1 & INT2)
120+
INT_OVR = (1 << 4), // Overrun interrupt (INT1 & INT2)
121+
INT_FSS5 = (1 << 5), // FSS5 interrupt (INT1 & INT2)
122+
INT_IG_XL = (1 << 6), // Accel interrupt generator (INT1)
123+
INT1_IG_G = (1 << 7), // Gyro interrupt enable (INT1)
124+
INT2_INACT = (1 << 7), // Inactivity interrupt output (INT2)
125+
};
127126

128127
enum accel_interrupt_generator
129128
{
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)
129+
XLIE_XL = (1 << 0),
130+
XHIE_XL = (1 << 1),
131+
YLIE_XL = (1 << 2),
132+
YHIE_XL = (1 << 3),
133+
ZLIE_XL = (1 << 4),
134+
ZHIE_XL = (1 << 5),
135+
GEN_6D = (1 << 6)
137136
};
138137

139138
enum gyro_interrupt_generator
140139
{
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)
140+
XLIE_G = (1 << 0),
141+
XHIE_G = (1 << 1),
142+
YLIE_G = (1 << 2),
143+
YHIE_G = (1 << 3),
144+
ZLIE_G = (1 << 4),
145+
ZHIE_G = (1 << 5)
147146
};
148147

149148
enum mag_interrupt_generator
150149
{
151-
ZIEN = (1<<5),
152-
YIEN = (1<<6),
153-
XIEN = (1<<7)
150+
ZIEN = (1 << 5),
151+
YIEN = (1 << 6),
152+
XIEN = (1 << 7)
154153
};
155154

156155
enum h_lactive
@@ -171,14 +170,14 @@ enum fifoMode_type
171170
FIFO_THS = 1,
172171
FIFO_CONT_TRIGGER = 3,
173172
FIFO_OFF_TRIGGER = 4,
174-
FIFO_CONT = 5
173+
FIFO_CONT = 6
175174
};
176175

177176
struct gyroSettings
178177
{
179178
// Gyroscope settings:
180179
uint8_t enabled;
181-
uint16_t scale; // Changed this to 16-bit
180+
uint16_t scale; // Changed this to 16-bit
182181
uint8_t sampleRate;
183182
// New gyro stuff:
184183
uint8_t bandwidth;
@@ -197,32 +196,32 @@ struct gyroSettings
197196

198197
struct deviceSettings
199198
{
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
199+
uint8_t commInterface; // Can be I2C, SPI 4-wire or SPI 3-wire
200+
uint8_t agAddress; // I2C address or SPI CS pin
201+
uint8_t mAddress; // I2C address or SPI CS pin
203202
};
204203

205204
struct accelSettings
206205
{
207206
// Accelerometer settings:
208-
uint8_t enabled;
209-
uint8_t scale;
210-
uint8_t sampleRate;
207+
uint8_t enabled;
208+
uint8_t scale;
209+
uint8_t sampleRate;
211210
// New accel stuff:
212211
uint8_t enableX;
213212
uint8_t enableY;
214213
uint8_t enableZ;
215-
int8_t bandwidth;
214+
int8_t bandwidth;
216215
uint8_t highResEnable;
217216
uint8_t highResBandwidth;
218217
};
219218

220219
struct magSettings
221220
{
222221
// Magnetometer settings:
223-
uint8_t enabled;
224-
uint8_t scale;
225-
uint8_t sampleRate;
222+
uint8_t enabled;
223+
uint8_t scale;
224+
uint8_t sampleRate;
226225
// New mag stuff:
227226
uint8_t tempCompensationEnable;
228227
uint8_t XYPerformance;
@@ -234,17 +233,17 @@ struct magSettings
234233
struct temperatureSettings
235234
{
236235
// Temperature settings
237-
uint8_t enabled;
236+
uint8_t enabled;
238237
};
239238

240239
struct IMUSettings
241240
{
242241
deviceSettings device;
243-
242+
244243
gyroSettings gyro;
245244
accelSettings accel;
246245
magSettings mag;
247-
246+
248247
temperatureSettings temp;
249248
};
250249

0 commit comments

Comments
 (0)