LibDriver MPU6050
Loading...
Searching...
No Matches
driver_mpu6050_dmp_pedometer_test.c
Go to the documentation of this file.
1
36
38#include <stdlib.h>
39
40static mpu6050_handle_t gs_handle;
41static int16_t gs_accel_raw[128][3];
42static float gs_accel_g[128][3];
43static int16_t gs_gyro_raw[128][3];
44static float gs_gyro_dps[128][3];
45static int32_t gs_quat[128][4];
46static float gs_pitch[128];
47static float gs_roll[128];
48static float gs_yaw[128];
49
58{
59 if (mpu6050_irq_handler(&gs_handle) != 0)
60 {
61 return 1;
62 }
63 else
64 {
65 return 0;
66 }
67}
68
78uint8_t mpu6050_dmp_pedometer_test(mpu6050_address_t addr, uint32_t times)
79{
80 uint8_t res;
81 uint32_t ms;
82 uint32_t ms_check;
83 uint32_t cnt;
84 uint32_t cnt_check;
85 uint32_t i;
86 uint16_t m;
87 uint16_t m_check;
88 int32_t gyro_offset_raw[3];
89 int32_t accel_offset_raw[3];
90 int32_t gyro_offset[3];
91 int32_t accel_offset[3];
92 mpu6050_info_t info;
93
94 /* link interface function */
103
104 /* get information */
105 res = mpu6050_info(&info);
106 if (res != 0)
107 {
108 mpu6050_interface_debug_print("mpu6050: get info failed.\n");
109
110 return 1;
111 }
112 else
113 {
114 /* print chip info */
115 mpu6050_interface_debug_print("mpu6050: chip is %s.\n", info.chip_name);
116 mpu6050_interface_debug_print("mpu6050: manufacturer is %s.\n", info.manufacturer_name);
117 mpu6050_interface_debug_print("mpu6050: interface is %s.\n", info.interface);
118 mpu6050_interface_debug_print("mpu6050: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
119 mpu6050_interface_debug_print("mpu6050: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
120 mpu6050_interface_debug_print("mpu6050: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
121 mpu6050_interface_debug_print("mpu6050: max current is %0.2fmA.\n", info.max_current_ma);
122 mpu6050_interface_debug_print("mpu6050: max temperature is %0.1fC.\n", info.temperature_max);
123 mpu6050_interface_debug_print("mpu6050: min temperature is %0.1fC.\n", info.temperature_min);
124 }
125
126 /* start dmp pedometer test */
127 mpu6050_interface_debug_print("mpu6050: start dmp pedometer test.\n");
128
129 /* set the addr pin */
130 res = mpu6050_set_addr_pin(&gs_handle, addr);
131 if (res != 0)
132 {
133 mpu6050_interface_debug_print("mpu6050: set addr pin failed.\n");
134
135 return 1;
136 }
137
138 /* init */
139 res = mpu6050_init(&gs_handle);
140 if (res != 0)
141 {
142 mpu6050_interface_debug_print("mpu6050: init failed.\n");
143
144 return 1;
145 }
146
147 /* delay 100 ms */
149
150 /* disable sleep */
151 res = mpu6050_set_sleep(&gs_handle, MPU6050_BOOL_FALSE);
152 if (res != 0)
153 {
154 mpu6050_interface_debug_print("mpu6050: set sleep failed.\n");
155 (void)mpu6050_deinit(&gs_handle);
156
157 return 1;
158 }
159
160 /* run the self test */
161 res = mpu6050_self_test(&gs_handle, gyro_offset_raw, accel_offset_raw);
162 if (res != 0)
163 {
164 mpu6050_interface_debug_print("mpu6050: self test failed.\n");
165 (void)mpu6050_deinit(&gs_handle);
166
167 return 1;
168 }
169
170 /* set pll x */
172 if (res != 0)
173 {
174 mpu6050_interface_debug_print("mpu6050: set clock source failed.\n");
175 (void)mpu6050_deinit(&gs_handle);
176
177 return 1;
178 }
179
180 /* set 50Hz */
181 res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
182 if (res != 0)
183 {
184 mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
185 (void)mpu6050_deinit(&gs_handle);
186
187 return 1;
188 }
189
190 /* ±2g */
192 if (res != 0)
193 {
194 mpu6050_interface_debug_print("mpu6050: set accelerometer range failed.\n");
195 (void)mpu6050_deinit(&gs_handle);
196
197 return 1;
198 }
199
200 /* ±2000dps */
202 if (res != 0)
203 {
204 mpu6050_interface_debug_print("mpu6050: set gyroscope range failed.\n");
205 (void)mpu6050_deinit(&gs_handle);
206
207 return 1;
208 }
209
210 /* set low pass filter 3 */
212 if (res != 0)
213 {
214 mpu6050_interface_debug_print("mpu6050: set low pass filter failed.\n");
215 (void)mpu6050_deinit(&gs_handle);
216
217 return 1;
218 }
219
220 /* enable temperature sensor */
222 if (res != 0)
223 {
224 mpu6050_interface_debug_print("mpu6050: set temperature sensor failed.\n");
225 (void)mpu6050_deinit(&gs_handle);
226
227 return 1;
228 }
229
230 /* disable cycle wake up */
232 if (res != 0)
233 {
234 mpu6050_interface_debug_print("mpu6050: set cycle wake up failed.\n");
235 (void)mpu6050_deinit(&gs_handle);
236
237 return 1;
238 }
239
240 /* set wake up frequency 1.25Hz */
242 if (res != 0)
243 {
244 mpu6050_interface_debug_print("mpu6050: set wake up frequency failed.\n");
245 (void)mpu6050_deinit(&gs_handle);
246
247 return 1;
248 }
249
250 /* enable acc x */
252 if (res != 0)
253 {
254 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
255 (void)mpu6050_deinit(&gs_handle);
256
257 return 1;
258 }
259
260 /* enable acc y */
262 if (res != 0)
263 {
264 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
265 (void)mpu6050_deinit(&gs_handle);
266
267 return 1;
268 }
269
270 /* enable acc z */
272 if (res != 0)
273 {
274 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
275 (void)mpu6050_deinit(&gs_handle);
276
277 return 1;
278 }
279
280 /* enable gyro x */
282 if (res != 0)
283 {
284 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
285 (void)mpu6050_deinit(&gs_handle);
286
287 return 1;
288 }
289
290 /* enable gyro y */
292 if (res != 0)
293 {
294 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
295 (void)mpu6050_deinit(&gs_handle);
296
297 return 1;
298 }
299
300 /* enable gyro z */
302 if (res != 0)
303 {
304 mpu6050_interface_debug_print("mpu6050: set standby mode failed.\n");
305 (void)mpu6050_deinit(&gs_handle);
306
307 return 1;
308 }
309
310 /* disable gyroscope x test */
312 if (res != 0)
313 {
314 mpu6050_interface_debug_print("mpu6050: set gyroscope test failed.\n");
315 (void)mpu6050_deinit(&gs_handle);
316
317 return 1;
318 }
319
320 /* disable gyroscope y test */
322 if (res != 0)
323 {
324 mpu6050_interface_debug_print("mpu6050: set gyroscope test failed.\n");
325 (void)mpu6050_deinit(&gs_handle);
326
327 return 1;
328 }
329
330 /* disable gyroscope z test */
332 if (res != 0)
333 {
334 mpu6050_interface_debug_print("mpu6050: set gyroscope test failed.\n");
335 (void)mpu6050_deinit(&gs_handle);
336
337 return 1;
338 }
339
340 /* disable accelerometer x test */
342 if (res != 0)
343 {
344 mpu6050_interface_debug_print("mpu6050: set accelerometer test failed.\n");
345 (void)mpu6050_deinit(&gs_handle);
346
347 return 1;
348 }
349
350 /* disable accelerometer y test */
352 if (res != 0)
353 {
354 mpu6050_interface_debug_print("mpu6050: set accelerometer test failed.\n");
355 (void)mpu6050_deinit(&gs_handle);
356
357 return 1;
358 }
359
360 /* disable accelerometer z test */
362 if (res != 0)
363 {
364 mpu6050_interface_debug_print("mpu6050: set accelerometer test failed.\n");
365 (void)mpu6050_deinit(&gs_handle);
366
367 return 1;
368 }
369
370 /* disable temp fifo */
372 if (res != 0)
373 {
374 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
375 (void)mpu6050_deinit(&gs_handle);
376
377 return 1;
378 }
379
380 /* disable xg fifo */
382 if (res != 0)
383 {
384 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
385 (void)mpu6050_deinit(&gs_handle);
386
387 return 1;
388 }
389
390 /* disable yg fifo */
392 if (res != 0)
393 {
394 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
395 (void)mpu6050_deinit(&gs_handle);
396
397 return 1;
398 }
399
400 /* disable zg fifo */
402 if (res != 0)
403 {
404 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
405 (void)mpu6050_deinit(&gs_handle);
406
407 return 1;
408 }
409
410 /* disable accel fifo */
412 if (res != 0)
413 {
414 mpu6050_interface_debug_print("mpu6050: set fifo enable failed.\n");
415 (void)mpu6050_deinit(&gs_handle);
416
417 return 1;
418 }
419
420 /* enable fifo */
421 res = mpu6050_set_fifo(&gs_handle, MPU6050_BOOL_TRUE);
422 if (res != 0)
423 {
424 mpu6050_interface_debug_print("mpu6050: set fifo failed.\n");
425 (void)mpu6050_deinit(&gs_handle);
426
427 return 1;
428 }
429
430 /* set interrupt level low */
432 if (res != 0)
433 {
434 mpu6050_interface_debug_print("mpu6050: set interrupt level failed.\n");
435 (void)mpu6050_deinit(&gs_handle);
436
437 return 1;
438 }
439
440 /* push-pull */
442 if (res != 0)
443 {
444 mpu6050_interface_debug_print("mpu6050: set interrupt pin type failed.\n");
445 (void)mpu6050_deinit(&gs_handle);
446
447 return 1;
448 }
449
450 /* disable motion */
452 if (res != 0)
453 {
454 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
455 (void)mpu6050_deinit(&gs_handle);
456
457 return 1;
458 }
459
460 /* enable fifo overflow */
462 if (res != 0)
463 {
464 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
465 (void)mpu6050_deinit(&gs_handle);
466
467 return 1;
468 }
469
470 /* disable dmp interrupt */
472 if (res != 0)
473 {
474 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
475 (void)mpu6050_deinit(&gs_handle);
476
477 return 1;
478 }
479
480 /* disable i2c master */
482 if (res != 0)
483 {
484 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
485 (void)mpu6050_deinit(&gs_handle);
486
487 return 1;
488 }
489
490 /* disable data ready */
492 if (res != 0)
493 {
494 mpu6050_interface_debug_print("mpu6050: set interrupt failed.\n");
495 (void)mpu6050_deinit(&gs_handle);
496
497 return 1;
498 }
499
500 /* enable latch */
502 if (res != 0)
503 {
504 mpu6050_interface_debug_print("mpu6050: set interrupt latch failed.\n");
505 (void)mpu6050_deinit(&gs_handle);
506
507 return 1;
508 }
509
510 /* enable interrupt read clear */
512 if (res != 0)
513 {
514 mpu6050_interface_debug_print("mpu6050: set interrupt read clear failed.\n");
515 (void)mpu6050_deinit(&gs_handle);
516
517 return 1;
518 }
519
520 /* disable sync input */
522 if (res != 0)
523 {
524 mpu6050_interface_debug_print("mpu6050: set extern sync failed.\n");
525 (void)mpu6050_deinit(&gs_handle);
526
527 return 1;
528 }
529
530 /* disable fsync interrupt */
532 if (res != 0)
533 {
534 mpu6050_interface_debug_print("mpu6050: set fsync interrupt failed.\n");
535 (void)mpu6050_deinit(&gs_handle);
536
537 return 1;
538 }
539
540 /* fsync interrupt level low */
542 if (res != 0)
543 {
544 mpu6050_interface_debug_print("mpu6050: set fsync interrupt level failed.\n");
545 (void)mpu6050_deinit(&gs_handle);
546
547 return 1;
548 }
549
550 /* disable iic master */
552 if (res != 0)
553 {
554 mpu6050_interface_debug_print("mpu6050: set iic master failed.\n");
555 (void)mpu6050_deinit(&gs_handle);
556
557 return 1;
558 }
559
560 /* disable iic bypass */
562 if (res != 0)
563 {
564 mpu6050_interface_debug_print("mpu6050: set iic bypass failed.\n");
565 (void)mpu6050_deinit(&gs_handle);
566
567 return 1;
568 }
569
570 /* load dmp firmware */
571 mpu6050_interface_debug_print("mpu6050: load dmp firmware.\n");
572
573 /* dmp load firmware */
574 res = mpu6050_dmp_load_firmware(&gs_handle);
575 if (res != 0)
576 {
577 mpu6050_interface_debug_print("mpu6050: dmp load firmware failed.\n");
578 (void)mpu6050_deinit(&gs_handle);
579
580 return 1;
581 }
582
583 /* load dmp firmware successful */
584 mpu6050_interface_debug_print("mpu6050: load dmp firmware successful .\n");
585
586 /* mpu6050_dmp_set_pedometer_walk_time/mpu6050_dmp_get_pedometer_walk_time test */
587 mpu6050_interface_debug_print("mpu6050: mpu6050_dmp_set_pedometer_walk_time/mpu6050_dmp_get_pedometer_walk_time test.\n");
588
589 ms = 200;
590 res = mpu6050_dmp_set_pedometer_walk_time(&gs_handle, ms);
591 if (res != 0)
592 {
593 mpu6050_interface_debug_print("mpu6050: dmp set pedometer walk time failed.\n");
594 (void)mpu6050_deinit(&gs_handle);
595
596 return 1;
597 }
598 mpu6050_interface_debug_print("mpu6050: dmp set pedometer walk time %d ms.\n", ms);
599 res = mpu6050_dmp_get_pedometer_walk_time(&gs_handle, &ms_check);
600 if (res != 0)
601 {
602 mpu6050_interface_debug_print("mpu6050: dmp get pedometer walk time failed.\n");
603 (void)mpu6050_deinit(&gs_handle);
604
605 return 1;
606 }
607 mpu6050_interface_debug_print("mpu6050: check pedometer walk time %s.\n", ms_check == ms ? "ok" : "error");
608
609 /* mpu6050_dmp_set_pedometer_step_count/mpu6050_dmp_get_pedometer_step_count test */
610 mpu6050_interface_debug_print("mpu6050: mpu6050_dmp_set_pedometer_step_count/mpu6050_dmp_get_pedometer_step_count test.\n");
611
612 cnt = rand() % 1000;
613 res = mpu6050_dmp_set_pedometer_step_count(&gs_handle, cnt);
614 if (res != 0)
615 {
616 mpu6050_interface_debug_print("mpu6050: dmp set pedometer step count failed.\n");
617 (void)mpu6050_deinit(&gs_handle);
618
619 return 1;
620 }
621 mpu6050_interface_debug_print("mpu6050: dmp set pedometer step count %d.\n", cnt);
622 res = mpu6050_dmp_get_pedometer_step_count(&gs_handle, &cnt_check);
623 if (res != 0)
624 {
625 mpu6050_interface_debug_print("mpu6050: dmp get pedometer step count failed.\n");
626 (void)mpu6050_deinit(&gs_handle);
627
628 return 1;
629 }
630 mpu6050_interface_debug_print("mpu6050: check pedometer step count %s.\n", cnt_check == cnt ? "ok" : "error");
631
632 /* continuous mode */
634 if (res != 0)
635 {
636 mpu6050_interface_debug_print("mpu6050: dmp set interrupt mode failed.\n");
637 (void)mpu6050_deinit(&gs_handle);
638
639 return 1;
640 }
641 mpu6050_interface_debug_print("mpu6050: dmp set gesture continuous mode.\n");
642
643 /* mpu6050_dmp_set_fifo_rate/mpu6050_dmp_get_fifo_rate test */
644 mpu6050_interface_debug_print("mpu6050: mpu6050_dmp_set_fifo_rate/mpu6050_dmp_get_fifo_rate test.\n");
645
646 m = 50;
647 res = mpu6050_dmp_set_fifo_rate(&gs_handle, m);
648 if (res != 0)
649 {
650 mpu6050_interface_debug_print("mpu6050: dmp set fifo rate failed.\n");
651 (void)mpu6050_deinit(&gs_handle);
652
653 return 1;
654 }
655 mpu6050_interface_debug_print("mpu6050: dmp set fifo rate %dHz.\n", m);
656 res = mpu6050_dmp_get_fifo_rate(&gs_handle, &m_check);
657 if (res != 0)
658 {
659 mpu6050_interface_debug_print("mpu6050: dmp get fifo rate failed.\n");
660 (void)mpu6050_deinit(&gs_handle);
661
662 return 1;
663 }
664 mpu6050_interface_debug_print("mpu6050: check fifo rate %s.\n", m_check == m ? "ok" : "error");
665
666 /* mpu6050_dmp_set_feature test */
667 mpu6050_interface_debug_print("mpu6050: mpu6050_dmp_set_feature test.\n");
668
669 /* enable feature */
672 if (res != 0)
673 {
674 mpu6050_interface_debug_print("mpu6050: dmp set feature failed.\n");
675 (void)mpu6050_deinit(&gs_handle);
676
677 return 1;
678 }
679 mpu6050_interface_debug_print("mpu6050: enable feature pedometer.\n");
680
681 /* dmp gyro accel raw offset convert */
682 res = mpu6050_dmp_gyro_accel_raw_offset_convert(&gs_handle, gyro_offset_raw, accel_offset_raw,
683 gyro_offset, accel_offset);
684 if (res != 0)
685 {
686 mpu6050_interface_debug_print("mpu6050: dmp gyro accel raw offset convert failed.\n");
687 (void)mpu6050_deinit(&gs_handle);
688
689 return 1;
690 }
691
692 /* dmp set accel bias */
693 res = mpu6050_dmp_set_accel_bias(&gs_handle, accel_offset);
694 if (res != 0)
695 {
696 mpu6050_interface_debug_print("mpu6050: dmp set accel bias failed.\n");
697 (void)mpu6050_deinit(&gs_handle);
698
699 return 1;
700 }
701
702 /* dmp set gyro bias */
703 res = mpu6050_dmp_set_gyro_bias(&gs_handle, gyro_offset);
704 if (res != 0)
705 {
706 mpu6050_interface_debug_print("mpu6050: dmp set gyro bias failed.\n");
707 (void)mpu6050_deinit(&gs_handle);
708
709 return 1;
710 }
711
712 /* enable the dmp */
713 res = mpu6050_dmp_set_enable(&gs_handle, MPU6050_BOOL_TRUE);
714 if (res != 0)
715 {
716 mpu6050_interface_debug_print("mpu6050: dmp set enable failed.\n");
717 (void)mpu6050_deinit(&gs_handle);
718
719 return 1;
720 }
721
722 /* force fifo reset */
723 res = mpu6050_force_fifo_reset(&gs_handle);
724 if (res != 0)
725 {
726 mpu6050_interface_debug_print("mpu6050: force fifo reset failed.\n");
727 (void)mpu6050_deinit(&gs_handle);
728
729 return 1;
730 }
731
732 /* delay 200 ms */
734
735 i = 0;
736 while (times != 0)
737 {
738 uint16_t l;
739
740 /* read the data */
741 l = 128;
742 res = mpu6050_dmp_read(&gs_handle,
743 gs_accel_raw, gs_accel_g,
744 gs_gyro_raw, gs_gyro_dps,
745 gs_quat,
746 gs_pitch, gs_roll, gs_yaw,
747 &l
748 );
749 if (res == 0)
750 {
751 i++;
752 if (i > 5)
753 {
754 i = 0;
755
756 /* get the pedometer step count */
757 res = mpu6050_dmp_get_pedometer_step_count(&gs_handle, &cnt);
758 if (res != 0)
759 {
760 mpu6050_interface_debug_print("mpu6050: dmp get pedometer step count failed.\n");
761 (void)mpu6050_deinit(&gs_handle);
762
763 return 1;
764 }
765
766 /* check the cnt */
767 if (cnt != cnt_check)
768 {
769 mpu6050_interface_debug_print("mpu6050: pedometer step count is %d.\n", cnt);
770 cnt_check = cnt;
771 times--;
772 }
773 }
774 }
775
776 /* delay 200 ms */
778 }
779
780 /* finish dmp pedometer test */
781 mpu6050_interface_debug_print("mpu6050: finish dmp pedometer test.\n");
782 (void)mpu6050_deinit(&gs_handle);
783
784 return 0;
785}
driver mpu6050 dmp pedometer 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_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_self_test(mpu6050_handle_t *handle, int32_t gyro_offset_raw[3], int32_t accel_offset_raw[3])
run the self test
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_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_irq_handler(mpu6050_handle_t *handle)
irq handler
uint8_t mpu6050_set_iic_master(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the iic master mode
uint8_t mpu6050_force_fifo_reset(mpu6050_handle_t *handle)
force reset the fifo
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_2000DPS
@ 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_2G
@ MPU6050_BOOL_TRUE
@ MPU6050_BOOL_FALSE
@ MPU6050_LOW_PASS_FILTER_3
@ MPU6050_AXIS_X
@ MPU6050_AXIS_Z
@ MPU6050_AXIS_Y
uint8_t mpu6050_dmp_set_gyro_bias(mpu6050_handle_t *handle, int32_t bias[3])
dmp set the gyro bias
uint8_t mpu6050_dmp_set_enable(mpu6050_handle_t *handle, mpu6050_bool_t enable)
enable or disable the dmp
uint8_t mpu6050_dmp_load_firmware(mpu6050_handle_t *handle)
load the dmp firmware
uint8_t mpu6050_dmp_read(mpu6050_handle_t *handle, int16_t(*accel_raw)[3], float(*accel_g)[3], int16_t(*gyro_raw)[3], float(*gyro_dps)[3], int32_t(*quat)[4], float *pitch, float *roll, float *yaw, uint16_t *l)
dmp read the data
uint8_t mpu6050_dmp_set_accel_bias(mpu6050_handle_t *handle, int32_t bias[3])
dmp set the accel bias
uint8_t mpu6050_dmp_get_pedometer_step_count(mpu6050_handle_t *handle, uint32_t *count)
dmp get the pedometer step count
uint8_t mpu6050_dmp_set_pedometer_step_count(mpu6050_handle_t *handle, uint32_t count)
dmp set the pedometer step count
uint8_t mpu6050_dmp_set_feature(mpu6050_handle_t *handle, uint16_t mask)
dmp enable or disable the dmp feature
uint8_t mpu6050_dmp_gyro_accel_raw_offset_convert(mpu6050_handle_t *handle, int32_t gyro_offset_raw[3], int32_t accel_offset_raw[3], int32_t gyro_offset[3], int32_t accel_offset[3])
dmp gyro accel raw offset convert
uint8_t mpu6050_dmp_get_pedometer_walk_time(mpu6050_handle_t *handle, uint32_t *ms)
dmp get the pedometer walk time
uint8_t mpu6050_dmp_set_fifo_rate(mpu6050_handle_t *handle, uint16_t rate)
dmp set the fifo rate
uint8_t mpu6050_dmp_get_fifo_rate(mpu6050_handle_t *handle, uint16_t *rate)
dmp get the fifo rate
uint8_t mpu6050_dmp_set_interrupt_mode(mpu6050_handle_t *handle, mpu6050_dmp_interrupt_mode_t mode)
dmp set the interrupt mode
uint8_t mpu6050_dmp_set_pedometer_walk_time(mpu6050_handle_t *handle, uint32_t ms)
dmp set the pedometer walk time
@ MPU6050_DMP_FEATURE_PEDOMETER
@ MPU6050_DMP_FEATURE_6X_QUAT
@ MPU6050_DMP_FEATURE_GYRO_CAL
@ MPU6050_DMP_INTERRUPT_MODE_CONTINUOUS
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_dmp_pedometer_test(mpu6050_address_t addr, uint32_t times)
dmp pedometer test
uint8_t mpu6050_dmp_pedometer_test_irq_handler(void)
dmp pedometer test irq
uint32_t driver_version
char manufacturer_name[32]