LibDriver L3GD20H
Loading...
Searching...
No Matches
driver_l3gd20h_fifo_test.c
Go to the documentation of this file.
1
37
39#include <stdlib.h>
40
41static l3gd20h_handle_t gs_handle;
42static volatile uint8_t g_flag = 0;
43static int16_t gs_raw[32][3];
44static float gs_dps[32][3];
45static volatile uint16_t gs_len;
46
55{
56 if (l3gd20h_irq_handler(&gs_handle, 2) != 0)
57 {
58 return 1;
59 }
60 else
61 {
62 return 0;
63 }
64}
65
71static void a_l3gd20h_interface_receive_callback(uint8_t type)
72{
73 switch (type)
74 {
76 {
77 uint8_t res;
78
79 gs_len = 32;
80 res = l3gd20h_read(&gs_handle, (int16_t (*)[3])(gs_raw), (float (*)[3])(gs_dps), (uint16_t *)&gs_len);
81 if (res == 0)
82 {
83 g_flag = 1;
84 }
85
86 /* disable fifo */
87 res = l3gd20h_set_fifo(&gs_handle, L3GD20H_BOOL_FALSE);
88 if (res != 0)
89 {
90 l3gd20h_interface_debug_print("l3gd20h: set fifo failed.\n");
91
92 return;
93 }
94
95 l3gd20h_interface_debug_print("l3gd20h: irq fifo threshold with %d.\n", gs_len);
96
97 break;
98 }
100 {
101 uint8_t res;
102
103 gs_len = 32;
104 res = l3gd20h_read(&gs_handle, (int16_t (*)[3])(gs_raw), (float (*)[3])(gs_dps), (uint16_t *)&gs_len);
105 if (res == 0)
106 {
107 g_flag = 1;
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 with %d.\n", gs_len);
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
146{
147 uint8_t res;
148 uint16_t threshold;
149 uint32_t timeout;
150 l3gd20h_info_t info;
151
152 /* link interface function */
164 DRIVER_L3GD20H_LINK_RECEIVE_CALLBACK(&gs_handle, a_l3gd20h_interface_receive_callback);
165
166 /* get information */
167 res = l3gd20h_info(&info);
168 if (res != 0)
169 {
170 l3gd20h_interface_debug_print("l3gd20h: get info failed.\n");
171
172 return 1;
173 }
174 else
175 {
176 /* print chip info */
177 l3gd20h_interface_debug_print("l3gd20h: chip is %s.\n", info.chip_name);
178 l3gd20h_interface_debug_print("l3gd20h: manufacturer is %s.\n", info.manufacturer_name);
179 l3gd20h_interface_debug_print("l3gd20h: interface is %s.\n", info.interface);
180 l3gd20h_interface_debug_print("l3gd20h: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
181 l3gd20h_interface_debug_print("l3gd20h: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
182 l3gd20h_interface_debug_print("l3gd20h: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
183 l3gd20h_interface_debug_print("l3gd20h: max current is %0.2fmA.\n", info.max_current_ma);
184 l3gd20h_interface_debug_print("l3gd20h: max temperature is %0.1fC.\n", info.temperature_max);
185 l3gd20h_interface_debug_print("l3gd20h: min temperature is %0.1fC.\n", info.temperature_min);
186 }
187
188 /* start fifo test */
189 l3gd20h_interface_debug_print("l3gd20h: start fifo test.\n");
190
191 /* set the interface */
192 res = l3gd20h_set_interface(&gs_handle, interface);
193 if (res != 0)
194 {
195 l3gd20h_interface_debug_print("l3gd20h: set interface failed.\n");
196
197 return 1;
198 }
199
200 /* set the address pin */
201 res = l3gd20h_set_addr_pin(&gs_handle, addr_pin);
202 if (res != 0)
203 {
204 l3gd20h_interface_debug_print("l3gd20h: set addr pin failed.\n");
205
206 return 1;
207 }
208
209 /* init the l3gd20h */
210 res = l3gd20h_init(&gs_handle);
211 if (res != 0)
212 {
213 l3gd20h_interface_debug_print("l3gd20h: init failed.\n");
214
215 return 1;
216 }
217
218 /* set normal boot */
219 res = l3gd20h_set_boot(&gs_handle, L3GD20H_BOOT_NORMAL);
220 if (res != 0)
221 {
222 l3gd20h_interface_debug_print("l3gd20h: set boot failed.\n");
223 (void)l3gd20h_deinit(&gs_handle);
224
225 return 1;
226 }
227
228 /* enable x axis*/
230 if (res != 0)
231 {
232 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
233 (void)l3gd20h_deinit(&gs_handle);
234
235 return 1;
236 }
237
238 /* enable y axis*/
240 if (res != 0)
241 {
242 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
243 (void)l3gd20h_deinit(&gs_handle);
244
245 return 1;
246 }
247
248 /* enable z axis*/
250 if (res != 0)
251 {
252 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
253 (void)l3gd20h_deinit(&gs_handle);
254
255 return 1;
256 }
257
258 /* set low power 12.5 Hz */
260 if (res != 0)
261 {
262 l3gd20h_interface_debug_print("l3gd20h: set rate bandwidth failed.\n");
263 (void)l3gd20h_deinit(&gs_handle);
264
265 return 1;
266 }
267
268 /* disable edge trigger */
270 if (res != 0)
271 {
272 l3gd20h_interface_debug_print("l3gd20h: set edge trigger failed.\n");
273 (void)l3gd20h_deinit(&gs_handle);
274
275 return 1;
276 }
277
278 /* disable level trigger */
280 if (res != 0)
281 {
282 l3gd20h_interface_debug_print("l3gd20h: set level trigger failed.\n");
283 (void)l3gd20h_deinit(&gs_handle);
284
285 return 1;
286 }
287
288 /* enable latched */
290 if (res != 0)
291 {
292 l3gd20h_interface_debug_print("l3gd20h: set level sensitive latched failed.\n");
293 (void)l3gd20h_deinit(&gs_handle);
294
295 return 1;
296 }
297
298 /* normal mode */
300 if (res != 0)
301 {
302 l3gd20h_interface_debug_print("l3gd20h: set self test failed.\n");
303 (void)l3gd20h_deinit(&gs_handle);
304
305 return 1;
306 }
307
308 /* set high pass filter normal mode */
310 if (res != 0)
311 {
312 l3gd20h_interface_debug_print("l3gd20h: set high pass filter normal mode failed.\n");
313 (void)l3gd20h_deinit(&gs_handle);
314
315 return 1;
316 }
317
318 /* set high pass filter cut-off frequency 0 */
320 if (res != 0)
321 {
322 l3gd20h_interface_debug_print("l3gd20h: set high pass filter cut off frequency failed.\n");
323 (void)l3gd20h_deinit(&gs_handle);
324
325 return 1;
326 }
327
328 /* enable high pass filter */
330 if (res != 0)
331 {
332 l3gd20h_interface_debug_print("l3gd20h: set high pass filter failed.\n");
333 (void)l3gd20h_deinit(&gs_handle);
334
335 return 1;
336 }
337
338 /* disable block data update */
340 if (res != 0)
341 {
342 l3gd20h_interface_debug_print("l3gd20h: set block data update failed.\n");
343 (void)l3gd20h_deinit(&gs_handle);
344
345 return 1;
346 }
347
348 /* set LPF1-HPF-LPF2 */
350 if (res != 0)
351 {
352 l3gd20h_interface_debug_print("l3gd20h: set out selection failed.\n");
353 (void)l3gd20h_deinit(&gs_handle);
354
355 return 1;
356 }
357
358 /* set LPF1-HPF-LPF2 */
360 if (res != 0)
361 {
362 l3gd20h_interface_debug_print("l3gd20h: set interrupt selection failed.\n");
363 (void)l3gd20h_deinit(&gs_handle);
364
365 return 1;
366 }
367
368 /* set high pass filter reference 0x00 */
369 res = l3gd20h_set_high_pass_filter_reference(&gs_handle, 0x00);
370 if (res != 0)
371 {
372 l3gd20h_interface_debug_print("l3gd20h: set high pass filter reference failed.\n");
373 (void)l3gd20h_deinit(&gs_handle);
374
375 return 1;
376 }
377
378 /* fifo mode */
380 if (res != 0)
381 {
382 l3gd20h_interface_debug_print("l3gd20h: set fifo mode failed.\n");
383 (void)l3gd20h_deinit(&gs_handle);
384
385 return 1;
386 }
387
388 /* disable interrupt 1*/
390 if (res != 0)
391 {
392 l3gd20h_interface_debug_print("l3gd20h: set interrupt1 failed.\n");
393 (void)l3gd20h_deinit(&gs_handle);
394
395 return 1;
396 }
397
398 /* disable boot on interrupt 1*/
400 if (res != 0)
401 {
402 l3gd20h_interface_debug_print("l3gd20h: set boot on interrupt1 failed.\n");
403 (void)l3gd20h_deinit(&gs_handle);
404
405 return 1;
406 }
407
408 /* active level low */
410 if (res != 0)
411 {
412 l3gd20h_interface_debug_print("l3gd20h: set interrupt active level failed.\n");
413 (void)l3gd20h_deinit(&gs_handle);
414
415 return 1;
416 }
417
418 /* push-pull pin type */
420 if (res != 0)
421 {
422 l3gd20h_interface_debug_print("l3gd20h: set interrupt pin type failed.\n");
423 (void)l3gd20h_deinit(&gs_handle);
424
425 return 1;
426 }
427
428 /* disable data ready on interrupt2 */
430 if (res != 0)
431 {
432 l3gd20h_interface_debug_print("l3gd20h: set data ready on interrupt2 failed.\n");
433 (void)l3gd20h_deinit(&gs_handle);
434
435 return 1;
436 }
437
438 /* enable fifo threshold on interrupt2 */
440 if (res != 0)
441 {
442 l3gd20h_interface_debug_print("l3gd20h: set fifo threshold on interrupt2 failed.\n");
443 (void)l3gd20h_deinit(&gs_handle);
444
445 return 1;
446 }
447
448 /* enable fifo overrun on interrupt2 */
450 if (res != 0)
451 {
452 l3gd20h_interface_debug_print("l3gd20h: set fifo overrun on interrupt2 failed.\n");
453 (void)l3gd20h_deinit(&gs_handle);
454
455 return 1;
456 }
457
458 /* disable fifo empty on interrupt2 */
460 if (res != 0)
461 {
462 l3gd20h_interface_debug_print("l3gd20h: set fifo empty on interrupt2 failed.\n");
463 (void)l3gd20h_deinit(&gs_handle);
464
465 return 1;
466 }
467
468 /* disable L3GD20H_INTERRUPT_EVENT_AND_OR_COMBINATION */
470 if (res != 0)
471 {
472 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
473 (void)l3gd20h_deinit(&gs_handle);
474
475 return 1;
476 }
477
478 /* disable L3GD20H_INTERRUPT_EVENT_LATCH */
480 if (res != 0)
481 {
482 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
483 (void)l3gd20h_deinit(&gs_handle);
484
485 return 1;
486 }
487
488 /* disable L3GD20H_INTERRUPT_EVENT_Z_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 /* disable L3GD20H_INTERRUPT_EVENT_Z_LOW_EVENT */
500 if (res != 0)
501 {
502 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
503 (void)l3gd20h_deinit(&gs_handle);
504
505 return 1;
506 }
507
508 /* disable L3GD20H_INTERRUPT_EVENT_Y_HIGH_EVENT */
510 if (res != 0)
511 {
512 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
513 (void)l3gd20h_deinit(&gs_handle);
514
515 return 1;
516 }
517
518 /* disable L3GD20H_INTERRUPT_EVENT_Y_LOW_EVENT */
520 if (res != 0)
521 {
522 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
523 (void)l3gd20h_deinit(&gs_handle);
524
525 return 1;
526 }
527
528 /* disable L3GD20H_INTERRUPT_EVENT_X_HIGH_EVENT */
530 if (res != 0)
531 {
532 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
533 (void)l3gd20h_deinit(&gs_handle);
534
535 return 1;
536 }
537
538 /* disable L3GD20H_INTERRUPT_EVENT_X_LOW_EVENT */
540 if (res != 0)
541 {
542 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
543 (void)l3gd20h_deinit(&gs_handle);
544
545 return 1;
546 }
547
548 /* convert the threshold */
549 res = l3gd20h_interrupt_threshold_convert_to_register(&gs_handle, 0.0f, (uint16_t *)&threshold);
550 if (res != 0)
551 {
552 l3gd20h_interface_debug_print("l3gd20h: convert to register failed.\n");
553 (void)l3gd20h_deinit(&gs_handle);
554
555 return 1;
556 }
557
558 /* set x interrupt threshold */
559 res = l3gd20h_set_x_interrupt_threshold(&gs_handle, threshold);
560 if (res != 0)
561 {
562 l3gd20h_interface_debug_print("l3gd20h: set x interrupt threshold failed.\n");
563 (void)l3gd20h_deinit(&gs_handle);
564
565 return 1;
566 }
567
568 /* set y interrupt threshold */
569 res = l3gd20h_set_y_interrupt_threshold(&gs_handle, threshold);
570 if (res != 0)
571 {
572 l3gd20h_interface_debug_print("l3gd20h: set y interrupt threshold failed.\n");
573 (void)l3gd20h_deinit(&gs_handle);
574
575 return 1;
576 }
577
578 /* set z interrupt threshold */
579 res = l3gd20h_set_z_interrupt_threshold(&gs_handle, threshold);
580 if (res != 0)
581 {
582 l3gd20h_interface_debug_print("l3gd20h: set z interrupt threshold failed.\n");
583 (void)l3gd20h_deinit(&gs_handle);
584
585 return 1;
586 }
587
588 /* reset counter mode */
590 if (res != 0)
591 {
592 l3gd20h_interface_debug_print("l3gd20h: set counter mode failed.\n");
593 (void)l3gd20h_deinit(&gs_handle);
594
595 return 1;
596 }
597
598 /* enable wait */
599 res = l3gd20h_set_wait(&gs_handle, L3GD20H_BOOL_TRUE);
600 if (res != 0)
601 {
602 l3gd20h_interface_debug_print("l3gd20h: set wait failed.\n");
603 (void)l3gd20h_deinit(&gs_handle);
604
605 return 1;
606 }
607
608 /* set duration 0x01 */
609 res = l3gd20h_set_duration(&gs_handle, 0x01);
610 if (res != 0)
611 {
612 l3gd20h_interface_debug_print("l3gd20h: set duration failed.\n");
613 (void)l3gd20h_deinit(&gs_handle);
614
615 return 1;
616 }
617
618 /* set data ready active level low */
620 if (res != 0)
621 {
622 l3gd20h_interface_debug_print("l3gd20h: set data ready active level failed.\n");
623 (void)l3gd20h_deinit(&gs_handle);
624
625 return 1;
626 }
627
628 /* little endian */
630 if (res != 0)
631 {
632 l3gd20h_interface_debug_print("l3gd20h: set data format failed.\n");
633 (void)l3gd20h_deinit(&gs_handle);
634
635 return 1;
636 }
637
638 /* ±245 dps */
640 if (res != 0)
641 {
642 l3gd20h_interface_debug_print("l3gd20h: set full scale failed.\n");
643 (void)l3gd20h_deinit(&gs_handle);
644
645 return 1;
646 }
647
648 /* normal mode */
649 res = l3gd20h_set_mode(&gs_handle, L3GD20H_MODE_NORMAL);
650 if (res != 0)
651 {
652 l3gd20h_interface_debug_print("l3gd20h: set mode failed.\n");
653 (void)l3gd20h_deinit(&gs_handle);
654
655 return 1;
656 }
657
658 /* disable stop on fifo threshold */
660 if (res != 0)
661 {
662 l3gd20h_interface_debug_print("l3gd20h: set stop on fifo threshold failed.\n");
663 (void)l3gd20h_deinit(&gs_handle);
664
665 return 1;
666 }
667
668 /* fifo threshold 16 */
669 res = l3gd20h_set_fifo_threshold(&gs_handle, 16);
670 if (res != 0)
671 {
672 l3gd20h_interface_debug_print("l3gd20h: set fifo threshold failed.\n");
673 (void)l3gd20h_deinit(&gs_handle);
674
675 return 1;
676 }
677
678 /* enable fifo */
679 res = l3gd20h_set_fifo(&gs_handle, L3GD20H_BOOL_TRUE);
680 if (res != 0)
681 {
682 l3gd20h_interface_debug_print("l3gd20h: set fifo failed.\n");
683 (void)l3gd20h_deinit(&gs_handle);
684
685 return 1;
686 }
687
688 timeout = 5000;
689 g_flag = 0;
690 while (timeout != 0)
691 {
692 if (g_flag != 0)
693 {
694 l3gd20h_interface_debug_print("l3gd20h: find interrupt.\n");
695
696 break;
697 }
699 timeout--;
700 }
701 if (timeout == 0)
702 {
703 /* fifo test failed */
704 l3gd20h_interface_debug_print("l3gd20h: fifo test failed.\n");
705
706 (void)l3gd20h_deinit(&gs_handle);
707
708 return 1;
709 }
710 else
711 {
712 /* finish fifo test */
713 l3gd20h_interface_debug_print("l3gd20h: finish fifo test.\n");
714
715 (void)l3gd20h_deinit(&gs_handle);
716
717 return 0;
718 }
719}
driver l3gd20h fifo test 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
struct l3gd20h_info_s l3gd20h_info_t
l3gd20h information structure definition
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_info(l3gd20h_info_t *info)
get chip's information
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_BOOT_NORMAL
@ L3GD20H_SELF_TEST_NORMAL
@ L3GD20H_FULL_SCALE_245_DPS
@ L3GD20H_HIGH_PASS_FILTER_MODE_NORMAL
@ L3GD20H_DATA_FORMAT_LITTLE_ENDIAN
@ L3GD20H_HIGH_PASS_FILTER_CUT_OFF_FREQUENCY_0
@ L3GD20H_AXIS_X
@ L3GD20H_AXIS_Z
@ L3GD20H_AXIS_Y
@ L3GD20H_SELECTION_LPF1_HPF_LPF2
@ L3GD20H_MODE_NORMAL
@ L3GD20H_BOOL_FALSE
@ L3GD20H_BOOL_TRUE
@ L3GD20H_LOW_ODR_1_ODR_12P5HZ_BW_0_NA
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
@ L3GD20H_COUNTER_MODE_RESET
@ L3GD20H_INTERRUPT_ACTIVE_LEVEL_LOW
@ L3GD20H_PIN_PUSH_PULL
uint8_t l3gd20h_fifo_test_irq_handler(void)
fifo test irq callback
uint8_t l3gd20h_fifo_test(l3gd20h_interface_t interface, l3gd20h_address_t addr_pin)
fifo test
uint32_t driver_version
char manufacturer_name[32]