LibDriver L3GD20H
Loading...
Searching...
No Matches
driver_l3gd20h_fifo.c
Go to the documentation of this file.
1
37
38#include "driver_l3gd20h_fifo.h"
39
40static l3gd20h_handle_t gs_handle;
41static void (*a_callback)(float (*dps)[3], uint16_t len) = NULL;
42static int16_t gs_raw[32][3];
43static float gs_data[32][3];
44
53{
54 if (l3gd20h_irq_handler(&gs_handle, 2) != 0)
55 {
56 return 1;
57 }
58 else
59 {
60 return 0;
61 }
62}
63
69static void a_l3gd20h_interface_receive_callback(uint8_t type)
70{
71 switch (type)
72 {
74 {
75 uint8_t res;
76 uint16_t len;
77
78 len = 32;
79 res = l3gd20h_read(&gs_handle, (int16_t (*)[3])(gs_raw), (float (*)[3])(gs_data), (uint16_t *)&len);
80 if (res == 0)
81 {
82 if (a_callback != NULL)
83 {
84 a_callback(gs_data, len);
85 }
86 }
87 else
88 {
89 l3gd20h_interface_debug_print("l3gd20h: read failed.\n");
90
91 return;
92 }
93
94 break;
95 }
97 {
98 uint8_t res;
99 uint16_t len;
100
101 len = 32;
102 res = l3gd20h_read(&gs_handle, (int16_t (*)[3])(gs_raw), (float (*)[3])(gs_data), (uint16_t *)&len);
103 if (res != 0)
104 {
105 l3gd20h_interface_debug_print("l3gd20h: read failed.\n");
106
107 return;
108 }
109
110 /* disable fifo */
111 res = l3gd20h_set_fifo(&gs_handle, L3GD20H_BOOL_FALSE);
112 if (res != 0)
113 {
114 l3gd20h_interface_debug_print("l3gd20h: set fifo failed.\n");
115
116 return;
117 }
118
119 l3gd20h_interface_debug_print("l3gd20h: irq fifo overrun.\n");
120
121 break;
122 }
124 {
125 l3gd20h_interface_debug_print("l3gd20h: irq fifo empty.\n");
126
127 break;
128 }
129 default :
130 {
131 break;
132 }
133 }
134}
135
147 void (*callback)(float (*dps)[3], uint16_t len))
148{
149 uint8_t res;
150 uint16_t threshold;
151
152 /* link interface function */
164 DRIVER_L3GD20H_LINK_RECEIVE_CALLBACK(&gs_handle, a_l3gd20h_interface_receive_callback);
165
166 /* set the interface */
167 res = l3gd20h_set_interface(&gs_handle, interface);
168 if (res != 0)
169 {
170 l3gd20h_interface_debug_print("l3gd20h: set interface failed.\n");
171
172 return 1;
173 }
174
175 /* set the address pin */
176 res = l3gd20h_set_addr_pin(&gs_handle, addr_pin);
177 if (res != 0)
178 {
179 l3gd20h_interface_debug_print("l3gd20h: set addr pin failed.\n");
180
181 return 1;
182 }
183
184 /* init the l3gd20h */
185 res = l3gd20h_init(&gs_handle);
186 if (res != 0)
187 {
188 l3gd20h_interface_debug_print("l3gd20h: init failed.\n");
189
190 return 1;
191 }
192
193 /* set boot */
195 if (res != 0)
196 {
197 l3gd20h_interface_debug_print("l3gd20h: set boot failed.\n");
198 (void)l3gd20h_deinit(&gs_handle);
199
200 return 1;
201 }
202
203 /* set x axis*/
205 if (res != 0)
206 {
207 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
208 (void)l3gd20h_deinit(&gs_handle);
209
210 return 1;
211 }
212
213 /* set y axis*/
215 if (res != 0)
216 {
217 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
218 (void)l3gd20h_deinit(&gs_handle);
219
220 return 1;
221 }
222
223 /* set z axis*/
225 if (res != 0)
226 {
227 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
228 (void)l3gd20h_deinit(&gs_handle);
229
230 return 1;
231 }
232
233 /* set rate bandwidth */
235 if (res != 0)
236 {
237 l3gd20h_interface_debug_print("l3gd20h: set rate bandwidth failed.\n");
238 (void)l3gd20h_deinit(&gs_handle);
239
240 return 1;
241 }
242
243 /* set edge trigger */
245 if (res != 0)
246 {
247 l3gd20h_interface_debug_print("l3gd20h: set edge trigger failed.\n");
248 (void)l3gd20h_deinit(&gs_handle);
249
250 return 1;
251 }
252
253 /* set level trigger */
255 if (res != 0)
256 {
257 l3gd20h_interface_debug_print("l3gd20h: set level trigger failed.\n");
258 (void)l3gd20h_deinit(&gs_handle);
259
260 return 1;
261 }
262
263 /* set latched */
265 if (res != 0)
266 {
267 l3gd20h_interface_debug_print("l3gd20h: set level sensitive latched failed.\n");
268 (void)l3gd20h_deinit(&gs_handle);
269
270 return 1;
271 }
272
273 /* set self test */
275 if (res != 0)
276 {
277 l3gd20h_interface_debug_print("l3gd20h: set self test failed.\n");
278 (void)l3gd20h_deinit(&gs_handle);
279
280 return 1;
281 }
282
283 /* set high pass filter mode */
285 if (res != 0)
286 {
287 l3gd20h_interface_debug_print("l3gd20h: set high pass filter normal mode failed.\n");
288 (void)l3gd20h_deinit(&gs_handle);
289
290 return 1;
291 }
292
293 /* set high pass filter cut off */
295 if (res != 0)
296 {
297 l3gd20h_interface_debug_print("l3gd20h: set high pass filter cut off frequency failed.\n");
298 (void)l3gd20h_deinit(&gs_handle);
299
300 return 1;
301 }
302
303 /* set high pass filter */
305 if (res != 0)
306 {
307 l3gd20h_interface_debug_print("l3gd20h: set high pass filter failed.\n");
308 (void)l3gd20h_deinit(&gs_handle);
309
310 return 1;
311 }
312
313 /* set block data update */
315 if (res != 0)
316 {
317 l3gd20h_interface_debug_print("l3gd20h: set block data update failed.\n");
318 (void)l3gd20h_deinit(&gs_handle);
319
320 return 1;
321 }
322
323 /* set out selection */
325 if (res != 0)
326 {
327 l3gd20h_interface_debug_print("l3gd20h: set out selection failed.\n");
328 (void)l3gd20h_deinit(&gs_handle);
329
330 return 1;
331 }
332
333 /* set interrupt selection */
335 if (res != 0)
336 {
337 l3gd20h_interface_debug_print("l3gd20h: set interrupt selection failed.\n");
338 (void)l3gd20h_deinit(&gs_handle);
339
340 return 1;
341 }
342
343 /* set high pass filter reference */
345 if (res != 0)
346 {
347 l3gd20h_interface_debug_print("l3gd20h: set high pass filter reference failed.\n");
348 (void)l3gd20h_deinit(&gs_handle);
349
350 return 1;
351 }
352
353 /* set fifo mode */
355 if (res != 0)
356 {
357 l3gd20h_interface_debug_print("l3gd20h: set fifo mode failed.\n");
358 (void)l3gd20h_deinit(&gs_handle);
359
360 return 1;
361 }
362
363 /* set interrupt 1*/
365 if (res != 0)
366 {
367 l3gd20h_interface_debug_print("l3gd20h: set interrupt1 failed.\n");
368 (void)l3gd20h_deinit(&gs_handle);
369
370 return 1;
371 }
372
373 /* set boot on interrupt 1*/
375 if (res != 0)
376 {
377 l3gd20h_interface_debug_print("l3gd20h: set boot on interrupt1 failed.\n");
378 (void)l3gd20h_deinit(&gs_handle);
379
380 return 1;
381 }
382
383 /* set active level */
385 if (res != 0)
386 {
387 l3gd20h_interface_debug_print("l3gd20h: set interrupt active level failed.\n");
388 (void)l3gd20h_deinit(&gs_handle);
389
390 return 1;
391 }
392
393 /* set interrupt pin type */
395 if (res != 0)
396 {
397 l3gd20h_interface_debug_print("l3gd20h: set interrupt pin type failed.\n");
398 (void)l3gd20h_deinit(&gs_handle);
399
400 return 1;
401 }
402
403 /* set data ready on interrupt2 */
405 if (res != 0)
406 {
407 l3gd20h_interface_debug_print("l3gd20h: set data ready on interrupt2 failed.\n");
408 (void)l3gd20h_deinit(&gs_handle);
409
410 return 1;
411 }
412
413 /* set fifo threshold on interrupt2 */
415 if (res != 0)
416 {
417 l3gd20h_interface_debug_print("l3gd20h: set fifo threshold on interrupt2 failed.\n");
418 (void)l3gd20h_deinit(&gs_handle);
419
420 return 1;
421 }
422
423 /* set fifo overrun on interrupt2 */
425 if (res != 0)
426 {
427 l3gd20h_interface_debug_print("l3gd20h: set fifo overrun on interrupt2 failed.\n");
428 (void)l3gd20h_deinit(&gs_handle);
429
430 return 1;
431 }
432
433 /* set fifo empty on interrupt2 */
435 if (res != 0)
436 {
437 l3gd20h_interface_debug_print("l3gd20h: set fifo empty on interrupt2 failed.\n");
438 (void)l3gd20h_deinit(&gs_handle);
439
440 return 1;
441 }
442
443 /* set L3GD20H_INTERRUPT_EVENT_AND_OR_COMBINATION */
446 if (res != 0)
447 {
448 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
449 (void)l3gd20h_deinit(&gs_handle);
450
451 return 1;
452 }
453
454 /* set L3GD20H_INTERRUPT_EVENT_LATCH */
457 if (res != 0)
458 {
459 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
460 (void)l3gd20h_deinit(&gs_handle);
461
462 return 1;
463 }
464
465 /* set L3GD20H_INTERRUPT_EVENT_Z_HIGH_EVENT */
468 if (res != 0)
469 {
470 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
471 (void)l3gd20h_deinit(&gs_handle);
472
473 return 1;
474 }
475
476 /* set L3GD20H_INTERRUPT_EVENT_Z_LOW_EVENT */
479 if (res != 0)
480 {
481 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
482 (void)l3gd20h_deinit(&gs_handle);
483
484 return 1;
485 }
486
487 /* set L3GD20H_INTERRUPT_EVENT_Y_HIGH_EVENT */
490 if (res != 0)
491 {
492 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
493 (void)l3gd20h_deinit(&gs_handle);
494
495 return 1;
496 }
497
498 /* set L3GD20H_INTERRUPT_EVENT_Y_LOW_EVENT */
501 if (res != 0)
502 {
503 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
504 (void)l3gd20h_deinit(&gs_handle);
505
506 return 1;
507 }
508
509 /* set L3GD20H_INTERRUPT_EVENT_X_HIGH_EVENT */
512 if (res != 0)
513 {
514 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
515 (void)l3gd20h_deinit(&gs_handle);
516
517 return 1;
518 }
519
520 /* set L3GD20H_INTERRUPT_EVENT_X_LOW_EVENT */
523 if (res != 0)
524 {
525 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
526 (void)l3gd20h_deinit(&gs_handle);
527
528 return 1;
529 }
530
531 /* convert the threshold */
533 (uint16_t *)&threshold);
534 if (res != 0)
535 {
536 l3gd20h_interface_debug_print("l3gd20h: convert to register failed.\n");
537 (void)l3gd20h_deinit(&gs_handle);
538
539 return 1;
540 }
541
542 /* set x interrupt threshold */
543 res = l3gd20h_set_x_interrupt_threshold(&gs_handle, threshold);
544 if (res != 0)
545 {
546 l3gd20h_interface_debug_print("l3gd20h: set x interrupt threshold failed.\n");
547 (void)l3gd20h_deinit(&gs_handle);
548
549 return 1;
550 }
551
552 /* set y interrupt threshold */
553 res = l3gd20h_set_y_interrupt_threshold(&gs_handle, threshold);
554 if (res != 0)
555 {
556 l3gd20h_interface_debug_print("l3gd20h: set y interrupt threshold failed.\n");
557 (void)l3gd20h_deinit(&gs_handle);
558
559 return 1;
560 }
561
562 /* set z interrupt threshold */
563 res = l3gd20h_set_z_interrupt_threshold(&gs_handle, threshold);
564 if (res != 0)
565 {
566 l3gd20h_interface_debug_print("l3gd20h: set z interrupt threshold failed.\n");
567 (void)l3gd20h_deinit(&gs_handle);
568
569 return 1;
570 }
571
572 /* set counter mode */
574 if (res != 0)
575 {
576 l3gd20h_interface_debug_print("l3gd20h: set counter mode failed.\n");
577 (void)l3gd20h_deinit(&gs_handle);
578
579 return 1;
580 }
581
582 /* set wait */
584 if (res != 0)
585 {
586 l3gd20h_interface_debug_print("l3gd20h: set wait failed.\n");
587 (void)l3gd20h_deinit(&gs_handle);
588
589 return 1;
590 }
591
592 /* set duration */
594 if (res != 0)
595 {
596 l3gd20h_interface_debug_print("l3gd20h: set duration failed.\n");
597 (void)l3gd20h_deinit(&gs_handle);
598
599 return 1;
600 }
601
602 /* set data ready active level */
604 if (res != 0)
605 {
606 l3gd20h_interface_debug_print("l3gd20h: set data ready active level failed.\n");
607 (void)l3gd20h_deinit(&gs_handle);
608
609 return 1;
610 }
611
612 /* enable fifo */
613 res = l3gd20h_set_fifo(&gs_handle, L3GD20H_BOOL_TRUE);
614 if (res != 0)
615 {
616 l3gd20h_interface_debug_print("l3gd20h: set fifo failed.\n");
617 (void)l3gd20h_deinit(&gs_handle);
618
619 return 1;
620 }
621
622 /* set stop on fifo threshold */
624 if (res != 0)
625 {
626 l3gd20h_interface_debug_print("l3gd20h: set stop on fifo threshold failed.\n");
627 (void)l3gd20h_deinit(&gs_handle);
628
629 return 1;
630 }
631
632 /* set fifo threshold */
634 if (res != 0)
635 {
636 l3gd20h_interface_debug_print("l3gd20h: set fifo threshold failed.\n");
637 (void)l3gd20h_deinit(&gs_handle);
638
639 return 1;
640 }
641
642 /* set endian */
644 if (res != 0)
645 {
646 l3gd20h_interface_debug_print("l3gd20h: set data format failed.\n");
647 (void)l3gd20h_deinit(&gs_handle);
648
649 return 1;
650 }
651
652 /* set full scale */
654 if (res != 0)
655 {
656 l3gd20h_interface_debug_print("l3gd20h: set full scale failed.\n");
657 (void)l3gd20h_deinit(&gs_handle);
658
659 return 1;
660 }
661
662 /* normal mode */
663 res = l3gd20h_set_mode(&gs_handle, L3GD20H_MODE_NORMAL);
664 if (res != 0)
665 {
666 l3gd20h_interface_debug_print("l3gd20h: set mode failed.\n");
667 (void)l3gd20h_deinit(&gs_handle);
668
669 return 1;
670 }
671
672 a_callback = callback;
673
674 /* success return 0 */
675 return 0;
676}
677
686{
687 if (l3gd20h_deinit(&gs_handle) != 0)
688 {
689 return 1;
690 }
691 else
692 {
693 return 0;
694 }
695}
driver l3gd20h fifo header file
uint8_t l3gd20h_set_high_pass_filter(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable high pass filter
uint8_t l3gd20h_set_data_format(l3gd20h_handle_t *handle, l3gd20h_data_format_t data_format)
set the data format
uint8_t l3gd20h_set_block_data_update(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the block data update
uint8_t l3gd20h_set_mode(l3gd20h_handle_t *handle, l3gd20h_mode_t mode)
set the chip mode
uint8_t l3gd20h_set_high_pass_filter_mode(l3gd20h_handle_t *handle, l3gd20h_high_pass_filter_mode_t mode)
set the high pass filter mode
uint8_t l3gd20h_set_rate_bandwidth(l3gd20h_handle_t *handle, l3gd20h_lodr_odr_bw_t rate_bandwidth)
set the rate bandwidth
uint8_t l3gd20h_set_level_sensitive_latched(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the level sensitive latched
uint8_t l3gd20h_read(l3gd20h_handle_t *handle, int16_t(*raw)[3], float(*dps)[3], uint16_t *len)
read the data
uint8_t l3gd20h_set_out_selection(l3gd20h_handle_t *handle, l3gd20h_selection_t selection)
set the out selection
uint8_t l3gd20h_set_boot(l3gd20h_handle_t *handle, l3gd20h_boot_t boot)
set the boot
uint8_t l3gd20h_set_addr_pin(l3gd20h_handle_t *handle, l3gd20h_address_t addr_pin)
set the iic address pin
l3gd20h_address_t
l3gd20h address enumeration definition
uint8_t l3gd20h_set_interface(l3gd20h_handle_t *handle, l3gd20h_interface_t interface)
set the chip interface
uint8_t l3gd20h_set_high_pass_filter_reference(l3gd20h_handle_t *handle, uint8_t value)
set the high pass filter reference
uint8_t l3gd20h_deinit(l3gd20h_handle_t *handle)
close the chip
uint8_t l3gd20h_set_edge_trigger(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the edge trigger
l3gd20h_interface_t
l3gd20h interface enumeration definition
uint8_t l3gd20h_set_full_scale(l3gd20h_handle_t *handle, l3gd20h_full_scale_t full_scale)
set the full scale
uint8_t l3gd20h_irq_handler(l3gd20h_handle_t *handle, uint8_t num)
interrupt handler
uint8_t l3gd20h_init(l3gd20h_handle_t *handle)
initialize the chip
uint8_t l3gd20h_set_level_trigger(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the level trigger
uint8_t l3gd20h_set_self_test(l3gd20h_handle_t *handle, l3gd20h_self_test_t self_test)
set the self test
uint8_t l3gd20h_set_high_pass_filter_cut_off_frequency(l3gd20h_handle_t *handle, l3gd20h_high_pass_filter_cut_off_frequency_t frequency)
set the high pass filter cut off frequency
uint8_t l3gd20h_set_axis(l3gd20h_handle_t *handle, l3gd20h_axis_t axis, l3gd20h_bool_t enable)
set the axis
struct l3gd20h_handle_s l3gd20h_handle_t
l3gd20h handle structure definition
@ L3GD20H_AXIS_X
@ L3GD20H_AXIS_Z
@ L3GD20H_AXIS_Y
@ L3GD20H_MODE_NORMAL
@ L3GD20H_BOOL_FALSE
@ L3GD20H_BOOL_TRUE
#define L3GD20H_FIFO_DEFAULT_DATA_FORMAT
#define L3GD20H_FIFO_DEFAULT_SELF_TEST
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_ACTIVE_LEVEL
#define L3GD20H_FIFO_DEFAULT_BLOCK_DATA_UPDATE
#define L3GD20H_FIFO_DEFAULT_AXIS_Z
uint8_t l3gd20h_fifo_irq_handler(void)
fifo example irq callback
#define L3GD20H_FIFO_DEFAULT_EDGE_TRIGGER
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER_REFERENCE
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_PIN_TYPE
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_LATCH
#define L3GD20H_FIFO_DEFAULT_BOOT_ON_INTERRUPT1
#define L3GD20H_FIFO_DEFAULT_AXIS_Y
#define L3GD20H_FIFO_DEFAULT_INTERRUPT1
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Y_LOW_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Y_HIGH_EVENT
#define L3GD20H_FIFO_DEFAULT_FIFO_EMPTY_ON_INTERRUPT2
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER
#define L3GD20H_FIFO_DEFAULT_RATE_BANDWIDTH
#define L3GD20H_FIFO_DEFAULT_DATA_READY_ON_INTERRUPT2
#define L3GD20H_FIFO_DEFAULT_COUNTER_MODE
uint8_t l3gd20h_fifo_deinit(void)
fifo example deinit
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_X_LOW_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_X_HIGH_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Z_HIGH_EVENT
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_Z_LOW_EVENT
#define L3GD20H_FIFO_DEFAULT_LEVEL_TRIGGER
#define L3GD20H_FIFO_DEFAULT_WAIT
#define L3GD20H_FIFO_DEFAULT_FIFO_THRESHOLD
#define L3GD20H_FIFO_DEFAULT_FULL_SCALE
#define L3GD20H_FIFO_DEFAULT_DATA_READY_ACTIVE_LEVEL
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_EVENT_AND_OR_COMBINATION
#define L3GD20H_FIFO_DEFAULT_STOP_ON_FIFO_THRESHOLD
#define L3GD20H_FIFO_DEFAULT_LEVEL_SENSITIVE_LATCHED
#define L3GD20H_FIFO_DEFAULT_OUT_SELECTION
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER_MODE
#define L3GD20H_FIFO_DEFAULT_DURATION
uint8_t l3gd20h_fifo_init(l3gd20h_interface_t interface, l3gd20h_address_t addr_pin, void(*callback)(float(*dps)[3], uint16_t len))
fifo example init
#define L3GD20H_FIFO_DEFAULT_BOOT
l3gd20h fifo example default definition
#define L3GD20H_FIFO_DEFAULT_AXIS_X
#define L3GD20H_FIFO_DEFAULT_HIGH_PASS_FILTER_CUT_OFF
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_THRESHOLD
#define L3GD20H_FIFO_DEFAULT_INTERRUPT_SELECTION
uint8_t l3gd20h_set_stop_on_fifo_threshold(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable stop on fifo threshold
uint8_t l3gd20h_set_fifo_mode(l3gd20h_handle_t *handle, l3gd20h_fifo_mode_t fifo_mode)
set the fifo mode
uint8_t l3gd20h_set_fifo(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo
uint8_t l3gd20h_set_fifo_threshold(l3gd20h_handle_t *handle, uint8_t threshold)
set the fifo threshold
@ L3GD20H_FIFO_MODE_FIFO
void l3gd20h_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t l3gd20h_interface_iic_deinit(void)
interface iic bus deinit
uint8_t l3gd20h_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
uint8_t l3gd20h_interface_iic_init(void)
interface iic bus init
uint8_t l3gd20h_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
uint8_t l3gd20h_interface_spi_init(void)
interface spi bus init
uint8_t l3gd20h_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
uint8_t l3gd20h_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
uint8_t l3gd20h_interface_spi_deinit(void)
interface spi bus deinit
void l3gd20h_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t l3gd20h_set_interrupt_pin_type(l3gd20h_handle_t *handle, l3gd20h_pin_type_t pin_type)
set the interrupt pin type
uint8_t l3gd20h_set_data_ready_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the data ready on interrupt2
uint8_t l3gd20h_set_boot_on_interrupt1(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable boot on the interrupt1
uint8_t l3gd20h_set_x_interrupt_threshold(l3gd20h_handle_t *handle, uint16_t threshold)
set the x interrupt threshold
uint8_t l3gd20h_set_wait(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the wait
uint8_t l3gd20h_set_interrupt_event(l3gd20h_handle_t *handle, l3gd20h_interrupt_event_t interrupt_event, l3gd20h_bool_t enable)
set the interrupt event
uint8_t l3gd20h_set_duration(l3gd20h_handle_t *handle, uint8_t duration)
set the wait duration
uint8_t l3gd20h_set_fifo_threshold_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo threshold on interrupt2
uint8_t l3gd20h_set_data_ready_active_level(l3gd20h_handle_t *handle, l3gd20h_interrupt_active_level_t level)
set the data ready active level
uint8_t l3gd20h_set_counter_mode(l3gd20h_handle_t *handle, l3gd20h_counter_mode_t counter_mode)
set the counter mode
uint8_t l3gd20h_set_interrupt_active_level(l3gd20h_handle_t *handle, l3gd20h_interrupt_active_level_t level)
set the interrupt active level
uint8_t l3gd20h_set_fifo_overrun_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo overrun on interrupt2
uint8_t l3gd20h_interrupt_threshold_convert_to_register(l3gd20h_handle_t *handle, float dps, uint16_t *reg)
convert the interrupt threshold real data to the register raw data
uint8_t l3gd20h_set_interrupt_selection(l3gd20h_handle_t *handle, l3gd20h_selection_t selection)
set the interrupt selection
uint8_t l3gd20h_set_fifo_empty_on_interrupt2(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the fifo empty on interrupt2
uint8_t l3gd20h_set_z_interrupt_threshold(l3gd20h_handle_t *handle, uint16_t threshold)
set the z interrupt threshold
uint8_t l3gd20h_set_interrupt1(l3gd20h_handle_t *handle, l3gd20h_bool_t enable)
enable or disable the interrupt1
uint8_t l3gd20h_set_y_interrupt_threshold(l3gd20h_handle_t *handle, uint16_t threshold)
set the y interrupt threshold
@ L3GD20H_INTERRUPT_EVENT_Z_LOW_EVENT
@ L3GD20H_INTERRUPT_EVENT_Y_HIGH_EVENT
@ L3GD20H_INTERRUPT_EVENT_Y_LOW_EVENT
@ L3GD20H_INTERRUPT_EVENT_AND_OR_COMBINATION
@ L3GD20H_INTERRUPT_EVENT_LATCH
@ L3GD20H_INTERRUPT_EVENT_X_LOW_EVENT
@ L3GD20H_INTERRUPT_EVENT_Z_HIGH_EVENT
@ L3GD20H_INTERRUPT_EVENT_X_HIGH_EVENT
@ L3GD20H_INTERRUPT2_FIFO_EMPTY
@ L3GD20H_INTERRUPT2_FIFO_THRESHOLD
@ L3GD20H_INTERRUPT2_FIFO_OVERRRUN