| LibDriver MPU9250 1.0.0 MPU9250 full function driver

driver_mpu9250_fifo.c
Go to the documentation of this file.
1
37 #include "driver_mpu9250_fifo.h"
38
39 static mpu9250_handle_t gs_handle;
48 uint8_t mpu9250_fifo_irq_handler(void)
49 {
50 if (mpu9250_irq_handler(&gs_handle) != 0)
51 {
52 return 1;
53 }
54 else
55 {
56 return 0;
57 }
58 }
59
69 uint8_t mpu9250_fifo_init(mpu9250_interface_t interface, mpu9250_address_t addr_pin)
70 {
71 uint8_t res;
72
73 /* link interface function */
74 DRIVER_MPU9250_LINK_INIT(&gs_handle, mpu9250_handle_t);
75 DRIVER_MPU9250_LINK_IIC_INIT(&gs_handle, mpu9250_interface_iic_init);
76 DRIVER_MPU9250_LINK_IIC_DEINIT(&gs_handle, mpu9250_interface_iic_deinit);
77 DRIVER_MPU9250_LINK_IIC_READ(&gs_handle, mpu9250_interface_iic_read);
78 DRIVER_MPU9250_LINK_IIC_WRITE(&gs_handle, mpu9250_interface_iic_write);
79 DRIVER_MPU9250_LINK_SPI_INIT(&gs_handle, mpu9250_interface_spi_init);
80 DRIVER_MPU9250_LINK_SPI_DEINIT(&gs_handle, mpu9250_interface_spi_deinit);
81 DRIVER_MPU9250_LINK_SPI_READ(&gs_handle, mpu9250_interface_spi_read);
82 DRIVER_MPU9250_LINK_SPI_WRITE(&gs_handle, mpu9250_interface_spi_write);
83 DRIVER_MPU9250_LINK_DELAY_MS(&gs_handle, mpu9250_interface_delay_ms);
84 DRIVER_MPU9250_LINK_DEBUG_PRINT(&gs_handle, mpu9250_interface_debug_print);
85 DRIVER_MPU9250_LINK_RECEIVE_CALLBACK(&gs_handle, mpu9250_interface_receive_callback);
86
87 /* set the interface */
88 res = mpu9250_set_interface(&gs_handle, interface);
89 if (res != 0)
90 {
91 mpu9250_interface_debug_print("mpu9250: set interface failed.\n");
92
93 return 1;
94 }
95
96 /* set the addr pin */
97 res = mpu9250_set_addr_pin(&gs_handle, addr_pin);
98 if (res != 0)
99 {
100 mpu9250_interface_debug_print("mpu9250: set addr pin failed.\n");
101
102 return 1;
103 }
104
105 /* init */
106 res = mpu9250_init(&gs_handle);
107 if (res != 0)
108 {
109 mpu9250_interface_debug_print("mpu9250: init failed.\n");
110
111 return 1;
112 }
113
114 /* delay 100 ms */
115 mpu9250_interface_delay_ms(100);
116
117 /* disable sleep */
118 res = mpu9250_set_sleep(&gs_handle, MPU9250_BOOL_FALSE);
119 if (res != 0)
120 {
121 mpu9250_interface_debug_print("mpu9250: set sleep failed.\n");
122 (void)mpu9250_deinit(&gs_handle);
123
124 return 1;
125 }
126
127 /* if spi interface, disable iic interface */
128 if (interface == MPU9250_INTERFACE_SPI)
129 {
130 /* disable iic */
131 res = mpu9250_set_disable_iic_slave(&gs_handle, MPU9250_BOOL_TRUE);
132 if (res != 0)
133 {
134 mpu9250_interface_debug_print("mpu9250: set disable iic slave failed.\n");
135 (void)mpu9250_deinit(&gs_handle);
136
137 return 1;
138 }
139 }
140
141 /* set fifo 1024kb */
142 res = mpu9250_set_fifo_1024kb(&gs_handle);
143 if (res != 0)
144 {
145 mpu9250_interface_debug_print("mpu9250: set fifo 1024kb failed.\n");
146 (void)mpu9250_deinit(&gs_handle);
147
148 return 1;
149 }
150
151 /* set the default clock source */
152 res = mpu9250_set_clock_source(&gs_handle, MPU9250_FIFO_DEFAULT_CLOCK_SOURCE);
153 if (res != 0)
154 {
155 mpu9250_interface_debug_print("mpu9250: set clock source failed.\n");
156 (void)mpu9250_deinit(&gs_handle);
157
158 return 1;
159 }
160
161 /* set the default rate */
162 res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / MPU9250_FIFO_DEFAULT_RATE) - 1);
163 if (res != 0)
164 {
165 mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
166 (void)mpu9250_deinit(&gs_handle);
167
168 return 1;
169 }
170
171 /* set the default accelerometer range */
172 res = mpu9250_set_accelerometer_range(&gs_handle, MPU9250_FIFO_DEFAULT_ACCELEROMETER_RANGE);
173 if (res != 0)
174 {
175 mpu9250_interface_debug_print("mpu9250: set accelerometer range failed.\n");
176 (void)mpu9250_deinit(&gs_handle);
177
178 return 1;
179 }
180
181 /* set the default gyroscope range */
182 res = mpu9250_set_gyroscope_range(&gs_handle, MPU9250_FIFO_DEFAULT_GYROSCOPE_RANGE);
183 if (res != 0)
184 {
185 mpu9250_interface_debug_print("mpu9250: set gyroscope range failed.\n");
186 (void)mpu9250_deinit(&gs_handle);
187
188 return 1;
189 }
190
191 /* enable temperature sensor */
192 res = mpu9250_set_ptat(&gs_handle, MPU9250_BOOL_TRUE);
193 if (res != 0)
194 {
195 mpu9250_interface_debug_print("mpu9250: set ptat failed.\n");
196 (void)mpu9250_deinit(&gs_handle);
197
198 return 1;
199 }
200
201 /* set the default wake up */
202 res = mpu9250_set_cycle_wake_up(&gs_handle, MPU9250_FIFO_DEFAULT_CYCLE_WAKE_UP);
203 if (res != 0)
204 {
205 mpu9250_interface_debug_print("mpu9250: set cycle wake up failed.\n");
206 (void)mpu9250_deinit(&gs_handle);
207
208 return 1;
209 }
210
211 /* enable acc x */
212 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_X, MPU9250_BOOL_FALSE);
213 if (res != 0)
214 {
215 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
216 (void)mpu9250_deinit(&gs_handle);
217
218 return 1;
219 }
220
221 /* enable acc y */
222 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Y, MPU9250_BOOL_FALSE);
223 if (res != 0)
224 {
225 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
226 (void)mpu9250_deinit(&gs_handle);
227
228 return 1;
229 }
230
231 /* enable acc z */
232 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Z, MPU9250_BOOL_FALSE);
233 if (res != 0)
234 {
235 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
236 (void)mpu9250_deinit(&gs_handle);
237
238 return 1;
239 }
240
241 /* enable gyro x */
242 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_X, MPU9250_BOOL_FALSE);
243 if (res != 0)
244 {
245 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
246 (void)mpu9250_deinit(&gs_handle);
247
248 return 1;
249 }
250
251 /* enable gyro y */
252 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Y, MPU9250_BOOL_FALSE);
253 if (res != 0)
254 {
255 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
256 (void)mpu9250_deinit(&gs_handle);
257
258 return 1;
259 }
260
261 /* enable gyro z */
262 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Z, MPU9250_BOOL_FALSE);
263 if (res != 0)
264 {
265 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
266 (void)mpu9250_deinit(&gs_handle);
267
268 return 1;
269 }
270
271 /* disable gyroscope x test */
272 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
273 if (res != 0)
274 {
275 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
276 (void)mpu9250_deinit(&gs_handle);
277
278 return 1;
279 }
280
281 /* disable gyroscope y test */
282 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
283 if (res != 0)
284 {
285 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
286 (void)mpu9250_deinit(&gs_handle);
287
288 return 1;
289 }
290
291 /* disable gyroscope z test */
292 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
293 if (res != 0)
294 {
295 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
296 (void)mpu9250_deinit(&gs_handle);
297
298 return 1;
299 }
300
301 /* disable accelerometer x test */
302 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
303 if (res != 0)
304 {
305 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
306 (void)mpu9250_deinit(&gs_handle);
307
308 return 1;
309 }
310
311 /* disable accelerometer y test */
312 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
313 if (res != 0)
314 {
315 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
316 (void)mpu9250_deinit(&gs_handle);
317
318 return 1;
319 }
320
321 /* disable accelerometer z test */
322 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
323 if (res != 0)
324 {
325 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
326 (void)mpu9250_deinit(&gs_handle);
327
328 return 1;
329 }
330
331 /* disable temp fifo */
332 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_TEMP, MPU9250_BOOL_FALSE);
333 if (res != 0)
334 {
335 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
336 (void)mpu9250_deinit(&gs_handle);
337
338 return 1;
339 }
340
341 /* enable xg fifo */
342 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_XG, MPU9250_BOOL_TRUE);
343 if (res != 0)
344 {
345 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
346 (void)mpu9250_deinit(&gs_handle);
347
348 return 1;
349 }
350
351 /* enable yg fifo */
352 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_YG, MPU9250_BOOL_TRUE);
353 if (res != 0)
354 {
355 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
356 (void)mpu9250_deinit(&gs_handle);
357
358 return 1;
359 }
360
361 /* enable zg fifo */
362 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ZG, MPU9250_BOOL_TRUE);
363 if (res != 0)
364 {
365 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
366 (void)mpu9250_deinit(&gs_handle);
367
368 return 1;
369 }
370
371 /* enable accel fifo */
372 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ACCEL, MPU9250_BOOL_TRUE);
373 if (res != 0)
374 {
375 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
376 (void)mpu9250_deinit(&gs_handle);
377
378 return 1;
379 }
380
381 /* set the default interrupt level */
382 res = mpu9250_set_interrupt_level(&gs_handle, MPU9250_FIFO_DEFAULT_INTERRUPT_PIN_LEVEL);
383 if (res != 0)
384 {
385 mpu9250_interface_debug_print("mpu9250: set interrupt level failed.\n");
386 (void)mpu9250_deinit(&gs_handle);
387
388 return 1;
389 }
390
391 /* set the default interrupt pin type */
392 res = mpu9250_set_interrupt_pin_type(&gs_handle, MPU9250_FIFO_DEFAULT_INTERRUPT_PIN_TYPE);
393 if (res != 0)
394 {
395 mpu9250_interface_debug_print("mpu9250: set interrupt pin type failed.\n");
396 (void)mpu9250_deinit(&gs_handle);
397
398 return 1;
399 }
400
401 /* set the default motion */
402 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_MOTION, MPU9250_FIFO_DEFAULT_INTERRUPT_MOTION);
403 if (res != 0)
404 {
405 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
406 (void)mpu9250_deinit(&gs_handle);
407
408 return 1;
409 }
410
411 /* set the default fifo overflow */
412 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FIFO_OVERFLOW, MPU9250_FIFO_DEFAULT_INTERRUPT_FIFO_OVERFLOW);
413 if (res != 0)
414 {
415 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
416 (void)mpu9250_deinit(&gs_handle);
417
418 return 1;
419 }
420
421 /* set the default dmp interrupt */
422 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DMP, MPU9250_FIFO_DEFAULT_INTERRUPT_DMP);
423 if (res != 0)
424 {
425 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
426 (void)mpu9250_deinit(&gs_handle);
427
428 return 1;
429 }
430
431 /* set the default fsync int */
432 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FSYNC_INT, MPU9250_FIFO_DEFAULT_INTERRUPT_FSYNC_INT);
433 if (res != 0)
434 {
435 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
436 (void)mpu9250_deinit(&gs_handle);
437
438 return 1;
439 }
440
441 /* set the default data ready */
442 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DATA_READY, MPU9250_FIFO_DEFAULT_INTERRUPT_DATA_READY);
443 if (res != 0)
444 {
445 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
446 (void)mpu9250_deinit(&gs_handle);
447
448 return 1;
449 }
450
451 /* set the default latch */
452 res = mpu9250_set_interrupt_latch(&gs_handle, MPU9250_FIFO_DEFAULT_INTERRUPT_LATCH);
453 if (res != 0)
454 {
455 mpu9250_interface_debug_print("mpu9250: set interrupt latch failed.\n");
456 (void)mpu9250_deinit(&gs_handle);
457
458 return 1;
459 }
460
461 /* set the default interrupt read clear */
462 res = mpu9250_set_interrupt_read_clear(&gs_handle, MPU9250_FIFO_DEFAULT_INTERRUPT_READ_CLEAR);
463 if (res != 0)
464 {
465 mpu9250_interface_debug_print("mpu9250: set interrupt read clear failed.\n");
466 (void)mpu9250_deinit(&gs_handle);
467
468 return 1;
469 }
470
471 /* set the default extern sync */
472 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_FIFO_DEFAULT_EXTERN_SYNC);
473 if (res != 0)
474 {
475 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
476 (void)mpu9250_deinit(&gs_handle);
477
478 return 1;
479 }
480
481 /* set the default fsync interrupt */
482 res = mpu9250_set_fsync_interrupt(&gs_handle, MPU9250_FIFO_DEFAULT_FSYNC_INTERRUPT);
483 if (res != 0)
484 {
485 mpu9250_interface_debug_print("mpu9250: set fsync interrupt failed.\n");
486 (void)mpu9250_deinit(&gs_handle);
487
488 return 1;
489 }
490
491 /* set the default fsync interrupt level */
492 res = mpu9250_set_fsync_interrupt_level(&gs_handle, MPU9250_FIFO_DEFAULT_FSYNC_INTERRUPT_LEVEL);
493 if (res != 0)
494 {
495 mpu9250_interface_debug_print("mpu9250: set fsync interrupt level failed.\n");
496 (void)mpu9250_deinit(&gs_handle);
497
498 return 1;
499 }
500
501 /* set the default iic master */
502 res = mpu9250_set_iic_master(&gs_handle, MPU9250_FIFO_DEFAULT_IIC_MASTER);
503 if (res != 0)
504 {
505 mpu9250_interface_debug_print("mpu9250: set iic master failed.\n");
506 (void)mpu9250_deinit(&gs_handle);
507
508 return 1;
509 }
510
511 /* set the default iic bypass */
512 res = mpu9250_set_iic_bypass(&gs_handle, MPU9250_FIFO_DEFAULT_IIC_BYPASS);
513 if (res != 0)
514 {
515 mpu9250_interface_debug_print("mpu9250: set iic bypass failed.\n");
516 (void)mpu9250_deinit(&gs_handle);
517
518 return 1;
519 }
520
521 /* set the default gyro standby */
522 res = mpu9250_set_gyro_standby(&gs_handle, MPU9250_FIFO_DEFAULT_GYROSCOPE_STANDBY);
523 if (res != 0)
524 {
525 mpu9250_interface_debug_print("mpu9250: set gyro standby failed.\n");
526 (void)mpu9250_deinit(&gs_handle);
527
528 return 1;
529 }
530
531 /* set the default fifo mode */
532 res = mpu9250_set_fifo_mode(&gs_handle, MPU9250_FIFO_DEFAULT_FIFO_MODE);
533 if (res != 0)
534 {
535 mpu9250_interface_debug_print("mpu9250: set fifo mode failed.\n");
536 (void)mpu9250_deinit(&gs_handle);
537
538 return 1;
539 }
540
541 /* set the default gyroscope choice */
542 res = mpu9250_set_gyroscope_choice(&gs_handle, MPU9250_FIFO_DEFAULT_GYROSCOPE_CHOICE);
543 if (res != 0)
544 {
545 mpu9250_interface_debug_print("mpu9250: set gyroscope choice failed.\n");
546 (void)mpu9250_deinit(&gs_handle);
547
548 return 1;
549 }
550
551 /* set the default low pass filter */
552 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_FIFO_DEFAULT_LOW_PASS_FILTER);
553 if (res != 0)
554 {
555 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
556 (void)mpu9250_deinit(&gs_handle);
557
558 return 1;
559 }
560
561 /* set the default accelerometer choice */
562 res = mpu9250_set_accelerometer_choice(&gs_handle, MPU9250_FIFO_DEFAULT_ACCELEROMETER_CHOICE);
563 if (res != 0)
564 {
565 mpu9250_interface_debug_print("mpu9250: set accelerometer choice failed.\n");
566 (void)mpu9250_deinit(&gs_handle);
567
568 return 1;
569 }
570
571 /* set the default accelerometer low pass filter */
572 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_FIFO_DEFAULT_ACCELEROMETER_LOW_PASS_FILTER);
573 if (res != 0)
574 {
575 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
576 (void)mpu9250_deinit(&gs_handle);
577
578 return 1;
579 }
580
581 /* set the default low power accel output rate */
582 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_FIFO_DEFAULT_LOW_POWER_ACCEL_OUTPUT_RATE);
583 if (res != 0)
584 {
585 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
586 (void)mpu9250_deinit(&gs_handle);
587
588 return 1;
589 }
590
591 /* set the default wake on motion */
592 res = mpu9250_set_wake_on_motion(&gs_handle, MPU9250_FIFO_DEFAULT_WAKE_ON_MOTION);
593 if (res != 0)
594 {
595 mpu9250_interface_debug_print("mpu9250: set wake on motion failed.\n");
596 (void)mpu9250_deinit(&gs_handle);
597
598 return 1;
599 }
600
601 /* set the default accel compare with previous sample */
602 res = mpu9250_set_accel_compare_with_previous_sample(&gs_handle, MPU9250_FIFO_DEFAULT_ACCELEROMETER_COMPARE);
603 if (res != 0)
604 {
605 mpu9250_interface_debug_print("mpu9250: set accel compare with previous sample failed.\n");
606 (void)mpu9250_deinit(&gs_handle);
607
608 return 1;
609 }
610
611 /* if iic interface */
612 if (interface == MPU9250_INTERFACE_IIC)
613 {
614 /* mag init */
615 res = mpu9250_mag_init(&gs_handle);
616 if (res != 0)
617 {
618 mpu9250_interface_debug_print("mpu9250: mag init failed.\n");
619 (void)mpu9250_deinit(&gs_handle);
620
621 return 1;
622 }
623
624 /* set the mag default mode */
625 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_FIFO_DEFAULT_MAGNETOMETER_MODE);
626 if (res != 0)
627 {
628 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
629 (void)mpu9250_mag_deinit(&gs_handle);
630 (void)mpu9250_deinit(&gs_handle);
631
632 return 1;
633 }
634
635 /* set the mag default bits */
636 res = mpu9250_mag_set_bits(&gs_handle, MPU9250_FIFO_DEFAULT_MAGNETOMETER_BITS);
637 if (res != 0)
638 {
639 mpu9250_interface_debug_print("mpu9250: mag set bits failed.\n");
640 (void)mpu9250_mag_deinit(&gs_handle);
641 (void)mpu9250_deinit(&gs_handle);
642
643 return 1;
644 }
645
646 /* enable iic master */
647 res = mpu9250_set_iic_master(&gs_handle, MPU9250_BOOL_TRUE);
648 if (res != 0)
649 {
650 mpu9250_interface_debug_print("mpu9250: set iic master failed.\n");
651 (void)mpu9250_mag_deinit(&gs_handle);
652 (void)mpu9250_deinit(&gs_handle);
653
654 return 1;
655 }
656
657 /* disable iic bypass */
658 res = mpu9250_set_iic_bypass(&gs_handle, MPU9250_BOOL_FALSE);
659 if (res != 0)
660 {
661 mpu9250_interface_debug_print("mpu9250: set iic bypass failed.\n");
662 (void)mpu9250_mag_deinit(&gs_handle);
663 (void)mpu9250_deinit(&gs_handle);
664
665 return 1;
666 }
667
668 /* set the default iic clock */
669 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_FIFO_DEFAULT_IIC_CLOCK);
670 if (res != 0)
671 {
672 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
673 (void)mpu9250_mag_deinit(&gs_handle);
674 (void)mpu9250_deinit(&gs_handle);
675
676 return 1;
677 }
678
679 /* set the default iic multi master */
680 res = mpu9250_set_iic_multi_master(&gs_handle, MPU9250_FIFO_DEFAULT_IIC_MULTI_MASTER);
681 if (res != 0)
682 {
683 mpu9250_interface_debug_print("mpu9250: set iic multi master failed.\n");
684 (void)mpu9250_mag_deinit(&gs_handle);
685 (void)mpu9250_deinit(&gs_handle);
686
687 return 1;
688 }
689
690 /* set the default iic wait for external sensor */
691 res = mpu9250_set_iic_wait_for_external_sensor(&gs_handle, MPU9250_FIFO_DEFAULT_IIC_WAIT_FOR_EXTERNAL_SENSOR);
692 if (res != 0)
693 {
694 mpu9250_interface_debug_print("mpu9250: set iic wait for external sensor failed.\n");
695 (void)mpu9250_mag_deinit(&gs_handle);
696 (void)mpu9250_deinit(&gs_handle);
697
698 return 1;
699 }
700
701 /* set the default iic read mode */
702 res = mpu9250_set_iic_read_mode(&gs_handle, MPU9250_FIFO_DEFAULT_IIC_READ_MODE);
703 if (res != 0)
704 {
705 mpu9250_interface_debug_print("mpu9250: set iic read mode failed.\n");
706 (void)mpu9250_mag_deinit(&gs_handle);
707 (void)mpu9250_deinit(&gs_handle);
708
709 return 1;
710 }
711
712 /* set the default slave 0 delay */
713 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_0, MPU9250_FIFO_DEFAULT_IIC_DELAY);
714 if (res != 0)
715 {
716 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
717 (void)mpu9250_mag_deinit(&gs_handle);
718 (void)mpu9250_deinit(&gs_handle);
719
720 return 1;
721 }
722
723 /* mag set fifo mode */
724 res = mpu9250_mag_set_fifo_mode(&gs_handle);
725 if (res != 0)
726 {
727 mpu9250_interface_debug_print("mpu9250: mag set fifo mode failed.\n");
728 (void)mpu9250_mag_deinit(&gs_handle);
729 (void)mpu9250_deinit(&gs_handle);
730
731 return 1;
732 }
733 }
734
735 /* enable fifo */
736 res = mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_TRUE);
737 if (res != 0)
738 {
739 mpu9250_interface_debug_print("mpu9250: set fifo failed.\n");
740 (void)mpu9250_deinit(&gs_handle);
741
742 return 1;
743 }
744
745 /* force fifo reset */
746 res = mpu9250_force_fifo_reset(&gs_handle);
747 if (res != 0)
748 {
749 mpu9250_interface_debug_print("mpu9250: force fifo reset failed.\n");
750 if (interface == MPU9250_INTERFACE_IIC)
751 {
752 (void)mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_FALSE);
753 (void)mpu9250_mag_deinit(&gs_handle);
754 }
755 (void)mpu9250_deinit(&gs_handle);
756
757 return 1;
758 }
759
760 return 0;
761 }
762
777 uint8_t mpu9250_fifo_read(int16_t (*accel_raw)[3], float (*accel_g)[3],
778 int16_t (*gyro_raw)[3], float (*gyro_dps)[3],
779 int16_t (*mag_raw)[3], float (*mag_ut)[3],
780 uint16_t *len
781 )
782 {
783 /* fifo read */
784 if (mpu9250_read(&gs_handle, accel_raw, accel_g,
785 gyro_raw, gyro_dps, mag_raw, mag_ut, len) != 0)
786 {
787 return 1;
788 }
789
790 return 0;
791 }
792
800 uint8_t mpu9250_fifo_deinit(void)
801 {
802 mpu9250_interface_t interface;
803
804 /* get the interface */
805 if (mpu9250_get_interface(&gs_handle, &interface) != 0)
806 {
807 return 1;
808 }
809
810 /* if interface iic*/
811 if (interface == MPU9250_INTERFACE_IIC)
812 {
813 /* disable fifo */
814 if (mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_FALSE) != 0)
815 {
816 return 1;
817 }
818
819 /* mag deinit */
820 if (mpu9250_mag_deinit(&gs_handle) != 0)
821 {
822 return 1;
823 }
824 }
825
826 /* deinit */
827 if (mpu9250_deinit(&gs_handle) != 0)
828 {
829 return 1;
830 }
831
832 return 0;
833 }
driver_mpu9250_fifo.h
driver mpu9250 fifo header file
mpu9250_set_accelerometer_low_pass_filter
uint8_t mpu9250_set_accelerometer_low_pass_filter(mpu9250_handle_t *handle, mpu9250_accelerometer_low_pass_filter_t filter)
set the accelerometer low pass filter
Definition: driver_mpu9250.c:7886
mpu9250_set_wake_on_motion
uint8_t mpu9250_set_wake_on_motion(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable wake on motion
Definition: driver_mpu9250.c:8050
mpu9250_set_accel_compare_with_previous_sample
uint8_t mpu9250_set_accel_compare_with_previous_sample(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable accel compare with previous sample
Definition: driver_mpu9250.c:8132
mpu9250_set_fifo_mode
uint8_t mpu9250_set_fifo_mode(mpu9250_handle_t *handle, mpu9250_fifo_mode mode)
set the fifo mode
Definition: driver_mpu9250.c:7249
mpu9250_set_addr_pin
uint8_t mpu9250_set_addr_pin(mpu9250_handle_t *handle, mpu9250_address_t addr_pin)
set the chip address pin
Definition: driver_mpu9250.c:3964
mpu9250_set_ptat
uint8_t mpu9250_set_ptat(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the temperature sensor
Definition: driver_mpu9250.c:6449
mpu9250_set_fifo_enable
uint8_t mpu9250_set_fifo_enable(mpu9250_handle_t *handle, mpu9250_fifo_t fifo, mpu9250_bool_t enable)
enable or disable the fifo function
Definition: driver_mpu9250.c:8215
mpu9250_set_standby_mode
uint8_t mpu9250_set_standby_mode(mpu9250_handle_t *handle, mpu9250_source_t source, mpu9250_bool_t enable)
set source into standby mode
Definition: driver_mpu9250.c:6778
mpu9250_set_iic_wait_for_external_sensor
uint8_t mpu9250_set_iic_wait_for_external_sensor(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable iic wait for external sensor
Definition: driver_mpu9250.c:10342
mpu9250_set_cycle_wake_up
uint8_t mpu9250_set_cycle_wake_up(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the cycle wake up mode
Definition: driver_mpu9250.c:6531
mpu9250_set_interrupt_latch
uint8_t mpu9250_set_interrupt_latch(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the interrupt latch
Definition: driver_mpu9250.c:8462
mpu9250_set_extern_sync
uint8_t mpu9250_set_extern_sync(mpu9250_handle_t *handle, mpu9250_extern_sync_t sync)
set the extern sync type
Definition: driver_mpu9250.c:7085
mpu9250_set_gyro_standby
uint8_t mpu9250_set_gyro_standby(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the gyro standby
Definition: driver_mpu9250.c:6695
mpu9250_set_iic_multi_master
uint8_t mpu9250_set_iic_multi_master(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable iic multi master
Definition: driver_mpu9250.c:10260
mpu9250_set_iic_read_mode
uint8_t mpu9250_set_iic_read_mode(mpu9250_handle_t *handle, mpu9250_iic_read_mode_t mode)
set the iic read mode
Definition: driver_mpu9250.c:10424
mpu9250_address_t
mpu9250_address_t
mpu9250 address enumeration definition
Definition: driver_mpu9250.h:72
mpu9250_set_fsync_interrupt
uint8_t mpu9250_set_fsync_interrupt(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the fsync interrupt
Definition: driver_mpu9250.c:8708
mpu9250_set_iic_bypass
uint8_t mpu9250_set_iic_bypass(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic bypass
Definition: driver_mpu9250.c:8790
mpu9250_set_accelerometer_test
uint8_t mpu9250_set_accelerometer_test(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t enable)
set the accelerometer test
Definition: driver_mpu9250.c:7587
mpu9250_set_interrupt_level
uint8_t mpu9250_set_interrupt_level(mpu9250_handle_t *handle, mpu9250_pin_level_t level)
set the interrupt level
Definition: driver_mpu9250.c:8298
mpu9250_set_interrupt_read_clear
uint8_t mpu9250_set_interrupt_read_clear(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the interrupt reading clear
Definition: driver_mpu9250.c:8544
mpu9250_set_interface
uint8_t mpu9250_set_interface(mpu9250_handle_t *handle, mpu9250_interface_t interface)
set the chip interface
Definition: driver_mpu9250.c:3922
mpu9250_get_interface
uint8_t mpu9250_get_interface(mpu9250_handle_t *handle, mpu9250_interface_t *interface)
get the chip interface
Definition: driver_mpu9250.c:3943
mpu9250_irq_handler
uint8_t mpu9250_irq_handler(mpu9250_handle_t *handle)
irq handler
Definition: driver_mpu9250.c:4668
mpu9250_set_iic_delay_enable
uint8_t mpu9250_set_iic_delay_enable(mpu9250_handle_t *handle, mpu9250_iic_delay_t delay, mpu9250_bool_t enable)
enable or disable the iic delay
Definition: driver_mpu9250.c:12431
mpu9250_interface_t
mpu9250_interface_t
mpu9250 interface enumeration definition
Definition: driver_mpu9250.h:63
mpu9250_set_interrupt
uint8_t mpu9250_set_interrupt(mpu9250_handle_t *handle, mpu9250_interrupt_t type, mpu9250_bool_t enable)
enable or disable the interrupt
Definition: driver_mpu9250.c:8873
mpu9250_set_fsync_interrupt_level
uint8_t mpu9250_set_fsync_interrupt_level(mpu9250_handle_t *handle, mpu9250_pin_level_t level)
set the fsync interrupt level
Definition: driver_mpu9250.c:8626
mpu9250_set_gyroscope_choice
uint8_t mpu9250_set_gyroscope_choice(mpu9250_handle_t *handle, uint8_t choice)
set the gyroscope choice
Definition: driver_mpu9250.c:7498
mpu9250_deinit
uint8_t mpu9250_deinit(mpu9250_handle_t *handle)
close the chip
Definition: driver_mpu9250.c:4168
mpu9250_read
uint8_t mpu9250_read(mpu9250_handle_t *handle, int16_t(*accel_raw)[3], float(*accel_g)[3], int16_t(*gyro_raw)[3], float(*gyro_dps)[3], int16_t(*mag_raw)[3], float(*mag_ut)[3], uint16_t *len)
read the data
Definition: driver_mpu9250.c:4223
mpu9250_set_fifo_1024kb
uint8_t mpu9250_set_fifo_1024kb(mpu9250_handle_t *handle)
set fifo 1024kb
Definition: driver_mpu9250.c:7751
mpu9250_set_low_pass_filter
uint8_t mpu9250_set_low_pass_filter(mpu9250_handle_t *handle, mpu9250_low_pass_filter_t filter)
set the low pass filter
Definition: driver_mpu9250.c:7167
mpu9250_set_gyroscope_test
uint8_t mpu9250_set_gyroscope_test(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t enable)
set the gyroscope test
Definition: driver_mpu9250.c:7332
mpu9250_set_clock_source
uint8_t mpu9250_set_clock_source(mpu9250_handle_t *handle, mpu9250_clock_source_t clock_source)
set the chip clock source
Definition: driver_mpu9250.c:6367
mpu9250_set_low_power_accel_output_rate
uint8_t mpu9250_set_low_power_accel_output_rate(mpu9250_handle_t *handle, mpu9250_low_power_accel_output_rate_t rate)
set the low power accel output rate
Definition: driver_mpu9250.c:7968
mpu9250_set_iic_clock
uint8_t mpu9250_set_iic_clock(mpu9250_handle_t *handle, mpu9250_iic_clock_t clk)
set the iic clock
Definition: driver_mpu9250.c:10178
mpu9250_set_disable_iic_slave
uint8_t mpu9250_set_disable_iic_slave(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic slave mode
Definition: driver_mpu9250.c:5961
mpu9250_set_sample_rate_divider
uint8_t mpu9250_set_sample_rate_divider(mpu9250_handle_t *handle, uint8_t d)
set the sample rate divider
Definition: driver_mpu9250.c:7015
mpu9250_set_fifo
uint8_t mpu9250_set_fifo(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable fifo
Definition: driver_mpu9250.c:5763
mpu9250_init
uint8_t mpu9250_init(mpu9250_handle_t *handle)
initialize the chip
Definition: driver_mpu9250.c:4009
mpu9250_set_accelerometer_choice
uint8_t mpu9250_set_accelerometer_choice(mpu9250_handle_t *handle, uint8_t choice)
set the accelerometer choice
Definition: driver_mpu9250.c:7797
mpu9250_set_gyroscope_range
uint8_t mpu9250_set_gyroscope_range(mpu9250_handle_t *handle, mpu9250_gyroscope_range_t range)
set the gyroscope range
Definition: driver_mpu9250.c:7415
mpu9250_set_interrupt_pin_type
uint8_t mpu9250_set_interrupt_pin_type(mpu9250_handle_t *handle, mpu9250_pin_type_t type)
set the interrupt pin type
Definition: driver_mpu9250.c:8380
mpu9250_set_iic_master
uint8_t mpu9250_set_iic_master(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic master mode
Definition: driver_mpu9250.c:5879
mpu9250_set_accelerometer_range
uint8_t mpu9250_set_accelerometer_range(mpu9250_handle_t *handle, mpu9250_accelerometer_range_t range)
set the accelerometer range
Definition: driver_mpu9250.c:7670
mpu9250_set_sleep
uint8_t mpu9250_set_sleep(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the sleep mode
Definition: driver_mpu9250.c:6613
mpu9250_force_fifo_reset
uint8_t mpu9250_force_fifo_reset(mpu9250_handle_t *handle)
force reset the fifo
Definition: driver_mpu9250.c:5844
MPU9250_IIC_DELAY_SLAVE_0
@ MPU9250_IIC_DELAY_SLAVE_0
Definition: driver_mpu9250.h:378
MPU9250_INTERRUPT_MOTION
@ MPU9250_INTERRUPT_MOTION
Definition: driver_mpu9250.h:263
MPU9250_INTERRUPT_DATA_READY
@ MPU9250_INTERRUPT_DATA_READY
Definition: driver_mpu9250.h:267
MPU9250_INTERRUPT_FSYNC_INT
@ MPU9250_INTERRUPT_FSYNC_INT
Definition: driver_mpu9250.h:265
MPU9250_INTERRUPT_DMP
@ MPU9250_INTERRUPT_DMP
Definition: driver_mpu9250.h:266
MPU9250_INTERRUPT_FIFO_OVERFLOW
@ MPU9250_INTERRUPT_FIFO_OVERFLOW
Definition: driver_mpu9250.h:264
MPU9250_SOURCE_GYRO_X
@ MPU9250_SOURCE_GYRO_X
Definition: driver_mpu9250.h:94
MPU9250_SOURCE_ACC_Z
@ MPU9250_SOURCE_ACC_Z
Definition: driver_mpu9250.h:93
MPU9250_SOURCE_GYRO_Y
@ MPU9250_SOURCE_GYRO_Y
Definition: driver_mpu9250.h:95
MPU9250_SOURCE_GYRO_Z
@ MPU9250_SOURCE_GYRO_Z
Definition: driver_mpu9250.h:96
MPU9250_SOURCE_ACC_X
@ MPU9250_SOURCE_ACC_X
Definition: driver_mpu9250.h:91
MPU9250_SOURCE_ACC_Y
@ MPU9250_SOURCE_ACC_Y
Definition: driver_mpu9250.h:92
MPU9250_INTERFACE_SPI
@ MPU9250_INTERFACE_SPI
Definition: driver_mpu9250.h:65
MPU9250_INTERFACE_IIC
@ MPU9250_INTERFACE_IIC
Definition: driver_mpu9250.h:64
MPU9250_BOOL_TRUE
@ MPU9250_BOOL_TRUE
Definition: driver_mpu9250.h:83
MPU9250_BOOL_FALSE
@ MPU9250_BOOL_FALSE
Definition: driver_mpu9250.h:82
MPU9250_AXIS_X
@ MPU9250_AXIS_X
Definition: driver_mpu9250.h:193
MPU9250_AXIS_Z
@ MPU9250_AXIS_Z
Definition: driver_mpu9250.h:191
MPU9250_AXIS_Y
@ MPU9250_AXIS_Y
Definition: driver_mpu9250.h:192
MPU9250_FIFO_XG
@ MPU9250_FIFO_XG
Definition: driver_mpu9250.h:224
MPU9250_FIFO_YG
@ MPU9250_FIFO_YG
Definition: driver_mpu9250.h:225
MPU9250_FIFO_ZG
@ MPU9250_FIFO_ZG
Definition: driver_mpu9250.h:226
MPU9250_FIFO_ACCEL
@ MPU9250_FIFO_ACCEL
Definition: driver_mpu9250.h:227
MPU9250_FIFO_TEMP
@ MPU9250_FIFO_TEMP
Definition: driver_mpu9250.h:223
MPU9250_FIFO_DEFAULT_GYROSCOPE_STANDBY
#define MPU9250_FIFO_DEFAULT_GYROSCOPE_STANDBY
Definition: driver_mpu9250_fifo.h:74
MPU9250_FIFO_DEFAULT_INTERRUPT_FIFO_OVERFLOW
#define MPU9250_FIFO_DEFAULT_INTERRUPT_FIFO_OVERFLOW
Definition: driver_mpu9250_fifo.h:63
MPU9250_FIFO_DEFAULT_LOW_POWER_ACCEL_OUTPUT_RATE
#define MPU9250_FIFO_DEFAULT_LOW_POWER_ACCEL_OUTPUT_RATE
Definition: driver_mpu9250_fifo.h:79
MPU9250_FIFO_DEFAULT_IIC_DELAY
#define MPU9250_FIFO_DEFAULT_IIC_DELAY
Definition: driver_mpu9250_fifo.h:88
MPU9250_FIFO_DEFAULT_IIC_WAIT_FOR_EXTERNAL_SENSOR
#define MPU9250_FIFO_DEFAULT_IIC_WAIT_FOR_EXTERNAL_SENSOR
Definition: driver_mpu9250_fifo.h:86
MPU9250_FIFO_DEFAULT_LOW_PASS_FILTER
#define MPU9250_FIFO_DEFAULT_LOW_PASS_FILTER
Definition: driver_mpu9250_fifo.h:58
MPU9250_FIFO_DEFAULT_ACCELEROMETER_LOW_PASS_FILTER
#define MPU9250_FIFO_DEFAULT_ACCELEROMETER_LOW_PASS_FILTER
Definition: driver_mpu9250_fifo.h:78
MPU9250_FIFO_DEFAULT_FSYNC_INTERRUPT
#define MPU9250_FIFO_DEFAULT_FSYNC_INTERRUPT
Definition: driver_mpu9250_fifo.h:70
MPU9250_FIFO_DEFAULT_INTERRUPT_MOTION
#define MPU9250_FIFO_DEFAULT_INTERRUPT_MOTION
Definition: driver_mpu9250_fifo.h:62
MPU9250_FIFO_DEFAULT_EXTERN_SYNC
#define MPU9250_FIFO_DEFAULT_EXTERN_SYNC
Definition: driver_mpu9250_fifo.h:69
mpu9250_fifo_init
uint8_t mpu9250_fifo_init(mpu9250_interface_t interface, mpu9250_address_t addr_pin)
fifo example init
Definition: driver_mpu9250_fifo.c:69
MPU9250_FIFO_DEFAULT_INTERRUPT_PIN_TYPE
#define MPU9250_FIFO_DEFAULT_INTERRUPT_PIN_TYPE
Definition: driver_mpu9250_fifo.h:61
MPU9250_FIFO_DEFAULT_INTERRUPT_PIN_LEVEL
#define MPU9250_FIFO_DEFAULT_INTERRUPT_PIN_LEVEL
Definition: driver_mpu9250_fifo.h:60
mpu9250_fifo_read
uint8_t mpu9250_fifo_read(int16_t(*accel_raw)[3], float(*accel_g)[3], int16_t(*gyro_raw)[3], float(*gyro_dps)[3], int16_t(*mag_raw)[3], float(*mag_ut)[3], uint16_t *len)
fifo example read
Definition: driver_mpu9250_fifo.c:777
MPU9250_FIFO_DEFAULT_MAGNETOMETER_BITS
#define MPU9250_FIFO_DEFAULT_MAGNETOMETER_BITS
Definition: driver_mpu9250_fifo.h:83
MPU9250_FIFO_DEFAULT_FSYNC_INTERRUPT_LEVEL
#define MPU9250_FIFO_DEFAULT_FSYNC_INTERRUPT_LEVEL
Definition: driver_mpu9250_fifo.h:71
MPU9250_FIFO_DEFAULT_INTERRUPT_LATCH
#define MPU9250_FIFO_DEFAULT_INTERRUPT_LATCH
Definition: driver_mpu9250_fifo.h:67
MPU9250_FIFO_DEFAULT_INTERRUPT_READ_CLEAR
#define MPU9250_FIFO_DEFAULT_INTERRUPT_READ_CLEAR
Definition: driver_mpu9250_fifo.h:68
MPU9250_FIFO_DEFAULT_GYROSCOPE_CHOICE
#define MPU9250_FIFO_DEFAULT_GYROSCOPE_CHOICE
Definition: driver_mpu9250_fifo.h:76
MPU9250_FIFO_DEFAULT_IIC_READ_MODE
#define MPU9250_FIFO_DEFAULT_IIC_READ_MODE
Definition: driver_mpu9250_fifo.h:87
mpu9250_fifo_deinit
uint8_t mpu9250_fifo_deinit(void)
fifo example deinit
Definition: driver_mpu9250_fifo.c:800
MPU9250_FIFO_DEFAULT_INTERRUPT_FSYNC_INT
#define MPU9250_FIFO_DEFAULT_INTERRUPT_FSYNC_INT
Definition: driver_mpu9250_fifo.h:65
MPU9250_FIFO_DEFAULT_IIC_BYPASS
#define MPU9250_FIFO_DEFAULT_IIC_BYPASS
Definition: driver_mpu9250_fifo.h:73
MPU9250_FIFO_DEFAULT_ACCELEROMETER_CHOICE
#define MPU9250_FIFO_DEFAULT_ACCELEROMETER_CHOICE
Definition: driver_mpu9250_fifo.h:77
MPU9250_FIFO_DEFAULT_RATE
#define MPU9250_FIFO_DEFAULT_RATE
Definition: driver_mpu9250_fifo.h:55
MPU9250_FIFO_DEFAULT_IIC_MASTER
#define MPU9250_FIFO_DEFAULT_IIC_MASTER
Definition: driver_mpu9250_fifo.h:72
MPU9250_FIFO_DEFAULT_IIC_MULTI_MASTER
#define MPU9250_FIFO_DEFAULT_IIC_MULTI_MASTER
Definition: driver_mpu9250_fifo.h:85
MPU9250_FIFO_DEFAULT_CLOCK_SOURCE
#define MPU9250_FIFO_DEFAULT_CLOCK_SOURCE
mpu9250 fifo example default definition
Definition: driver_mpu9250_fifo.h:54
MPU9250_FIFO_DEFAULT_IIC_CLOCK
#define MPU9250_FIFO_DEFAULT_IIC_CLOCK
Definition: driver_mpu9250_fifo.h:84
MPU9250_FIFO_DEFAULT_INTERRUPT_DATA_READY
#define MPU9250_FIFO_DEFAULT_INTERRUPT_DATA_READY
Definition: driver_mpu9250_fifo.h:66
MPU9250_FIFO_DEFAULT_MAGNETOMETER_MODE
#define MPU9250_FIFO_DEFAULT_MAGNETOMETER_MODE
Definition: driver_mpu9250_fifo.h:82
MPU9250_FIFO_DEFAULT_ACCELEROMETER_RANGE
#define MPU9250_FIFO_DEFAULT_ACCELEROMETER_RANGE
Definition: driver_mpu9250_fifo.h:56
MPU9250_FIFO_DEFAULT_FIFO_MODE
#define MPU9250_FIFO_DEFAULT_FIFO_MODE
Definition: driver_mpu9250_fifo.h:75
MPU9250_FIFO_DEFAULT_WAKE_ON_MOTION
#define MPU9250_FIFO_DEFAULT_WAKE_ON_MOTION
Definition: driver_mpu9250_fifo.h:80
mpu9250_fifo_irq_handler
uint8_t mpu9250_fifo_irq_handler(void)
fifo irq
Definition: driver_mpu9250_fifo.c:48
MPU9250_FIFO_DEFAULT_ACCELEROMETER_COMPARE
#define MPU9250_FIFO_DEFAULT_ACCELEROMETER_COMPARE
Definition: driver_mpu9250_fifo.h:81
MPU9250_FIFO_DEFAULT_CYCLE_WAKE_UP
#define MPU9250_FIFO_DEFAULT_CYCLE_WAKE_UP
Definition: driver_mpu9250_fifo.h:59
MPU9250_FIFO_DEFAULT_INTERRUPT_DMP
#define MPU9250_FIFO_DEFAULT_INTERRUPT_DMP
Definition: driver_mpu9250_fifo.h:64
MPU9250_FIFO_DEFAULT_GYROSCOPE_RANGE
#define MPU9250_FIFO_DEFAULT_GYROSCOPE_RANGE
Definition: driver_mpu9250_fifo.h:57
mpu9250_interface_debug_print
void mpu9250_interface_debug_print(const char *const fmt,...)
interface print format data
Definition: driver_mpu9250_interface_template.c:164
mpu9250_interface_spi_write
uint8_t mpu9250_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
Definition: driver_mpu9250_interface_template.c:144
mpu9250_interface_iic_deinit
uint8_t mpu9250_interface_iic_deinit(void)
interface iic bus deinit
Definition: driver_mpu9250_interface_template.c:58
mpu9250_interface_iic_write
uint8_t mpu9250_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
Definition: driver_mpu9250_interface_template.c:90
mpu9250_interface_iic_read
uint8_t mpu9250_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
Definition: driver_mpu9250_interface_template.c:74
mpu9250_interface_iic_init
uint8_t mpu9250_interface_iic_init(void)
interface iic bus init
Definition: driver_mpu9250_interface_template.c:46
mpu9250_interface_spi_read
uint8_t mpu9250_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
Definition: driver_mpu9250_interface_template.c:129
mpu9250_interface_spi_init
uint8_t mpu9250_interface_spi_init(void)
interface spi bus init
Definition: driver_mpu9250_interface_template.c:102
mpu9250_interface_receive_callback
void mpu9250_interface_receive_callback(uint8_t type)
interface receive callback
Definition: driver_mpu9250_interface_template.c:174
mpu9250_interface_delay_ms
void mpu9250_interface_delay_ms(uint32_t ms)
interface delay ms
Definition: driver_mpu9250_interface_template.c:154
mpu9250_interface_spi_deinit
uint8_t mpu9250_interface_spi_deinit(void)
interface spi bus deinit
Definition: driver_mpu9250_interface_template.c:114
DRIVER_MPU9250_LINK_INIT
#define DRIVER_MPU9250_LINK_INIT(HANDLE, STRUCTURE)
initialize mpu9250_handle_t structure
Definition: driver_mpu9250.h:560
DRIVER_MPU9250_LINK_RECEIVE_CALLBACK
#define DRIVER_MPU9250_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
link receive_callback function
Definition: driver_mpu9250.h:648
DRIVER_MPU9250_LINK_IIC_DEINIT
#define DRIVER_MPU9250_LINK_IIC_DEINIT(HANDLE, FUC)
link iic_deinit function
Definition: driver_mpu9250.h:576
DRIVER_MPU9250_LINK_SPI_INIT
#define DRIVER_MPU9250_LINK_SPI_INIT(HANDLE, FUC)
link spi_init function
Definition: driver_mpu9250.h:600
DRIVER_MPU9250_LINK_SPI_READ
#define DRIVER_MPU9250_LINK_SPI_READ(HANDLE, FUC)
link spi_read function
Definition: driver_mpu9250.h:616
DRIVER_MPU9250_LINK_IIC_READ
#define DRIVER_MPU9250_LINK_IIC_READ(HANDLE, FUC)
link iic_read function
Definition: driver_mpu9250.h:584
DRIVER_MPU9250_LINK_IIC_WRITE
#define DRIVER_MPU9250_LINK_IIC_WRITE(HANDLE, FUC)
link iic_write function
Definition: driver_mpu9250.h:592
DRIVER_MPU9250_LINK_SPI_DEINIT
#define DRIVER_MPU9250_LINK_SPI_DEINIT(HANDLE, FUC)
link spi_deinit function
Definition: driver_mpu9250.h:608
DRIVER_MPU9250_LINK_IIC_INIT
#define DRIVER_MPU9250_LINK_IIC_INIT(HANDLE, FUC)
link iic_init function
Definition: driver_mpu9250.h:568
DRIVER_MPU9250_LINK_DEBUG_PRINT
#define DRIVER_MPU9250_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
Definition: driver_mpu9250.h:640
DRIVER_MPU9250_LINK_DELAY_MS
#define DRIVER_MPU9250_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
Definition: driver_mpu9250.h:632
DRIVER_MPU9250_LINK_SPI_WRITE
#define DRIVER_MPU9250_LINK_SPI_WRITE(HANDLE, FUC)
link spi_write function
Definition: driver_mpu9250.h:624
mpu9250_mag_set_mode
uint8_t mpu9250_mag_set_mode(mpu9250_handle_t *handle, mpu9250_magnetometer_mode_t mode)
magnetometer set the mode
Definition: driver_mpu9250.c:5186
mpu9250_mag_set_bits
uint8_t mpu9250_mag_set_bits(mpu9250_handle_t *handle, mpu9250_magnetometer_bits_t bits)
magnetometer set the bits
Definition: driver_mpu9250.c:5282
mpu9250_mag_init
uint8_t mpu9250_mag_init(mpu9250_handle_t *handle)
initialize the magnetometer of mpu9250
Definition: driver_mpu9250.c:4742
mpu9250_mag_deinit
uint8_t mpu9250_mag_deinit(mpu9250_handle_t *handle)
magnetometer deinit
Definition: driver_mpu9250.c:4894
mpu9250_mag_set_fifo_mode
uint8_t mpu9250_mag_set_fifo_mode(mpu9250_handle_t *handle)
magnetometer set into fifo mode
Definition: driver_mpu9250.c:5654
mpu9250_handle_s
mpu9250 handle structure definition
Definition: driver_mpu9250.h:502