LibDriver MPU6050
Loading...
Searching...
No Matches
driver_mpu6050_read_test.c
Go to the documentation of this file.
1
36
38
39static mpu6050_handle_t gs_handle;
40
50uint8_t mpu6050_read_test(mpu6050_address_t addr, uint32_t times)
51{
52 uint8_t res;
53 uint32_t i;
54 mpu6050_info_t info;
55
56 /* link interface function */
65
66 /* get information */
67 res = mpu6050_info(&info);
68 if (res != 0)
69 {
70 mpu6050_interface_debug_print("mpu6050: get info failed.\n");
71
72 return 1;
73 }
74 else
75 {
76 /* print chip info */
77 mpu6050_interface_debug_print("mpu6050: chip is %s.\n", info.chip_name);
78 mpu6050_interface_debug_print("mpu6050: manufacturer is %s.\n", info.manufacturer_name);
79 mpu6050_interface_debug_print("mpu6050: interface is %s.\n", info.interface);
80 mpu6050_interface_debug_print("mpu6050: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
81 mpu6050_interface_debug_print("mpu6050: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
82 mpu6050_interface_debug_print("mpu6050: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
83 mpu6050_interface_debug_print("mpu6050: max current is %0.2fmA.\n", info.max_current_ma);
84 mpu6050_interface_debug_print("mpu6050: max temperature is %0.1fC.\n", info.temperature_max);
85 mpu6050_interface_debug_print("mpu6050: min temperature is %0.1fC.\n", info.temperature_min);
86 }
87
88 /* start read test */
89 mpu6050_interface_debug_print("mpu6050: start read test.\n");
90
91 /* set the addr pin */
92 res = mpu6050_set_addr_pin(&gs_handle, addr);
93 if (res != 0)
94 {
95 mpu6050_interface_debug_print("mpu6050: set addr pin failed.\n");
96
97 return 1;
98 }
99
100 /* init */
101 res = mpu6050_init(&gs_handle);
102 if (res != 0)
103 {
104 mpu6050_interface_debug_print("mpu6050: init failed.\n");
105
106 return 1;
107 }
108
109 /* delay 100 ms */
111
112 /* disable sleep */
113 res = mpu6050_set_sleep(&gs_handle, MPU6050_BOOL_FALSE);
114 if (res != 0)
115 {
116 mpu6050_interface_debug_print("mpu6050: set sleep failed.\n");
117 (void)mpu6050_deinit(&gs_handle);
118
119 return 1;
120 }
121
122 /* set pll x */
124 if (res != 0)
125 {
126 mpu6050_interface_debug_print("mpu6050: set clock source failed.\n");
127 (void)mpu6050_deinit(&gs_handle);
128
129 return 1;
130 }
131
132 /* set 50Hz */
133 res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
134 if (res != 0)
135 {
136 mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
137 (void)mpu6050_deinit(&gs_handle);
138
139 return 1;
140 }
141
142 /* set low pass filter 3 */
144 if (res != 0)
145 {
146 mpu6050_interface_debug_print("mpu6050: set low pass filter failed.\n");
147 (void)mpu6050_deinit(&gs_handle);
148
149 return 1;
150 }
151
152 /* enable temperature sensor */
154 if (res != 0)
155 {
156 mpu6050_interface_debug_print("mpu6050: set temperature sensor failed.\n");
157 (void)mpu6050_deinit(&gs_handle);
158
159 return 1;
160 }
161
162 /* disable cycle wake up */
164 if (res != 0)
165 {
166 mpu6050_interface_debug_print("mpu6050: set cycle wake up failed.\n");
167 (void)mpu6050_deinit(&gs_handle);
168
169 return 1;
170 }
171
172 /* set wake up frequency 1.25Hz */
174 if (res != 0)
175 {
176 mpu6050_interface_debug_print("mpu6050: set wake up frequency failed.\n");
177 (void)mpu6050_deinit(&gs_handle);
178
179 return 1;
180 }
181
182 /* enable acc x */
184 if (res != 0)
185 {
186 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
187 (void)mpu6050_deinit(&gs_handle);
188
189 return 1;
190 }
191
192 /* enable acc y */
194 if (res != 0)
195 {
196 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
197 (void)mpu6050_deinit(&gs_handle);
198
199 return 1;
200 }
201
202 /* enable acc z */
204 if (res != 0)
205 {
206 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
207 (void)mpu6050_deinit(&gs_handle);
208
209 return 1;
210 }
211
212 /* enable gyro x */
214 if (res != 0)
215 {
216 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
217 (void)mpu6050_deinit(&gs_handle);
218
219 return 1;
220 }
221
222 /* enable gyro y */
224 if (res != 0)
225 {
226 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
227 (void)mpu6050_deinit(&gs_handle);
228
229 return 1;
230 }
231
232 /* enable gyro z */
234 if (res != 0)
235 {
236 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
237 (void)mpu6050_deinit(&gs_handle);
238
239 return 1;
240 }
241
242 /* disable gyroscope x test */
244 if (res != 0)
245 {
246 mpu6050_interface_debug_print("mpu6050: set gyroscope test failed.\n");
247 (void)mpu6050_deinit(&gs_handle);
248
249 return 1;
250 }
251
252 /* disable gyroscope y test */
254 if (res != 0)
255 {
256 mpu6050_interface_debug_print("mpu6050: set gyroscope test failed.\n");
257 (void)mpu6050_deinit(&gs_handle);
258
259 return 1;
260 }
261
262 /* disable gyroscope z test */
264 if (res != 0)
265 {
266 mpu6050_interface_debug_print("mpu6050: set gyroscope test failed.\n");
267 (void)mpu6050_deinit(&gs_handle);
268
269 return 1;
270 }
271
272 /* disable accelerometer x test */
274 if (res != 0)
275 {
276 mpu6050_interface_debug_print("mpu6050: set accelerometer test failed.\n");
277 (void)mpu6050_deinit(&gs_handle);
278
279 return 1;
280 }
281
282 /* disable accelerometer y test */
284 if (res != 0)
285 {
286 mpu6050_interface_debug_print("mpu6050: set accelerometer test failed.\n");
287 (void)mpu6050_deinit(&gs_handle);
288
289 return 1;
290 }
291
292 /* disable accelerometer z test */
294 if (res != 0)
295 {
296 mpu6050_interface_debug_print("mpu6050: set accelerometer test failed.\n");
297 (void)mpu6050_deinit(&gs_handle);
298
299 return 1;
300 }
301
302 /* disable fifo */
303 res = mpu6050_set_fifo(&gs_handle, MPU6050_BOOL_FALSE);
304 if (res != 0)
305 {
306 mpu6050_interface_debug_print("mpu6050: set fifo failed.\n");
307 (void)mpu6050_deinit(&gs_handle);
308
309 return 1;
310 }
311
312 /* disable temp fifo */
314 if (res != 0)
315 {
316 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
317 (void)mpu6050_deinit(&gs_handle);
318
319 return 1;
320 }
321
322 /* disable xg fifo */
324 if (res != 0)
325 {
326 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
327 (void)mpu6050_deinit(&gs_handle);
328
329 return 1;
330 }
331
332 /* disable yg fifo */
334 if (res != 0)
335 {
336 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
337 (void)mpu6050_deinit(&gs_handle);
338
339 return 1;
340 }
341
342 /* disable zg fifo */
344 if (res != 0)
345 {
346 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
347 (void)mpu6050_deinit(&gs_handle);
348
349 return 1;
350 }
351
352 /* disable accel fifo */
354 if (res != 0)
355 {
356 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
357 (void)mpu6050_deinit(&gs_handle);
358
359 return 1;
360 }
361
362 /* set interrupt level low */
364 if (res != 0)
365 {
366 mpu6050_interface_debug_print("mpu6050: set interrupt level failed.\n");
367 (void)mpu6050_deinit(&gs_handle);
368
369 return 1;
370 }
371
372 /* push pull */
374 if (res != 0)
375 {
376 mpu6050_interface_debug_print("mpu6050: set interrupt pin type failed.\n");
377 (void)mpu6050_deinit(&gs_handle);
378
379 return 1;
380 }
381
382 /* disable motion */
384 if (res != 0)
385 {
386 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
387 (void)mpu6050_deinit(&gs_handle);
388
389 return 1;
390 }
391
392 /* disable fifo overflow */
394 if (res != 0)
395 {
396 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
397 (void)mpu6050_deinit(&gs_handle);
398
399 return 1;
400 }
401
402 /* disable dmp interrupt */
404 if (res != 0)
405 {
406 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
407 (void)mpu6050_deinit(&gs_handle);
408
409 return 1;
410 }
411
412 /* disable i2c master */
414 if (res != 0)
415 {
416 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
417 (void)mpu6050_deinit(&gs_handle);
418
419 return 1;
420 }
421
422 /* disable data ready */
424 if (res != 0)
425 {
426 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
427 (void)mpu6050_deinit(&gs_handle);
428
429 return 1;
430 }
431
432 /* enable latch */
434 if (res != 0)
435 {
436 mpu6050_interface_debug_print("mpu6050: set interrupt latch failed.\n");
437 (void)mpu6050_deinit(&gs_handle);
438
439 return 1;
440 }
441
442 /* enable interrupt read clear */
444 if (res != 0)
445 {
446 mpu6050_interface_debug_print("mpu6050: set interrupt read clear failed.\n");
447 (void)mpu6050_deinit(&gs_handle);
448
449 return 1;
450 }
451
452 /* disable sync input */
454 if (res != 0)
455 {
456 mpu6050_interface_debug_print("mpu6050: set extern sync failed.\n");
457 (void)mpu6050_deinit(&gs_handle);
458
459 return 1;
460 }
461
462 /* disable fsync interrupt */
464 if (res != 0)
465 {
466 mpu6050_interface_debug_print("mpu6050: set fsync interrupt failed.\n");
467 (void)mpu6050_deinit(&gs_handle);
468
469 return 1;
470 }
471
472 /* fsync interrupt level low */
474 if (res != 0)
475 {
476 mpu6050_interface_debug_print("mpu6050: set fsync interrupt level failed.\n");
477 (void)mpu6050_deinit(&gs_handle);
478
479 return 1;
480 }
481
482 /* disable iic master */
484 if (res != 0)
485 {
486 mpu6050_interface_debug_print("mpu6050: set iic master failed.\n");
487 (void)mpu6050_deinit(&gs_handle);
488
489 return 1;
490 }
491
492 /* disable iic bypass */
494 if (res != 0)
495 {
496 mpu6050_interface_debug_print("mpu6050: set iic bypass failed.\n");
497 (void)mpu6050_deinit(&gs_handle);
498
499 return 1;
500 }
501
502 /* ±2g */
504 if (res != 0)
505 {
506 mpu6050_interface_debug_print("mpu6050: set accelerometer range failed.\n");
507 (void)mpu6050_deinit(&gs_handle);
508
509 return 1;
510 }
511
512 /* delay 100 ms */
514
515 mpu6050_interface_debug_print("mpu6050: set accelerometer range 2g.\n");
516 for (i = 0; i < times; i++)
517 {
518 int16_t accel_raw[1][3];
519 float accel_g[1][3];
520 int16_t gyro_raw[1][3];
521 float gyro_dps[1][3];
522 uint16_t len;
523
524 len = 1;
525 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
526 if (res != 0)
527 {
528 mpu6050_interface_debug_print("mpu6050: read failed.\n");
529 (void)mpu6050_deinit(&gs_handle);
530
531 return 1;
532 }
533 mpu6050_interface_debug_print("mpu6050: acc x is %0.2fg.\n", accel_g[0][0]);
534 mpu6050_interface_debug_print("mpu6050: acc y is %0.2fg.\n", accel_g[0][1]);
535 mpu6050_interface_debug_print("mpu6050: acc z is %0.2fg.\n", accel_g[0][2]);
536
537 /* delay 1000 ms */
539 }
540
541 /* ±4g */
543 if (res != 0)
544 {
545 mpu6050_interface_debug_print("mpu6050: set accelerometer range failed.\n");
546 (void)mpu6050_deinit(&gs_handle);
547
548 return 1;
549 }
550
551 /* delay 100 ms */
553
554 mpu6050_interface_debug_print("mpu6050: set accelerometer range 4g.\n");
555 for (i = 0; i < times; i++)
556 {
557 int16_t accel_raw[1][3];
558 float accel_g[1][3];
559 int16_t gyro_raw[1][3];
560 float gyro_dps[1][3];
561 uint16_t len;
562
563 len = 1;
564 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
565 if (res != 0)
566 {
567 mpu6050_interface_debug_print("mpu6050: read failed.\n");
568 (void)mpu6050_deinit(&gs_handle);
569
570 return 1;
571 }
572 mpu6050_interface_debug_print("mpu6050: acc x is %0.2fg.\n", accel_g[0][0]);
573 mpu6050_interface_debug_print("mpu6050: acc y is %0.2fg.\n", accel_g[0][1]);
574 mpu6050_interface_debug_print("mpu6050: acc z is %0.2fg.\n", accel_g[0][2]);
575
576 /* delay 1000 ms */
578 }
579
580 /* ±8g */
582 if (res != 0)
583 {
584 mpu6050_interface_debug_print("mpu6050: set accelerometer range failed.\n");
585 (void)mpu6050_deinit(&gs_handle);
586
587 return 1;
588 }
589
590 /* delay 100 ms */
592
593 mpu6050_interface_debug_print("mpu6050: set accelerometer range 8g.\n");
594 for (i = 0; i < times; i++)
595 {
596 int16_t accel_raw[1][3];
597 float accel_g[1][3];
598 int16_t gyro_raw[1][3];
599 float gyro_dps[1][3];
600 uint16_t len;
601
602 len = 1;
603 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
604 if (res != 0)
605 {
606 mpu6050_interface_debug_print("mpu6050: read failed.\n");
607 (void)mpu6050_deinit(&gs_handle);
608
609 return 1;
610 }
611 mpu6050_interface_debug_print("mpu6050: acc x is %0.2fg.\n", accel_g[0][0]);
612 mpu6050_interface_debug_print("mpu6050: acc y is %0.2fg.\n", accel_g[0][1]);
613 mpu6050_interface_debug_print("mpu6050: acc z is %0.2fg.\n", accel_g[0][2]);
614
615 /* delay 1000 ms */
617 }
618
619 /* ±16g */
621 if (res != 0)
622 {
623 mpu6050_interface_debug_print("mpu6050: set accelerometer range failed.\n");
624 (void)mpu6050_deinit(&gs_handle);
625
626 return 1;
627 }
628
629 /* delay 100 ms */
631
632 mpu6050_interface_debug_print("mpu6050: set accelerometer range 16g.\n");
633 for (i = 0; i < times; i++)
634 {
635 int16_t accel_raw[1][3];
636 float accel_g[1][3];
637 int16_t gyro_raw[1][3];
638 float gyro_dps[1][3];
639 uint16_t len;
640
641 len = 1;
642 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
643 if (res != 0)
644 {
645 mpu6050_interface_debug_print("mpu6050: read failed.\n");
646 (void)mpu6050_deinit(&gs_handle);
647
648 return 1;
649 }
650 mpu6050_interface_debug_print("mpu6050: acc x is %0.2fg.\n", accel_g[0][0]);
651 mpu6050_interface_debug_print("mpu6050: acc y is %0.2fg.\n", accel_g[0][1]);
652 mpu6050_interface_debug_print("mpu6050: acc z is %0.2fg.\n", accel_g[0][2]);
653
654 /* delay 1000 ms */
656 }
657
658 /* ±250dps */
660 if (res != 0)
661 {
662 mpu6050_interface_debug_print("mpu6050: set gyroscope range failed.\n");
663 (void)mpu6050_deinit(&gs_handle);
664
665 return 1;
666 }
667
668 /* delay 100 ms */
670
671 mpu6050_interface_debug_print("mpu6050: set gyroscope range 250dps.\n");
672 for (i = 0; i < times; i++)
673 {
674 int16_t accel_raw[1][3];
675 float accel_g[1][3];
676 int16_t gyro_raw[1][3];
677 float gyro_dps[1][3];
678 uint16_t len;
679
680 len = 1;
681 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
682 if (res != 0)
683 {
684 mpu6050_interface_debug_print("mpu6050: read failed.\n");
685 (void)mpu6050_deinit(&gs_handle);
686
687 return 1;
688 }
689 mpu6050_interface_debug_print("mpu6050: gyro x is %0.2fdps.\n", gyro_dps[0][0]);
690 mpu6050_interface_debug_print("mpu6050: gyro y is %0.2fdps.\n", gyro_dps[0][1]);
691 mpu6050_interface_debug_print("mpu6050: gyro z is %0.2fdps.\n", gyro_dps[0][2]);
692
693 /* delay 1000 ms */
695 }
696
697 /* ±500dps */
699 if (res != 0)
700 {
701 mpu6050_interface_debug_print("mpu6050: set gyroscope range failed.\n");
702 (void)mpu6050_deinit(&gs_handle);
703
704 return 1;
705 }
706
707 /* delay 100 ms */
709
710 mpu6050_interface_debug_print("mpu6050: set gyroscope range 500dps.\n");
711 for (i = 0; i < times; i++)
712 {
713 int16_t accel_raw[1][3];
714 float accel_g[1][3];
715 int16_t gyro_raw[1][3];
716 float gyro_dps[1][3];
717 uint16_t len;
718
719 len = 1;
720 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
721 if (res != 0)
722 {
723 mpu6050_interface_debug_print("mpu6050: read failed.\n");
724 (void)mpu6050_deinit(&gs_handle);
725
726 return 1;
727 }
728 mpu6050_interface_debug_print("mpu6050: gyro x is %0.2fdps.\n", gyro_dps[0][0]);
729 mpu6050_interface_debug_print("mpu6050: gyro y is %0.2fdps.\n", gyro_dps[0][1]);
730 mpu6050_interface_debug_print("mpu6050: gyro z is %0.2fdps.\n", gyro_dps[0][2]);
731
732 /* delay 1000 ms */
734 }
735
736 /* ±1000dps */
738 if (res != 0)
739 {
740 mpu6050_interface_debug_print("mpu6050: set gyroscope range failed.\n");
741 (void)mpu6050_deinit(&gs_handle);
742
743 return 1;
744 }
745
746 /* delay 100 ms */
748
749 mpu6050_interface_debug_print("mpu6050: set gyroscope range 1000dps.\n");
750 for (i = 0; i < times; i++)
751 {
752 int16_t accel_raw[1][3];
753 float accel_g[1][3];
754 int16_t gyro_raw[1][3];
755 float gyro_dps[1][3];
756 uint16_t len;
757
758 len = 1;
759 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
760 if (res != 0)
761 {
762 mpu6050_interface_debug_print("mpu6050: read failed.\n");
763 (void)mpu6050_deinit(&gs_handle);
764
765 return 1;
766 }
767 mpu6050_interface_debug_print("mpu6050: gyro x is %0.2fdps.\n", gyro_dps[0][0]);
768 mpu6050_interface_debug_print("mpu6050: gyro y is %0.2fdps.\n", gyro_dps[0][1]);
769 mpu6050_interface_debug_print("mpu6050: gyro z is %0.2fdps.\n", gyro_dps[0][2]);
770
771 /* delay 1000 ms */
773 }
774
775 /* ±2000dps */
777 if (res != 0)
778 {
779 mpu6050_interface_debug_print("mpu6050: set gyroscope range failed.\n");
780 (void)mpu6050_deinit(&gs_handle);
781
782 return 1;
783 }
784
785 /* delay 100 ms */
787
788 mpu6050_interface_debug_print("mpu6050: set gyroscope range 2000dps.\n");
789 for (i = 0; i < times; i++)
790 {
791 int16_t accel_raw[1][3];
792 float accel_g[1][3];
793 int16_t gyro_raw[1][3];
794 float gyro_dps[1][3];
795 uint16_t len;
796
797 len = 1;
798 res = mpu6050_read(&gs_handle, accel_raw, accel_g, gyro_raw, gyro_dps, &len);
799 if (res != 0)
800 {
801 mpu6050_interface_debug_print("mpu6050: read failed.\n");
802 (void)mpu6050_deinit(&gs_handle);
803
804 return 1;
805 }
806 mpu6050_interface_debug_print("mpu6050: gyro x is %0.2fdps.\n", gyro_dps[0][0]);
807 mpu6050_interface_debug_print("mpu6050: gyro y is %0.2fdps.\n", gyro_dps[0][1]);
808 mpu6050_interface_debug_print("mpu6050: gyro z is %0.2fdps.\n", gyro_dps[0][2]);
809
810 /* delay 1000 ms */
812 }
813
814 mpu6050_interface_debug_print("mpu6050: read temperature.\n");
815 for (i = 0; i < times; i++)
816 {
817 int16_t raw;
818 float degrees;
819
820 /* read temperature */
821 res = mpu6050_read_temperature(&gs_handle, &raw, &degrees);
822 if (res != 0)
823 {
824 mpu6050_interface_debug_print("mpu6050: read temperature failed.\n");
825 (void)mpu6050_deinit(&gs_handle);
826
827 return 1;
828 }
829 mpu6050_interface_debug_print("mpu6050: temperature %0.2fC.\n", degrees);
830
831 /* delay 1000 ms */
833 }
834
835 /* finish read test */
836 mpu6050_interface_debug_print("mpu6050: finish read test.\n");
837 (void)mpu6050_deinit(&gs_handle);
838
839 return 0;
840}
driver mpu6050 read test header file
struct mpu6050_info_s mpu6050_info_t
mpu6050 information structure definition
uint8_t mpu6050_set_wake_up_frequency(mpu6050_handle_t *handle, mpu6050_wake_up_frequency_t frequency)
set the wake up frequency
uint8_t mpu6050_init(mpu6050_handle_t *handle)
initialize the chip
uint8_t mpu6050_read_temperature(mpu6050_handle_t *handle, int16_t(*raw), float *degrees)
read the temperature
uint8_t mpu6050_set_accelerometer_range(mpu6050_handle_t *handle, mpu6050_accelerometer_range_t range)
set the accelerometer range
mpu6050_address_t
mpu6050 address enumeration definition
uint8_t mpu6050_set_standby_mode(mpu6050_handle_t *handle, mpu6050_source_t source, mpu6050_bool_t enable)
set source into standby mode
uint8_t mpu6050_set_sample_rate_divider(mpu6050_handle_t *handle, uint8_t d)
set the sample rate divider
uint8_t mpu6050_set_gyroscope_range(mpu6050_handle_t *handle, mpu6050_gyroscope_range_t range)
set the gyroscope range
uint8_t mpu6050_set_addr_pin(mpu6050_handle_t *handle, mpu6050_address_t addr_pin)
set the chip address pin
uint8_t mpu6050_set_interrupt_read_clear(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the interrupt reading clear
uint8_t mpu6050_read(mpu6050_handle_t *handle, int16_t(*accel_raw)[3], float(*accel_g)[3], int16_t(*gyro_raw)[3], float(*gyro_dps)[3], uint16_t *len)
read the data
uint8_t mpu6050_set_fifo_enable(mpu6050_handle_t *handle, mpu6050_fifo_t fifo, mpu6050_bool_t enable)
enable or disable the fifo function
uint8_t mpu6050_set_interrupt(mpu6050_handle_t *handle, mpu6050_interrupt_t type, mpu6050_bool_t enable)
enable or disable the interrupt
uint8_t mpu6050_set_iic_bypass(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the iic bypass
uint8_t mpu6050_info(mpu6050_info_t *info)
get the chip's information
uint8_t mpu6050_set_gyroscope_test(mpu6050_handle_t *handle, mpu6050_axis_t axis, mpu6050_bool_t enable)
set the gyroscope test
uint8_t mpu6050_set_cycle_wake_up(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the cycle wake up mode
uint8_t mpu6050_set_interrupt_pin_type(mpu6050_handle_t *handle, mpu6050_pin_type_t type)
set the interrupt pin type
uint8_t mpu6050_set_iic_master(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the iic master mode
uint8_t mpu6050_set_temperature_sensor(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the temperature sensor
uint8_t mpu6050_set_interrupt_latch(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the interrupt latch
uint8_t mpu6050_set_accelerometer_test(mpu6050_handle_t *handle, mpu6050_axis_t axis, mpu6050_bool_t enable)
set the accelerometer test
uint8_t mpu6050_set_extern_sync(mpu6050_handle_t *handle, mpu6050_extern_sync_t sync)
set the extern sync type
uint8_t mpu6050_set_sleep(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the sleep mode
struct mpu6050_handle_s mpu6050_handle_t
mpu6050 handle structure definition
uint8_t mpu6050_set_fifo(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable fifo
uint8_t mpu6050_set_interrupt_level(mpu6050_handle_t *handle, mpu6050_pin_level_t level)
set the interrupt level
uint8_t mpu6050_set_clock_source(mpu6050_handle_t *handle, mpu6050_clock_source_t clock_source)
set the chip clock source
uint8_t mpu6050_set_fsync_interrupt(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the fsync interrupt
uint8_t mpu6050_set_low_pass_filter(mpu6050_handle_t *handle, mpu6050_low_pass_filter_t filter)
set the low pass filter
uint8_t mpu6050_deinit(mpu6050_handle_t *handle)
close the chip
uint8_t mpu6050_set_fsync_interrupt_level(mpu6050_handle_t *handle, mpu6050_pin_level_t level)
set the fsync interrupt level
@ MPU6050_PIN_TYPE_PUSH_PULL
@ MPU6050_WAKE_UP_FREQUENCY_1P25_HZ
@ MPU6050_GYROSCOPE_RANGE_250DPS
@ MPU6050_GYROSCOPE_RANGE_2000DPS
@ MPU6050_GYROSCOPE_RANGE_1000DPS
@ MPU6050_GYROSCOPE_RANGE_500DPS
@ MPU6050_EXTERN_SYNC_INPUT_DISABLED
@ MPU6050_SOURCE_ACC_Y
@ MPU6050_SOURCE_GYRO_Y
@ MPU6050_SOURCE_ACC_Z
@ MPU6050_SOURCE_ACC_X
@ MPU6050_SOURCE_GYRO_Z
@ MPU6050_SOURCE_GYRO_X
@ MPU6050_FIFO_XG
@ MPU6050_FIFO_ACCEL
@ MPU6050_FIFO_TEMP
@ MPU6050_FIFO_ZG
@ MPU6050_FIFO_YG
@ MPU6050_CLOCK_SOURCE_PLL_X_GYRO
@ MPU6050_PIN_LEVEL_LOW
@ MPU6050_INTERRUPT_DMP
@ MPU6050_INTERRUPT_I2C_MAST
@ MPU6050_INTERRUPT_DATA_READY
@ MPU6050_INTERRUPT_FIFO_OVERFLOW
@ MPU6050_INTERRUPT_MOTION
@ MPU6050_ACCELEROMETER_RANGE_16G
@ MPU6050_ACCELEROMETER_RANGE_4G
@ MPU6050_ACCELEROMETER_RANGE_2G
@ MPU6050_ACCELEROMETER_RANGE_8G
@ MPU6050_BOOL_TRUE
@ MPU6050_BOOL_FALSE
@ MPU6050_LOW_PASS_FILTER_3
@ MPU6050_AXIS_X
@ MPU6050_AXIS_Z
@ MPU6050_AXIS_Y
uint8_t mpu6050_interface_iic_deinit(void)
interface iic bus deinit
uint8_t mpu6050_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
void mpu6050_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t mpu6050_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
uint8_t mpu6050_interface_iic_init(void)
interface iic bus init
void mpu6050_interface_receive_callback(uint8_t type)
interface receive callback
void mpu6050_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t mpu6050_read_test(mpu6050_address_t addr, uint32_t times)
read test
uint32_t driver_version
char manufacturer_name[32]