| LibDriver MPU9250 1.0.0 MPU9250 full function driver

driver_mpu9250_fifo_test.c
Go to the documentation of this file.
1
37 #include "driver_mpu9250_fifo_test.h"
38
39 static mpu9250_handle_t gs_handle;
40 static int16_t gs_accel_raw[80][3];
41 static float gs_accel_g[80][3];
42 static int16_t gs_gyro_raw[80][3];
43 static float gs_gyro_dps[80][3];
44 static int16_t gs_mag_raw[80][3];
45 static float gs_mag_ut[80][3];
46 static uint16_t gs_len;
55 uint8_t mpu9250_fifo_test_irq_handler(void)
56 {
57 if (mpu9250_irq_handler(&gs_handle) != 0)
58 {
59 return 1;
60 }
61 else
62 {
63 return 0;
64 }
65 }
66
77 uint8_t mpu9250_fifo_test(mpu9250_interface_t interface, mpu9250_address_t addr, uint32_t times)
78 {
79 uint8_t res;
80 uint32_t i;
81 mpu9250_info_t info;
82
83 /* link interface function */
84 DRIVER_MPU9250_LINK_INIT(&gs_handle, mpu9250_handle_t);
85 DRIVER_MPU9250_LINK_IIC_INIT(&gs_handle, mpu9250_interface_iic_init);
86 DRIVER_MPU9250_LINK_IIC_DEINIT(&gs_handle, mpu9250_interface_iic_deinit);
87 DRIVER_MPU9250_LINK_IIC_READ(&gs_handle, mpu9250_interface_iic_read);
88 DRIVER_MPU9250_LINK_IIC_WRITE(&gs_handle, mpu9250_interface_iic_write);
89 DRIVER_MPU9250_LINK_SPI_INIT(&gs_handle, mpu9250_interface_spi_init);
90 DRIVER_MPU9250_LINK_SPI_DEINIT(&gs_handle, mpu9250_interface_spi_deinit);
91 DRIVER_MPU9250_LINK_SPI_READ(&gs_handle, mpu9250_interface_spi_read);
92 DRIVER_MPU9250_LINK_SPI_WRITE(&gs_handle, mpu9250_interface_spi_write);
93 DRIVER_MPU9250_LINK_DELAY_MS(&gs_handle, mpu9250_interface_delay_ms);
94 DRIVER_MPU9250_LINK_DEBUG_PRINT(&gs_handle, mpu9250_interface_debug_print);
95 DRIVER_MPU9250_LINK_RECEIVE_CALLBACK(&gs_handle, mpu9250_interface_receive_callback);
96
97 /* get information */
98 res = mpu9250_info(&info);
99 if (res != 0)
100 {
101 mpu9250_interface_debug_print("mpu9250: get info failed.\n");
102
103 return 1;
104 }
105 else
106 {
107 /* print chip info */
108 mpu9250_interface_debug_print("mpu9250: chip is %s.\n", info.chip_name);
109 mpu9250_interface_debug_print("mpu9250: manufacturer is %s.\n", info.manufacturer_name);
110 mpu9250_interface_debug_print("mpu9250: interface is %s.\n", info.interface);
111 mpu9250_interface_debug_print("mpu9250: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
112 mpu9250_interface_debug_print("mpu9250: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
113 mpu9250_interface_debug_print("mpu9250: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
114 mpu9250_interface_debug_print("mpu9250: max current is %0.2fmA.\n", info.max_current_ma);
115 mpu9250_interface_debug_print("mpu9250: max temperature is %0.1fC.\n", info.temperature_max);
116 mpu9250_interface_debug_print("mpu9250: min temperature is %0.1fC.\n", info.temperature_min);
117 }
118
119 /* start fifo test */
120 mpu9250_interface_debug_print("mpu9250: start fifo test.\n");
121
122 /* set the interface */
123 res = mpu9250_set_interface(&gs_handle, interface);
124 if (res != 0)
125 {
126 mpu9250_interface_debug_print("mpu9250: set interface failed.\n");
127
128 return 1;
129 }
130
131 /* set the addr pin */
132 res = mpu9250_set_addr_pin(&gs_handle, addr);
133 if (res != 0)
134 {
135 mpu9250_interface_debug_print("mpu9250: set addr pin failed.\n");
136
137 return 1;
138 }
139
140 /* init */
141 res = mpu9250_init(&gs_handle);
142 if (res != 0)
143 {
144 mpu9250_interface_debug_print("mpu9250: init failed.\n");
145
146 return 1;
147 }
148
149 /* delay 100 ms */
150 mpu9250_interface_delay_ms(100);
151
152 /* disable sleep */
153 res = mpu9250_set_sleep(&gs_handle, MPU9250_BOOL_FALSE);
154 if (res != 0)
155 {
156 mpu9250_interface_debug_print("mpu9250: set sleep failed.\n");
157 (void)mpu9250_deinit(&gs_handle);
158
159 return 1;
160 }
161
162 /* if spi interface, disable iic interface */
163 if (interface == MPU9250_INTERFACE_SPI)
164 {
165 /* disable iic */
166 res = mpu9250_set_disable_iic_slave(&gs_handle, MPU9250_BOOL_TRUE);
167 if (res != 0)
168 {
169 mpu9250_interface_debug_print("mpu9250: set disable iic slave failed.\n");
170 (void)mpu9250_deinit(&gs_handle);
171
172 return 1;
173 }
174 }
175
176 /* set fifo 1024kb */
177 res = mpu9250_set_fifo_1024kb(&gs_handle);
178 if (res != 0)
179 {
180 mpu9250_interface_debug_print("mpu9250: set fifo 1024kb failed.\n");
181 (void)mpu9250_deinit(&gs_handle);
182
183 return 1;
184 }
185
186 /* set pll */
187 res = mpu9250_set_clock_source(&gs_handle, MPU9250_CLOCK_SOURCE_PLL);
188 if (res != 0)
189 {
190 mpu9250_interface_debug_print("mpu9250: set clock source failed.\n");
191 (void)mpu9250_deinit(&gs_handle);
192
193 return 1;
194 }
195
196 /* set 50Hz */
197 res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
198 if (res != 0)
199 {
200 mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
201 (void)mpu9250_deinit(&gs_handle);
202
203 return 1;
204 }
205
206 /* ±2g */
207 res = mpu9250_set_accelerometer_range(&gs_handle, MPU9250_ACCELEROMETER_RANGE_2G);
208 if (res != 0)
209 {
210 mpu9250_interface_debug_print("mpu9250: set accelerometer range failed.\n");
211 (void)mpu9250_deinit(&gs_handle);
212
213 return 1;
214 }
215
216 /* ±2000dps */
217 res = mpu9250_set_gyroscope_range(&gs_handle, MPU9250_GYROSCOPE_RANGE_2000DPS);
218 if (res != 0)
219 {
220 mpu9250_interface_debug_print("mpu9250: set gyroscope range failed.\n");
221 (void)mpu9250_deinit(&gs_handle);
222
223 return 1;
224 }
225
226 /* enable temperature sensor */
227 res = mpu9250_set_ptat(&gs_handle, MPU9250_BOOL_TRUE);
228 if (res != 0)
229 {
230 mpu9250_interface_debug_print("mpu9250: set ptat failed.\n");
231 (void)mpu9250_deinit(&gs_handle);
232
233 return 1;
234 }
235
236 /* disable cycle wake up */
237 res = mpu9250_set_cycle_wake_up(&gs_handle, MPU9250_BOOL_FALSE);
238 if (res != 0)
239 {
240 mpu9250_interface_debug_print("mpu9250: set cycle wake up failed.\n");
241 (void)mpu9250_deinit(&gs_handle);
242
243 return 1;
244 }
245
246 /* enable acc x */
247 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_X, MPU9250_BOOL_FALSE);
248 if (res != 0)
249 {
250 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
251 (void)mpu9250_deinit(&gs_handle);
252
253 return 1;
254 }
255
256 /* enable acc y */
257 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Y, MPU9250_BOOL_FALSE);
258 if (res != 0)
259 {
260 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
261 (void)mpu9250_deinit(&gs_handle);
262
263 return 1;
264 }
265
266 /* enable acc z */
267 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Z, MPU9250_BOOL_FALSE);
268 if (res != 0)
269 {
270 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
271 (void)mpu9250_deinit(&gs_handle);
272
273 return 1;
274 }
275
276 /* enable gyro x */
277 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_X, MPU9250_BOOL_FALSE);
278 if (res != 0)
279 {
280 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
281 (void)mpu9250_deinit(&gs_handle);
282
283 return 1;
284 }
285
286 /* enable gyro y */
287 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Y, MPU9250_BOOL_FALSE);
288 if (res != 0)
289 {
290 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
291 (void)mpu9250_deinit(&gs_handle);
292
293 return 1;
294 }
295
296 /* enable gyro z */
297 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Z, MPU9250_BOOL_FALSE);
298 if (res != 0)
299 {
300 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
301 (void)mpu9250_deinit(&gs_handle);
302
303 return 1;
304 }
305
306 /* disable gyroscope x test */
307 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
308 if (res != 0)
309 {
310 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
311 (void)mpu9250_deinit(&gs_handle);
312
313 return 1;
314 }
315
316 /* disable gyroscope y test */
317 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
318 if (res != 0)
319 {
320 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
321 (void)mpu9250_deinit(&gs_handle);
322
323 return 1;
324 }
325
326 /* disable gyroscope z test */
327 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
328 if (res != 0)
329 {
330 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
331 (void)mpu9250_deinit(&gs_handle);
332
333 return 1;
334 }
335
336 /* disable accelerometer x test */
337 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
338 if (res != 0)
339 {
340 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
341 (void)mpu9250_deinit(&gs_handle);
342
343 return 1;
344 }
345
346 /* disable accelerometer y test */
347 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
348 if (res != 0)
349 {
350 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
351 (void)mpu9250_deinit(&gs_handle);
352
353 return 1;
354 }
355
356 /* disable accelerometer z test */
357 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
358 if (res != 0)
359 {
360 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
361 (void)mpu9250_deinit(&gs_handle);
362
363 return 1;
364 }
365
366 /* disable temp fifo */
367 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_TEMP, MPU9250_BOOL_FALSE);
368 if (res != 0)
369 {
370 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
371 (void)mpu9250_deinit(&gs_handle);
372
373 return 1;
374 }
375
376 /* enable xg fifo */
377 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_XG, MPU9250_BOOL_TRUE);
378 if (res != 0)
379 {
380 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
381 (void)mpu9250_deinit(&gs_handle);
382
383 return 1;
384 }
385
386 /* enable yg fifo */
387 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_YG, MPU9250_BOOL_TRUE);
388 if (res != 0)
389 {
390 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
391 (void)mpu9250_deinit(&gs_handle);
392
393 return 1;
394 }
395
396 /* enable zg fifo */
397 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ZG, MPU9250_BOOL_TRUE);
398 if (res != 0)
399 {
400 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
401 (void)mpu9250_deinit(&gs_handle);
402
403 return 1;
404 }
405
406 /* enable accel fifo */
407 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ACCEL, MPU9250_BOOL_TRUE);
408 if (res != 0)
409 {
410 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
411 (void)mpu9250_deinit(&gs_handle);
412
413 return 1;
414 }
415
416 /* set interrupt level low */
417 res = mpu9250_set_interrupt_level(&gs_handle, MPU9250_PIN_LEVEL_LOW);
418 if (res != 0)
419 {
420 mpu9250_interface_debug_print("mpu9250: set interrupt level failed.\n");
421 (void)mpu9250_deinit(&gs_handle);
422
423 return 1;
424 }
425
426 /* push-pull */
427 res = mpu9250_set_interrupt_pin_type(&gs_handle, MPU9250_PIN_TYPE_PUSH_PULL);
428 if (res != 0)
429 {
430 mpu9250_interface_debug_print("mpu9250: set interrupt pin type failed.\n");
431 (void)mpu9250_deinit(&gs_handle);
432
433 return 1;
434 }
435
436 /* disable motion */
437 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_MOTION, MPU9250_BOOL_FALSE);
438 if (res != 0)
439 {
440 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
441 (void)mpu9250_deinit(&gs_handle);
442
443 return 1;
444 }
445
446 /* enable fifo overflow */
447 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FIFO_OVERFLOW, MPU9250_BOOL_TRUE);
448 if (res != 0)
449 {
450 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
451 (void)mpu9250_deinit(&gs_handle);
452
453 return 1;
454 }
455
456 /* disable dmp interrupt */
457 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DMP, MPU9250_BOOL_FALSE);
458 if (res != 0)
459 {
460 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
461 (void)mpu9250_deinit(&gs_handle);
462
463 return 1;
464 }
465
466 /* disable fsync int */
467 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FSYNC_INT, MPU9250_BOOL_FALSE);
468 if (res != 0)
469 {
470 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
471 (void)mpu9250_deinit(&gs_handle);
472
473 return 1;
474 }
475
476 /* disable data ready */
477 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DATA_READY, MPU9250_BOOL_FALSE);
478 if (res != 0)
479 {
480 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
481 (void)mpu9250_deinit(&gs_handle);
482
483 return 1;
484 }
485
486 /* enable latch */
487 res = mpu9250_set_interrupt_latch(&gs_handle, MPU9250_BOOL_TRUE);
488 if (res != 0)
489 {
490 mpu9250_interface_debug_print("mpu9250: set interrupt latch failed.\n");
491 (void)mpu9250_deinit(&gs_handle);
492
493 return 1;
494 }
495
496 /* enable interrupt read clear */
497 res = mpu9250_set_interrupt_read_clear(&gs_handle, MPU9250_BOOL_TRUE);
498 if (res != 0)
499 {
500 mpu9250_interface_debug_print("mpu9250: set interrupt read clear failed.\n");
501 (void)mpu9250_deinit(&gs_handle);
502
503 return 1;
504 }
505
506 /* disable sync input */
507 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_INPUT_DISABLED);
508 if (res != 0)
509 {
510 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
511 (void)mpu9250_deinit(&gs_handle);
512
513 return 1;
514 }
515
516 /* disable fsync interrupt */
517 res = mpu9250_set_fsync_interrupt(&gs_handle, MPU9250_BOOL_FALSE);
518 if (res != 0)
519 {
520 mpu9250_interface_debug_print("mpu9250: set fsync interrupt failed.\n");
521 (void)mpu9250_deinit(&gs_handle);
522
523 return 1;
524 }
525
526 /* fsync interrupt level low */
527 res = mpu9250_set_fsync_interrupt_level(&gs_handle, MPU9250_PIN_LEVEL_LOW);
528 if (res != 0)
529 {
530 mpu9250_interface_debug_print("mpu9250: set fsync interrupt level failed.\n");
531 (void)mpu9250_deinit(&gs_handle);
532
533 return 1;
534 }
535
536 /* disable iic master */
537 res = mpu9250_set_iic_master(&gs_handle, MPU9250_BOOL_FALSE);
538 if (res != 0)
539 {
540 mpu9250_interface_debug_print("mpu9250: set iic master failed.\n");
541 (void)mpu9250_deinit(&gs_handle);
542
543 return 1;
544 }
545
546 /* disable iic bypass */
547 res = mpu9250_set_iic_bypass(&gs_handle, MPU9250_BOOL_FALSE);
548 if (res != 0)
549 {
550 mpu9250_interface_debug_print("mpu9250: set iic bypass failed.\n");
551 (void)mpu9250_deinit(&gs_handle);
552
553 return 1;
554 }
555
556 /* disable gyro standby */
557 res = mpu9250_set_gyro_standby(&gs_handle, MPU9250_BOOL_FALSE);
558 if (res != 0)
559 {
560 mpu9250_interface_debug_print("mpu9250: set gyro standby failed.\n");
561 (void)mpu9250_deinit(&gs_handle);
562
563 return 1;
564 }
565
566 /* set the fifo normal mode */
567 res = mpu9250_set_fifo_mode(&gs_handle, MPU9250_FIFO_MODE_NORMAL);
568 if (res != 0)
569 {
570 mpu9250_interface_debug_print("mpu9250: set fifo mode failed.\n");
571 (void)mpu9250_deinit(&gs_handle);
572
573 return 1;
574 }
575
576 /* set gyroscope choice 0 */
577 res = mpu9250_set_gyroscope_choice(&gs_handle, 0);
578 if (res != 0)
579 {
580 mpu9250_interface_debug_print("mpu9250: set gyroscope choice failed.\n");
581 (void)mpu9250_deinit(&gs_handle);
582
583 return 1;
584 }
585
586 /* set low pass filter 3 */
587 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_3);
588 if (res != 0)
589 {
590 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
591 (void)mpu9250_deinit(&gs_handle);
592
593 return 1;
594 }
595
596 /* set accelerometer choice 0 */
597 res = mpu9250_set_accelerometer_choice(&gs_handle, 0);
598 if (res != 0)
599 {
600 mpu9250_interface_debug_print("mpu9250: set accelerometer choice failed.\n");
601 (void)mpu9250_deinit(&gs_handle);
602
603 return 1;
604 }
605
606 /* set accelerometer low pass filter 3 */
607 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_3);
608 if (res != 0)
609 {
610 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
611 (void)mpu9250_deinit(&gs_handle);
612
613 return 1;
614 }
615
616 /* set low power accel output rate 62.5Hz */
617 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50);
618 if (res != 0)
619 {
620 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
621 (void)mpu9250_deinit(&gs_handle);
622
623 return 1;
624 }
625
626 /* disable wake on motion */
627 res = mpu9250_set_wake_on_motion(&gs_handle, MPU9250_BOOL_FALSE);
628 if (res != 0)
629 {
630 mpu9250_interface_debug_print("mpu9250: set wake on motion failed.\n");
631 (void)mpu9250_deinit(&gs_handle);
632
633 return 1;
634 }
635
636 /* enable accel compare with previous sample */
637 res = mpu9250_set_accel_compare_with_previous_sample(&gs_handle, MPU9250_BOOL_TRUE);
638 if (res != 0)
639 {
640 mpu9250_interface_debug_print("mpu9250: set accel compare with previous sample failed.\n");
641 (void)mpu9250_deinit(&gs_handle);
642
643 return 1;
644 }
645
646 /* if iic interface */
647 if (interface == MPU9250_INTERFACE_IIC)
648 {
649 /* mag init */
650 res = mpu9250_mag_init(&gs_handle);
651 if (res != 0)
652 {
653 mpu9250_interface_debug_print("mpu9250: mag init failed.\n");
654 (void)mpu9250_deinit(&gs_handle);
655
656 return 1;
657 }
658
659 /* 100Hz */
660 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_CONTINUOUS2);
661 if (res != 0)
662 {
663 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
664 (void)mpu9250_mag_deinit(&gs_handle);
665 (void)mpu9250_deinit(&gs_handle);
666
667 return 1;
668 }
669
670 /* set 16 bits */
671 res = mpu9250_mag_set_bits(&gs_handle, MPU9250_MAGNETOMETER_BITS_16);
672 if (res != 0)
673 {
674 mpu9250_interface_debug_print("mpu9250: mag set bits failed.\n");
675 (void)mpu9250_mag_deinit(&gs_handle);
676 (void)mpu9250_deinit(&gs_handle);
677
678 return 1;
679 }
680
681 /* enable iic master */
682 res = mpu9250_set_iic_master(&gs_handle, MPU9250_BOOL_TRUE);
683 if (res != 0)
684 {
685 mpu9250_interface_debug_print("mpu9250: set iic master failed.\n");
686 (void)mpu9250_mag_deinit(&gs_handle);
687 (void)mpu9250_deinit(&gs_handle);
688
689 return 1;
690 }
691
692 /* disable iic bypass */
693 res = mpu9250_set_iic_bypass(&gs_handle, MPU9250_BOOL_FALSE);
694 if (res != 0)
695 {
696 mpu9250_interface_debug_print("mpu9250: set iic bypass failed.\n");
697 (void)mpu9250_mag_deinit(&gs_handle);
698 (void)mpu9250_deinit(&gs_handle);
699
700 return 1;
701 }
702
703 /* set iic clock 400KHz */
704 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_400_KHZ);
705 if (res != 0)
706 {
707 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
708 (void)mpu9250_mag_deinit(&gs_handle);
709 (void)mpu9250_deinit(&gs_handle);
710
711 return 1;
712 }
713
714 /* enable iic multi master */
715 res = mpu9250_set_iic_multi_master(&gs_handle, MPU9250_BOOL_TRUE);
716 if (res != 0)
717 {
718 mpu9250_interface_debug_print("mpu9250: set iic multi master failed.\n");
719 (void)mpu9250_mag_deinit(&gs_handle);
720 (void)mpu9250_deinit(&gs_handle);
721
722 return 1;
723 }
724
725 /* disable iic wait for external sensor */
726 res = mpu9250_set_iic_wait_for_external_sensor(&gs_handle, MPU9250_BOOL_FALSE);
727 if (res != 0)
728 {
729 mpu9250_interface_debug_print("mpu9250: set iic wait for external sensor failed.\n");
730 (void)mpu9250_mag_deinit(&gs_handle);
731 (void)mpu9250_deinit(&gs_handle);
732
733 return 1;
734 }
735
736 /* set iic restart read mode */
737 res = mpu9250_set_iic_read_mode(&gs_handle, MPU9250_IIC_READ_MODE_RESTART);
738 if (res != 0)
739 {
740 mpu9250_interface_debug_print("mpu9250: set iic read mode failed.\n");
741 (void)mpu9250_mag_deinit(&gs_handle);
742 (void)mpu9250_deinit(&gs_handle);
743
744 return 1;
745 }
746
747 /* set slave 0 disable delay */
748 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_0, MPU9250_BOOL_FALSE);
749 if (res != 0)
750 {
751 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
752 (void)mpu9250_mag_deinit(&gs_handle);
753 (void)mpu9250_deinit(&gs_handle);
754
755 return 1;
756 }
757
758 /* mag set fifo mode */
759 res = mpu9250_mag_set_fifo_mode(&gs_handle);
760 if (res != 0)
761 {
762 mpu9250_interface_debug_print("mpu9250: mag set fifo mode failed.\n");
763 (void)mpu9250_mag_deinit(&gs_handle);
764 (void)mpu9250_deinit(&gs_handle);
765
766 return 1;
767 }
768 }
769
770 /* enable fifo */
771 res = mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_TRUE);
772 if (res != 0)
773 {
774 mpu9250_interface_debug_print("mpu9250: set fifo failed.\n");
775 if (interface == MPU9250_INTERFACE_IIC)
776 {
777 (void)mpu9250_mag_deinit(&gs_handle);
778 }
779 (void)mpu9250_deinit(&gs_handle);
780
781 return 1;
782 }
783
784 /* force reset the fifo */
785 res = mpu9250_force_fifo_reset(&gs_handle);
786 if (res != 0)
787 {
788 mpu9250_interface_debug_print("mpu9250: force fifo reset failed.\n");
789 if (interface == MPU9250_INTERFACE_IIC)
790 {
791 (void)mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_FALSE);
792 (void)mpu9250_mag_deinit(&gs_handle);
793 }
794 (void)mpu9250_deinit(&gs_handle);
795
796 return 1;
797 }
798
799 /* delay 1000 ms */
800 mpu9250_interface_delay_ms(1000);
801
802 for (i = 0; i < times; i++)
803 {
804 /* read data */
805 gs_len = 80;
806 res = mpu9250_read(&gs_handle, gs_accel_raw, gs_accel_g, gs_gyro_raw, gs_gyro_dps, gs_mag_raw, gs_mag_ut, &gs_len);
807 if (res != 0)
808 {
809 mpu9250_interface_debug_print("mpu9250: read failed.\n");
810 if (interface == MPU9250_INTERFACE_IIC)
811 {
812 (void)mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_FALSE);
813 (void)mpu9250_mag_deinit(&gs_handle);
814 }
815 (void)mpu9250_deinit(&gs_handle);
816
817 return 1;
818 }
819
820 /* output data */
821 mpu9250_interface_debug_print("mpu9250: fifo %d.\n", gs_len);
822 mpu9250_interface_debug_print("mpu9250: acc x[0] is %0.2fg.\n", gs_accel_g[0][0]);
823 mpu9250_interface_debug_print("mpu9250: acc y[0] is %0.2fg.\n", gs_accel_g[0][1]);
824 mpu9250_interface_debug_print("mpu9250: acc z[0] is %0.2fg.\n", gs_accel_g[0][2]);
825 mpu9250_interface_debug_print("mpu9250: gyro x[0] is %0.2fdps.\n", gs_gyro_dps[0][0]);
826 mpu9250_interface_debug_print("mpu9250: gyro y[0] is %0.2fdps.\n", gs_gyro_dps[0][1]);
827 mpu9250_interface_debug_print("mpu9250: gyro z[0] is %0.2fdps.\n", gs_gyro_dps[0][2]);
828 mpu9250_interface_debug_print("mpu9250: mag x[0] is %0.2fuT.\n", gs_mag_ut[0][0]);
829 mpu9250_interface_debug_print("mpu9250: mag y[0] is %0.2fuT.\n", gs_mag_ut[0][1]);
830 mpu9250_interface_debug_print("mpu9250: mag z[0] is %0.2fuT.\n", gs_mag_ut[0][2]);
831
832 /* delay 500 ms */
833 mpu9250_interface_delay_ms(500);
834 }
835
836 /* finish fifo test */
837 mpu9250_interface_debug_print("mpu9250: finish fifo test.\n");
838 if (interface == MPU9250_INTERFACE_IIC)
839 {
840 (void)mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_FALSE);
841 (void)mpu9250_mag_deinit(&gs_handle);
842 }
843 (void)mpu9250_deinit(&gs_handle);
844
845 return 0;
846 }
driver_mpu9250_fifo_test.h
driver mpu9250 fifo test 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_info
uint8_t mpu9250_info(mpu9250_info_t *info)
get the chip's information
Definition: driver_mpu9250.c:13083
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_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_ACCELEROMETER_RANGE_2G
@ MPU9250_ACCELEROMETER_RANGE_2G
Definition: driver_mpu9250.h:212
MPU9250_PIN_TYPE_PUSH_PULL
@ MPU9250_PIN_TYPE_PUSH_PULL
Definition: driver_mpu9250.h:254
MPU9250_IIC_DELAY_SLAVE_0
@ MPU9250_IIC_DELAY_SLAVE_0
Definition: driver_mpu9250.h:378
MPU9250_GYROSCOPE_RANGE_2000DPS
@ MPU9250_GYROSCOPE_RANGE_2000DPS
Definition: driver_mpu9250.h:204
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_EXTERN_SYNC_INPUT_DISABLED
@ MPU9250_EXTERN_SYNC_INPUT_DISABLED
Definition: driver_mpu9250.h:124
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_LOW_PASS_FILTER_3
@ MPU9250_LOW_PASS_FILTER_3
Definition: driver_mpu9250.h:144
MPU9250_FIFO_MODE_NORMAL
@ MPU9250_FIFO_MODE_NORMAL
Definition: driver_mpu9250.h:237
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50
Definition: driver_mpu9250.h:180
MPU9250_IIC_READ_MODE_RESTART
@ MPU9250_IIC_READ_MODE_RESTART
Definition: driver_mpu9250.h:310
MPU9250_IIC_CLOCK_400_KHZ
@ MPU9250_IIC_CLOCK_400_KHZ
Definition: driver_mpu9250.h:300
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_ACCELEROMETER_LOW_PASS_FILTER_3
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_3
Definition: driver_mpu9250.h:160
MPU9250_PIN_LEVEL_LOW
@ MPU9250_PIN_LEVEL_LOW
Definition: driver_mpu9250.h:246
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_CLOCK_SOURCE_PLL
@ MPU9250_CLOCK_SOURCE_PLL
Definition: driver_mpu9250.h:105
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_MAGNETOMETER_BITS_16
@ MPU9250_MAGNETOMETER_BITS_16
Definition: driver_mpu9250.h:428
MPU9250_MAGNETOMETER_MODE_CONTINUOUS2
@ MPU9250_MAGNETOMETER_MODE_CONTINUOUS2
Definition: driver_mpu9250.h:416
mpu9250_fifo_test_irq_handler
uint8_t mpu9250_fifo_test_irq_handler(void)
fifo test irq
Definition: driver_mpu9250_fifo_test.c:55
mpu9250_fifo_test
uint8_t mpu9250_fifo_test(mpu9250_interface_t interface, mpu9250_address_t addr, uint32_t times)
fifo test
Definition: driver_mpu9250_fifo_test.c:77
mpu9250_handle_s
mpu9250 handle structure definition
Definition: driver_mpu9250.h:502
mpu9250_info_s
mpu9250 information structure definition
Definition: driver_mpu9250.h:531
mpu9250_info_s::temperature_max
float temperature_max
Definition: driver_mpu9250.h:539
mpu9250_info_s::supply_voltage_max_v
float supply_voltage_max_v
Definition: driver_mpu9250.h:536
mpu9250_info_s::driver_version
uint32_t driver_version
Definition: driver_mpu9250.h:540
mpu9250_info_s::temperature_min
float temperature_min
Definition: driver_mpu9250.h:538
mpu9250_info_s::max_current_ma
float max_current_ma
Definition: driver_mpu9250.h:537
mpu9250_info_s::manufacturer_name
char manufacturer_name[32]
Definition: driver_mpu9250.h:533
mpu9250_info_s::supply_voltage_min_v
float supply_voltage_min_v
Definition: driver_mpu9250.h:535
mpu9250_info_s::interface
char interface[8]
Definition: driver_mpu9250.h:534
mpu9250_info_s::chip_name
char chip_name[32]
Definition: driver_mpu9250.h:532