Select one of the symbols to view example projects that use it.
 
Outline
#include "lsm303dlhc.h"
Lsm303dlhcDrv
LSM303DLHC_AccInit(uint16_t)
LSM303DLHC_AccDeInit()
LSM303DLHC_AccReadID()
LSM303DLHC_AccRebootCmd()
LSM303DLHC_AccFilterConfig(uint8_t)
LSM303DLHC_AccFilterCmd(uint8_t)
LSM303DLHC_AccReadXYZ(int16_t *)
LSM303DLHC_AccFilterClickCmd(uint8_t)
LSM303DLHC_AccIT1Enable(uint8_t)
LSM303DLHC_AccIT1Disable(uint8_t)
LSM303DLHC_AccIT2Enable(uint8_t)
LSM303DLHC_AccIT2Disable(uint8_t)
LSM303DLHC_AccINT1InterruptEnable(uint8_t, uint8_t)
LSM303DLHC_AccINT1InterruptDisable(uint8_t, uint8_t)
LSM303DLHC_AccINT2InterruptEnable(uint8_t, uint8_t)
LSM303DLHC_AccINT2InterruptDisable(uint8_t, uint8_t)
LSM303DLHC_AccClickITEnable(uint8_t)
LSM303DLHC_AccClickITDisable(uint8_t)
LSM303DLHC_AccZClickITConfig()
Files
loading...
SourceVuSTM32 Libraries and Sampleslsm303dlhclsm303dlhc.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file lsm303dlhc.c * @author MCD Application Team * @brief This file provides a set of functions needed to manage the lsm303dlhc * MEMS accelerometer. ****************************************************************************** * @attention * * Copyright (c) 2015 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "lsm303dlhc.h" /** @addtogroup BSP * @{ *//* ... */ /** @addtogroup Components * @{ *//* ... */ /** @addtogroup LSM303DLHC * @{ *//* ... */ /** @defgroup LSM303DLHC_Private_TypesDefinitions * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup LSM303DLHC_Private_Defines * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup LSM303DLHC_Private_Macros * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup LSM303DLHC_Private_Variables * @{ *//* ... */ ACCELERO_DrvTypeDef Lsm303dlhcDrv = { LSM303DLHC_AccInit, LSM303DLHC_AccDeInit, LSM303DLHC_AccReadID, LSM303DLHC_AccRebootCmd, 0, LSM303DLHC_AccZClickITConfig, 0, 0, 0, 0, LSM303DLHC_AccFilterConfig, LSM303DLHC_AccFilterCmd, LSM303DLHC_AccReadXYZ ...}; /** * @} *//* ... */ /** @defgroup LSM303DLHC_Private_Functions * @{ *//* ... */ /** * @brief Set LSM303DLHC Initialization. * @param InitStruct: Init parameters * @retval None *//* ... */ void LSM303DLHC_AccInit(uint16_t InitStruct) { uint8_t ctrl = 0x00; /* Low level init */ COMPASSACCELERO_IO_Init(); /* Write value to ACC MEMS CTRL_REG1 register */ ctrl = (uint8_t) InitStruct; COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG1_A, ctrl); /* Write value to ACC MEMS CTRL_REG4 register */ ctrl = (uint8_t) (InitStruct >> 8); COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG4_A, ctrl); }{ ... } /** * @brief LSM303DLHC De-initialization. * @param None * @retval None *//* ... */ void LSM303DLHC_AccDeInit(void) { }{ ... } /** * @brief Read LSM303DLHC ID. * @param None * @retval ID *//* ... */ uint8_t LSM303DLHC_AccReadID(void) { uint8_t ctrl = 0x00; /* Low level init */ COMPASSACCELERO_IO_Init(); /* Read value at Who am I register address */ ctrl = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_WHO_AM_I_ADDR); return ctrl; }{ ... } /** * @brief Reboot memory content of LSM303DLHC * @param None * @retval None *//* ... */ void LSM303DLHC_AccRebootCmd(void) { uint8_t tmpreg; /* Read CTRL_REG5 register */ tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG5_A); /* Enable or Disable the reboot memory */ tmpreg |= LSM303DLHC_BOOT_REBOOTMEMORY; /* Write value to ACC MEMS CTRL_REG5 register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG5_A, tmpreg); }{ ... } /** * @brief Set High Pass Filter Modality * @param FilterStruct: contains data for filter config * @retval None *//* ... */ void LSM303DLHC_AccFilterConfig(uint8_t FilterStruct) { uint8_t tmpreg; /* Read CTRL_REG2 register */ tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A); tmpreg &= 0x0C; tmpreg |= FilterStruct; /* Write value to ACC MEMS CTRL_REG2 register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A, tmpreg); }{ ... } /** * @brief Enable or Disable High Pass Filter * @param HighPassFilterState: new state of the High Pass Filter feature. * This parameter can be: * @arg: LSM303DLHC_HIGHPASSFILTER_DISABLE * @arg: LSM303DLHC_HIGHPASSFILTER_ENABLE * @retval None *//* ... */ void LSM303DLHC_AccFilterCmd(uint8_t HighPassFilterState) { uint8_t tmpreg; /* Read CTRL_REG2 register */ tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A); tmpreg &= 0xF7; tmpreg |= HighPassFilterState; /* Write value to ACC MEMS CTRL_REG2 register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A, tmpreg); }{ ... } /** * @brief Read X, Y & Z Acceleration values * @param pData: Data out pointer * @retval None *//* ... */ void LSM303DLHC_AccReadXYZ(int16_t* pData) { int16_t pnRawData[3]; uint8_t ctrlx[2]={0,0}; int8_t buffer[6]; uint8_t i = 0; uint8_t sensitivity = LSM303DLHC_ACC_SENSITIVITY_2G; /* Read the acceleration control register content */ ctrlx[0] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG4_A); ctrlx[1] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG5_A); /* Read output register X, Y & Z acceleration */ buffer[0] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_X_L_A); buffer[1] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_X_H_A); buffer[2] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Y_L_A); buffer[3] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Y_H_A); buffer[4] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Z_L_A); buffer[5] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Z_H_A); /* Check in the control register4 the data alignment*/ if(!(ctrlx[0] & LSM303DLHC_BLE_MSB)) { for(i=0; i<3; i++) { pnRawData[i]=((int16_t)((uint16_t)buffer[2*i+1] << 8) + buffer[2*i]); }for (i=0; i<3; i++) { ... } }if (!(ctrlx[0] & LSM303DLHC_BLE_MSB)) { ... } else /* Big Endian Mode */ { for(i=0; i<3; i++) { pnRawData[i]=((int16_t)((uint16_t)buffer[2*i] << 8) + buffer[2*i+1]); }for (i=0; i<3; i++) { ... } }else { ... } /* Normal mode */ /* Switch the sensitivity value set in the CRTL4 */ switch(ctrlx[0] & LSM303DLHC_FULLSCALE_16G) { case LSM303DLHC_FULLSCALE_2G: sensitivity = LSM303DLHC_ACC_SENSITIVITY_2G; break;case LSM303DLHC_FULLSCALE_2G: case LSM303DLHC_FULLSCALE_4G: sensitivity = LSM303DLHC_ACC_SENSITIVITY_4G; break;case LSM303DLHC_FULLSCALE_4G: case LSM303DLHC_FULLSCALE_8G: sensitivity = LSM303DLHC_ACC_SENSITIVITY_8G; break;case LSM303DLHC_FULLSCALE_8G: case LSM303DLHC_FULLSCALE_16G: sensitivity = LSM303DLHC_ACC_SENSITIVITY_16G; break;case LSM303DLHC_FULLSCALE_16G: }switch (ctrlx[0] & LSM303DLHC_FULLSCALE_16G) { ... } /* Obtain the mg value for the three axis */ for(i=0; i<3; i++) { pData[i]=(pnRawData[i] * sensitivity); }for (i=0; i<3; i++) { ... } }{ ... } /** * @brief Enable or Disable High Pass Filter on CLick * @param HighPassFilterState: new state of the High Pass Filter feature. * This parameter can be: * @arg: LSM303DLHC_HPF_CLICK_DISABLE * @arg: LSM303DLHC_HPF_CLICK_ENABLE * @retval None *//* ... */ void LSM303DLHC_AccFilterClickCmd(uint8_t HighPassFilterClickState) { uint8_t tmpreg = 0x00; /* Read CTRL_REG2 register */ tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A); tmpreg &= ~(LSM303DLHC_HPF_CLICK_ENABLE); tmpreg |= HighPassFilterClickState; /* Write value to ACC MEMS CTRL_REG2 regsister */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A, tmpreg); }{ ... } /** * @brief Enable LSM303DLHC Interrupt1 * @param LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be enabled. * This parameter can be any combination of the following values: * @arg LSM303DLHC_IT1_CLICK * @arg LSM303DLHC_IT1_AOI1 * @arg LSM303DLHC_IT1_AOI2 * @arg LSM303DLHC_IT1_DRY1 * @arg LSM303DLHC_IT1_DRY2 * @arg LSM303DLHC_IT1_WTM * @arg LSM303DLHC_IT1_OVERRUN * @retval None *//* ... */ void LSM303DLHC_AccIT1Enable(uint8_t LSM303DLHC_IT) { uint8_t tmpval = 0x00; /* Read CTRL_REG3 register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A); /* Enable IT1 */ tmpval |= LSM303DLHC_IT; /* Write value to MEMS CTRL_REG3 register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A, tmpval); }{ ... } /** * @brief Disable LSM303DLHC Interrupt1 * @param LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be disabled. * This parameter can be any combination of the following values: * @arg LSM303DLHC_IT1_CLICK * @arg LSM303DLHC_IT1_AOI1 * @arg LSM303DLHC_IT1_AOI2 * @arg LSM303DLHC_IT1_DRY1 * @arg LSM303DLHC_IT1_DRY2 * @arg LSM303DLHC_IT1_WTM * @arg LSM303DLHC_IT1_OVERRUN * @retval None *//* ... */ void LSM303DLHC_AccIT1Disable(uint8_t LSM303DLHC_IT) { uint8_t tmpval = 0x00; /* Read CTRL_REG3 register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A); /* Disable IT1 */ tmpval &= ~LSM303DLHC_IT; /* Write value to MEMS CTRL_REG3 register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A, tmpval); }{ ... } /** * @brief Enable LSM303DLHC Interrupt2 * @param LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be enabled. * This parameter can be any combination of the following values: * @arg LSM303DLHC_IT2_CLICK * @arg LSM303DLHC_IT2_INT1 * @arg LSM303DLHC_IT2_INT2 * @arg LSM303DLHC_IT2_BOOT * @arg LSM303DLHC_IT2_ACT * @arg LSM303DLHC_IT2_HLACTIVE * @retval None *//* ... */ void LSM303DLHC_AccIT2Enable(uint8_t LSM303DLHC_IT) { uint8_t tmpval = 0x00; /* Read CTRL_REG3 register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A); /* Enable IT2 */ tmpval |= LSM303DLHC_IT; /* Write value to MEMS CTRL_REG3 register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A, tmpval); }{ ... } /** * @brief Disable LSM303DLHC Interrupt2 * @param LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be disabled. * This parameter can be any combination of the following values: * @arg LSM303DLHC_IT2_CLICK * @arg LSM303DLHC_IT2_INT1 * @arg LSM303DLHC_IT2_INT2 * @arg LSM303DLHC_IT2_BOOT * @arg LSM303DLHC_IT2_ACT * @arg LSM303DLHC_IT2_HLACTIVE * @retval None *//* ... */ void LSM303DLHC_AccIT2Disable(uint8_t LSM303DLHC_IT) { uint8_t tmpval = 0x00; /* Read CTRL_REG3 register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A); /* Disable IT2 */ tmpval &= ~LSM303DLHC_IT; /* Write value to MEMS CTRL_REG3 register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A, tmpval); }{ ... } /** * @brief INT1 interrupt enable * @param ITCombination: Or or And combination * ITAxes: Axes to be enabled * @retval None *//* ... */ void LSM303DLHC_AccINT1InterruptEnable(uint8_t ITCombination, uint8_t ITAxes) { uint8_t tmpval = 0x00; /* Read INT1_CFR register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A); /* Enable the selected interrupt */ tmpval |= (ITAxes | ITCombination); /* Write value to MEMS INT1_CFR register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A, tmpval); }{ ... } /** * @brief INT1 interrupt disable * @param ITCombination: Or or And combination * ITAxes: Axes to be enabled * @retval None *//* ... */ void LSM303DLHC_AccINT1InterruptDisable(uint8_t ITCombination, uint8_t ITAxes) { uint8_t tmpval = 0x00; /* Read INT1_CFR register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A); /* Disable the selected interrupt */ tmpval &= ~(ITAxes | ITCombination); /* Write value to MEMS INT1_CFR register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A, tmpval); }{ ... } /** * @brief INT2 interrupt enable * @param ITCombination: Or or And combination * ITAxes: axes to be enabled * @retval None *//* ... */ void LSM303DLHC_AccINT2InterruptEnable(uint8_t ITCombination, uint8_t ITAxes) { uint8_t tmpval = 0x00; /* Read INT2_CFR register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A); /* Enable the selected interrupt */ tmpval |= (ITAxes | ITCombination); /* Write value to MEMS INT2_CFR register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A, tmpval); }{ ... } /** * @brief INT2 interrupt config * @param ITCombination: Or or And combination * ITAxes: axes to be enabled * @retval None *//* ... */ void LSM303DLHC_AccINT2InterruptDisable(uint8_t ITCombination, uint8_t ITAxes) { uint8_t tmpval = 0x00; /* Read INT2_CFR register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A); /* Disable the selected interrupt */ tmpval &= ~(ITAxes | ITCombination); /* Write value to MEMS INT2_CFR register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A, tmpval); }{ ... } /** * @brief Click interrupt enable * @param ITClick: the selected interrupt to enable * @retval None *//* ... */ void LSM303DLHC_AccClickITEnable(uint8_t ITClick) { uint8_t tmpval = 0x00; /* Read CLICK_CFR register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A); /* Enable the selected interrupt */ tmpval |= ITClick; /* Write value to MEMS CLICK CFG register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A, tmpval); /* Configure Click Threshold on Z axis */ tmpval = 0x0A; COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_THS_A, tmpval); /* Configure Time Limit */ tmpval = 0x05; COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_TIME_LIMIT_A, tmpval); /* Configure Latency */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_TIME_LATENCY_A, tmpval); /* Configure Click Window */ tmpval = 0x32; COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_TIME_WINDOW_A, tmpval); }{ ... } /** * @brief Click interrupt disable * @param ITClick: the selected click interrupt to disable * @retval None *//* ... */ void LSM303DLHC_AccClickITDisable(uint8_t ITClick) { uint8_t tmpval = 0x00; /* Read CLICK_CFR register */ tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A); /* Disable the selected interrupt */ tmpval &= ~ITClick; /* Write value to MEMS CLICK_CFR register */ COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A, tmpval); }{ ... } /** * @brief Click on Z axis interrupt config * @param None * @retval None *//* ... */ void LSM303DLHC_AccZClickITConfig(void) { /* Configure low level IT config */ COMPASSACCELERO_IO_ITConfig(); /* Select click IT as INT1 interrupt */ LSM303DLHC_AccIT1Enable(LSM303DLHC_IT1_CLICK); /* Enable High pass filter for click IT */ LSM303DLHC_AccFilterClickCmd(LSM303DLHC_HPF_CLICK_ENABLE); /* Enable simple click IT on Z axis, */ LSM303DLHC_AccClickITEnable(LSM303DLHC_Z_SINGLE_CLICK); }{ ... } /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.