LibDriver L3GD20H
Loading...
Searching...
No Matches
driver_l3gd20h_interrupt.c
Go to the documentation of this file.
1
37
39
40static l3gd20h_handle_t gs_handle;
41static void (*a_callback)(uint8_t type) = NULL;
42
51{
52 if (l3gd20h_irq_handler(&gs_handle, 1) != 0)
53 {
54 return 1;
55 }
56 else
57 {
58 return 0;
59 }
60}
61
67static void a_l3gd20h_interface_receive_callback(uint8_t type)
68{
69 switch (type)
70 {
72 {
73 if (a_callback != NULL)
74 {
76 }
77
78 break;
79 }
81 {
82 if (a_callback != NULL)
83 {
84 a_callback(L3GD20H_INTERRUPT1_Z_HIGH);
85 }
86
87 break;
88 }
90 {
91 if (a_callback != NULL)
92 {
93 a_callback(L3GD20H_INTERRUPT1_Z_LOW);
94 }
95
96 break;
97 }
99 {
100 if (a_callback != NULL)
101 {
102 a_callback(L3GD20H_INTERRUPT1_Y_HIGH);
103 }
104
105 break;
106 }
108 {
109 if (a_callback != NULL)
110 {
111 a_callback(L3GD20H_INTERRUPT1_Y_LOW);
112 }
113
114 break;
115 }
117 {
118 if (a_callback != NULL)
119 {
120 a_callback(L3GD20H_INTERRUPT1_X_HIGH);
121 }
122
123 break;
124 }
126 {
127 if (a_callback != NULL)
128 {
129 a_callback(L3GD20H_INTERRUPT1_X_LOW);
130 }
131
132 break;
133 }
134 default :
135 {
136 break;
137 }
138 }
139}
140
153 float interrupt_threshold, void (*callback)(uint8_t type))
154{
155 uint8_t res;
156 uint16_t threshold;
157
158 /* link interface function */
170 DRIVER_L3GD20H_LINK_RECEIVE_CALLBACK(&gs_handle, a_l3gd20h_interface_receive_callback);
171
172 /* set the interface */
173 res = l3gd20h_set_interface(&gs_handle, interface);
174 if (res != 0)
175 {
176 l3gd20h_interface_debug_print("l3gd20h: set interface failed.\n");
177
178 return 1;
179 }
180
181 /* set the address pin */
182 res = l3gd20h_set_addr_pin(&gs_handle, addr_pin);
183 if (res != 0)
184 {
185 l3gd20h_interface_debug_print("l3gd20h: set addr pin failed.\n");
186
187 return 1;
188 }
189
190 /* init the l3gd20h */
191 res = l3gd20h_init(&gs_handle);
192 if (res != 0)
193 {
194 l3gd20h_interface_debug_print("l3gd20h: init failed.\n");
195
196 return 1;
197 }
198
199 /* set boot */
201 if (res != 0)
202 {
203 l3gd20h_interface_debug_print("l3gd20h: set boot failed.\n");
204 (void)l3gd20h_deinit(&gs_handle);
205
206 return 1;
207 }
208
209 /* set x axis*/
211 if (res != 0)
212 {
213 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
214 (void)l3gd20h_deinit(&gs_handle);
215
216 return 1;
217 }
218
219 /* set y axis*/
221 if (res != 0)
222 {
223 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
224 (void)l3gd20h_deinit(&gs_handle);
225
226 return 1;
227 }
228
229 /* set z axis*/
231 if (res != 0)
232 {
233 l3gd20h_interface_debug_print("l3gd20h: set axis failed.\n");
234 (void)l3gd20h_deinit(&gs_handle);
235
236 return 1;
237 }
238
239 /* set rate bandwidth */
241 if (res != 0)
242 {
243 l3gd20h_interface_debug_print("l3gd20h: set rate bandwidth failed.\n");
244 (void)l3gd20h_deinit(&gs_handle);
245
246 return 1;
247 }
248
249 /* set edge trigger */
251 if (res != 0)
252 {
253 l3gd20h_interface_debug_print("l3gd20h: set edge trigger failed.\n");
254 (void)l3gd20h_deinit(&gs_handle);
255
256 return 1;
257 }
258
259 /* set level trigger */
261 if (res != 0)
262 {
263 l3gd20h_interface_debug_print("l3gd20h: set level trigger failed.\n");
264 (void)l3gd20h_deinit(&gs_handle);
265
266 return 1;
267 }
268
269 /* set latched */
271 if (res != 0)
272 {
273 l3gd20h_interface_debug_print("l3gd20h: set level sensitive latched failed.\n");
274 (void)l3gd20h_deinit(&gs_handle);
275
276 return 1;
277 }
278
279 /* set self test */
281 if (res != 0)
282 {
283 l3gd20h_interface_debug_print("l3gd20h: set self test failed.\n");
284 (void)l3gd20h_deinit(&gs_handle);
285
286 return 1;
287 }
288
289 /* set high pass filter mode */
291 if (res != 0)
292 {
293 l3gd20h_interface_debug_print("l3gd20h: set high pass filter normal mode failed.\n");
294 (void)l3gd20h_deinit(&gs_handle);
295
296 return 1;
297 }
298
299 /* set high pass filter cut off */
301 if (res != 0)
302 {
303 l3gd20h_interface_debug_print("l3gd20h: set high pass filter cut off frequency failed.\n");
304 (void)l3gd20h_deinit(&gs_handle);
305
306 return 1;
307 }
308
309 /* set high pass filter */
311 if (res != 0)
312 {
313 l3gd20h_interface_debug_print("l3gd20h: set high pass filter failed.\n");
314 (void)l3gd20h_deinit(&gs_handle);
315
316 return 1;
317 }
318
319 /* set block data update */
321 if (res != 0)
322 {
323 l3gd20h_interface_debug_print("l3gd20h: set block data update failed.\n");
324 (void)l3gd20h_deinit(&gs_handle);
325
326 return 1;
327 }
328
329 /* set out selection */
331 if (res != 0)
332 {
333 l3gd20h_interface_debug_print("l3gd20h: set out selection failed.\n");
334 (void)l3gd20h_deinit(&gs_handle);
335
336 return 1;
337 }
338
339 /* set interrupt selection */
341 if (res != 0)
342 {
343 l3gd20h_interface_debug_print("l3gd20h: set interrupt selection failed.\n");
344 (void)l3gd20h_deinit(&gs_handle);
345
346 return 1;
347 }
348
349 /* set high pass filter reference */
351 if (res != 0)
352 {
353 l3gd20h_interface_debug_print("l3gd20h: set high pass filter reference failed.\n");
354 (void)l3gd20h_deinit(&gs_handle);
355
356 return 1;
357 }
358
359 /* set bypass fifo mode */
361 if (res != 0)
362 {
363 l3gd20h_interface_debug_print("l3gd20h: set fifo mode failed.\n");
364 (void)l3gd20h_deinit(&gs_handle);
365
366 return 1;
367 }
368
369 /* set interrupt 1*/
370 res = l3gd20h_set_interrupt1(&gs_handle, L3GD20H_BOOL_TRUE);
371 if (res != 0)
372 {
373 l3gd20h_interface_debug_print("l3gd20h: set interrupt1 failed.\n");
374 (void)l3gd20h_deinit(&gs_handle);
375
376 return 1;
377 }
378
379 /* set boot on interrupt 1*/
381 if (res != 0)
382 {
383 l3gd20h_interface_debug_print("l3gd20h: set boot on interrupt1 failed.\n");
384 (void)l3gd20h_deinit(&gs_handle);
385
386 return 1;
387 }
388
389 /* set active level */
391 if (res != 0)
392 {
393 l3gd20h_interface_debug_print("l3gd20h: set interrupt active level failed.\n");
394 (void)l3gd20h_deinit(&gs_handle);
395
396 return 1;
397 }
398
399 /* set interrupt pin type */
401 if (res != 0)
402 {
403 l3gd20h_interface_debug_print("l3gd20h: set interrupt pin type failed.\n");
404 (void)l3gd20h_deinit(&gs_handle);
405
406 return 1;
407 }
408
409 /* set data ready on interrupt2 */
411 if (res != 0)
412 {
413 l3gd20h_interface_debug_print("l3gd20h: set data ready on interrupt2 failed.\n");
414 (void)l3gd20h_deinit(&gs_handle);
415
416 return 1;
417 }
418
419 /* set fifo threshold on interrupt2 */
421 if (res != 0)
422 {
423 l3gd20h_interface_debug_print("l3gd20h: set fifo threshold on interrupt2 failed.\n");
424 (void)l3gd20h_deinit(&gs_handle);
425
426 return 1;
427 }
428
429 /* set fifo overrun on interrupt2 */
431 if (res != 0)
432 {
433 l3gd20h_interface_debug_print("l3gd20h: set fifo overrun on interrupt2 failed.\n");
434 (void)l3gd20h_deinit(&gs_handle);
435
436 return 1;
437 }
438
439 /* set fifo empty on interrupt2 */
441 if (res != 0)
442 {
443 l3gd20h_interface_debug_print("l3gd20h: set fifo empty on interrupt2 failed.\n");
444 (void)l3gd20h_deinit(&gs_handle);
445
446 return 1;
447 }
448
449 /* set L3GD20H_INTERRUPT_EVENT_AND_OR_COMBINATION */
452 if (res != 0)
453 {
454 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
455 (void)l3gd20h_deinit(&gs_handle);
456
457 return 1;
458 }
459
460 /* set L3GD20H_INTERRUPT_EVENT_LATCH */
463 if (res != 0)
464 {
465 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
466 (void)l3gd20h_deinit(&gs_handle);
467
468 return 1;
469 }
470
471 /* set L3GD20H_INTERRUPT_EVENT_Z_HIGH_EVENT */
474 if (res != 0)
475 {
476 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
477 (void)l3gd20h_deinit(&gs_handle);
478
479 return 1;
480 }
481
482 /* set L3GD20H_INTERRUPT_EVENT_Z_LOW_EVENT */
485 if (res != 0)
486 {
487 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
488 (void)l3gd20h_deinit(&gs_handle);
489
490 return 1;
491 }
492
493 /* set L3GD20H_INTERRUPT_EVENT_Y_HIGH_EVENT */
496 if (res != 0)
497 {
498 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
499 (void)l3gd20h_deinit(&gs_handle);
500
501 return 1;
502 }
503
504 /* set L3GD20H_INTERRUPT_EVENT_Y_LOW_EVENT */
507 if (res != 0)
508 {
509 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
510 (void)l3gd20h_deinit(&gs_handle);
511
512 return 1;
513 }
514
515 /* set L3GD20H_INTERRUPT_EVENT_X_HIGH_EVENT */
518 if (res != 0)
519 {
520 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
521 (void)l3gd20h_deinit(&gs_handle);
522
523 return 1;
524 }
525
526 /* set L3GD20H_INTERRUPT_EVENT_X_LOW_EVENT */
529 if (res != 0)
530 {
531 l3gd20h_interface_debug_print("l3gd20h: set interrupt event failed.\n");
532 (void)l3gd20h_deinit(&gs_handle);
533
534 return 1;
535 }
536
537 /* convert the threshold */
538 res = l3gd20h_interrupt_threshold_convert_to_register(&gs_handle, interrupt_threshold,
539 (uint16_t *)&threshold);
540 if (res != 0)
541 {
542 l3gd20h_interface_debug_print("l3gd20h: convert to register failed.\n");
543 (void)l3gd20h_deinit(&gs_handle);
544
545 return 1;
546 }
547
548 /* set x interrupt threshold */
549 res = l3gd20h_set_x_interrupt_threshold(&gs_handle, threshold);
550 if (res != 0)
551 {
552 l3gd20h_interface_debug_print("l3gd20h: set x interrupt threshold failed.\n");
553 (void)l3gd20h_deinit(&gs_handle);
554
555 return 1;
556 }
557
558 /* set y interrupt threshold */
559 res = l3gd20h_set_y_interrupt_threshold(&gs_handle, threshold);
560 if (res != 0)
561 {
562 l3gd20h_interface_debug_print("l3gd20h: set y interrupt threshold failed.\n");
563 (void)l3gd20h_deinit(&gs_handle);
564
565 return 1;
566 }
567
568 /* set z interrupt threshold */
569 res = l3gd20h_set_z_interrupt_threshold(&gs_handle, threshold);
570 if (res != 0)
571 {
572 l3gd20h_interface_debug_print("l3gd20h: set z interrupt threshold failed.\n");
573 (void)l3gd20h_deinit(&gs_handle);
574
575 return 1;
576 }
577
578 /* set counter mode */
580 if (res != 0)
581 {
582 l3gd20h_interface_debug_print("l3gd20h: set counter mode failed.\n");
583 (void)l3gd20h_deinit(&gs_handle);
584
585 return 1;
586 }
587
588 /* set wait */
590 if (res != 0)
591 {
592 l3gd20h_interface_debug_print("l3gd20h: set wait failed.\n");
593 (void)l3gd20h_deinit(&gs_handle);
594
595 return 1;
596 }
597
598 /* set duration */
600 if (res != 0)
601 {
602 l3gd20h_interface_debug_print("l3gd20h: set duration failed.\n");
603 (void)l3gd20h_deinit(&gs_handle);
604
605 return 1;
606 }
607
608 /* set data ready active level */
610 if (res != 0)
611 {
612 l3gd20h_interface_debug_print("l3gd20h: set data ready active level failed.\n");
613 (void)l3gd20h_deinit(&gs_handle);
614
615 return 1;
616 }
617
618 /* enable fifo */
619 res = l3gd20h_set_fifo(&gs_handle, L3GD20H_BOOL_FALSE);
620 if (res != 0)
621 {
622 l3gd20h_interface_debug_print("l3gd20h: set fifo failed.\n");
623 (void)l3gd20h_deinit(&gs_handle);
624
625 return 1;
626 }
627
628 /* set stop on fifo threshold */
630 if (res != 0)
631 {
632 l3gd20h_interface_debug_print("l3gd20h: set stop on fifo threshold failed.\n");
633 (void)l3gd20h_deinit(&gs_handle);
634
635 return 1;
636 }
637
638 /* set fifo threshold */
640 if (res != 0)
641 {
642 l3gd20h_interface_debug_print("l3gd20h: set fifo threshold failed.\n");
643 (void)l3gd20h_deinit(&gs_handle);
644
645 return 1;
646 }
647
648 /* set endian */
650 if (res != 0)
651 {
652 l3gd20h_interface_debug_print("l3gd20h: set data format failed.\n");
653 (void)l3gd20h_deinit(&gs_handle);
654
655 return 1;
656 }
657
658 /* set full scale */
660 if (res != 0)
661 {
662 l3gd20h_interface_debug_print("l3gd20h: set full scale failed.\n");
663 (void)l3gd20h_deinit(&gs_handle);
664
665 return 1;
666 }
667
668 /* normal mode */
669 res = l3gd20h_set_mode(&gs_handle, L3GD20H_MODE_NORMAL);
670 if (res != 0)
671 {
672 l3gd20h_interface_debug_print("l3gd20h: set mode failed.\n");
673 (void)l3gd20h_deinit(&gs_handle);
674
675 return 1;
676 }
677
678 a_callback = callback;
679
680 /* success return 0 */
681 return 0;
682}
683
692{
693 if (l3gd20h_deinit(&gs_handle) != 0)
694 {
695 return 1;
696 }
697 else
698 {
699 return 0;
700 }
701}
702
703
driver l3gd20h interrupt 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_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_INTERRUPT_DEFAULT_INTERRUPT_EVENT_Y_LOW_EVENT
#define L3GD20H_INTERRUPT_DEFAULT_FIFO_THRESHOLD
#define L3GD20H_INTERRUPT_DEFAULT_BLOCK_DATA_UPDATE
#define L3GD20H_INTERRUPT_DEFAULT_HIGH_PASS_FILTER_REFERENCE
#define L3GD20H_INTERRUPT_DEFAULT_SELF_TEST
#define L3GD20H_INTERRUPT_DEFAULT_DATA_READY_ON_INTERRUPT2
#define L3GD20H_INTERRUPT_DEFAULT_BOOT
l3gd20h interrupt example default definition
uint8_t l3gd20h_interrupt_irq_handler(void)
interrupt example irq callback
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_SELECTION
#define L3GD20H_INTERRUPT_DEFAULT_AXIS_X
#define L3GD20H_INTERRUPT_DEFAULT_FIFO_OVERRUN_ON_INTERRUPT2
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_EVENT_LATCH
uint8_t l3gd20h_interrupt_init(l3gd20h_interface_t interface, l3gd20h_address_t addr_pin, float interrupt_threshold, void(*callback)(uint8_t type))
interrupt example init
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_EVENT_X_HIGH_EVENT
#define L3GD20H_INTERRUPT_DEFAULT_FIFO_EMPTY_ON_INTERRUPT2
#define L3GD20H_INTERRUPT_DEFAULT_FIFO_THRESHOLD_ON_INTERRUPT2
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_EVENT_Z_LOW_EVENT
#define L3GD20H_INTERRUPT_DEFAULT_DURATION
#define L3GD20H_INTERRUPT_DEFAULT_HIGH_PASS_FILTER_MODE
#define L3GD20H_INTERRUPT_DEFAULT_LEVEL_TRIGGER
#define L3GD20H_INTERRUPT_DEFAULT_LEVEL_SENSITIVE_LATCHED
uint8_t l3gd20h_interrupt_deinit(void)
interrupt example deinit
#define L3GD20H_INTERRUPT_DEFAULT_WAIT
#define L3GD20H_INTERRUPT_DEFAULT_HIGH_PASS_FILTER
#define L3GD20H_INTERRUPT_DEFAULT_AXIS_Z
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_ACTIVE_LEVEL
#define L3GD20H_INTERRUPT_DEFAULT_AXIS_Y
#define L3GD20H_INTERRUPT_DEFAULT_DATA_READY_ACTIVE_LEVEL
#define L3GD20H_INTERRUPT_DEFAULT_DATA_FORMAT
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_EVENT_AND_OR_COMBINATION
#define L3GD20H_INTERRUPT_DEFAULT_OUT_SELECTION
#define L3GD20H_INTERRUPT_DEFAULT_BOOT_ON_INTERRUPT1
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_EVENT_X_LOW_EVENT
#define L3GD20H_INTERRUPT_DEFAULT_COUNTER_MODE
#define L3GD20H_INTERRUPT_DEFAULT_EDGE_TRIGGER
#define L3GD20H_INTERRUPT_DEFAULT_RATE_BANDWIDTH
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_PIN_TYPE
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_EVENT_Z_HIGH_EVENT
#define L3GD20H_INTERRUPT_DEFAULT_HIGH_PASS_FILTER_CUT_OFF
#define L3GD20H_INTERRUPT_DEFAULT_FULL_SCALE
#define L3GD20H_INTERRUPT_DEFAULT_STOP_ON_FIFO_THRESHOLD
#define L3GD20H_INTERRUPT_DEFAULT_INTERRUPT_EVENT_Y_HIGH_EVENT
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_BYPASS
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_INTERRUPT1_Y_HIGH
@ L3GD20H_INTERRUPT1_X_LOW
@ L3GD20H_INTERRUPT1_X_HIGH
@ L3GD20H_INTERRUPT1_Z_HIGH
@ L3GD20H_INTERRUPT1_Y_LOW
@ L3GD20H_INTERRUPT1_INTERRUPT_ACTIVE
@ L3GD20H_INTERRUPT1_Z_LOW