| LibDriver MPU9250 1.0.0 MPU9250 full function driver

driver_mpu9250_basic.c
Go to the documentation of this file.
1
37 #include "driver_mpu9250_basic.h"
38
39 static mpu9250_handle_t gs_handle;
50 uint8_t mpu9250_basic_init(mpu9250_interface_t interface, mpu9250_address_t addr_pin)
51 {
52 uint8_t res;
53
54 /* link interface function */
55 DRIVER_MPU9250_LINK_INIT(&gs_handle, mpu9250_handle_t);
56 DRIVER_MPU9250_LINK_IIC_INIT(&gs_handle, mpu9250_interface_iic_init);
57 DRIVER_MPU9250_LINK_IIC_DEINIT(&gs_handle, mpu9250_interface_iic_deinit);
58 DRIVER_MPU9250_LINK_IIC_READ(&gs_handle, mpu9250_interface_iic_read);
59 DRIVER_MPU9250_LINK_IIC_WRITE(&gs_handle, mpu9250_interface_iic_write);
60 DRIVER_MPU9250_LINK_SPI_INIT(&gs_handle, mpu9250_interface_spi_init);
61 DRIVER_MPU9250_LINK_SPI_DEINIT(&gs_handle, mpu9250_interface_spi_deinit);
62 DRIVER_MPU9250_LINK_SPI_READ(&gs_handle, mpu9250_interface_spi_read);
63 DRIVER_MPU9250_LINK_SPI_WRITE(&gs_handle, mpu9250_interface_spi_write);
64 DRIVER_MPU9250_LINK_DELAY_MS(&gs_handle, mpu9250_interface_delay_ms);
65 DRIVER_MPU9250_LINK_DEBUG_PRINT(&gs_handle, mpu9250_interface_debug_print);
66 DRIVER_MPU9250_LINK_RECEIVE_CALLBACK(&gs_handle, mpu9250_interface_receive_callback);
67
68 /* set the interface */
69 res = mpu9250_set_interface(&gs_handle, interface);
70 if (res != 0)
71 {
72 mpu9250_interface_debug_print("mpu9250: set interface failed.\n");
73
74 return 1;
75 }
76
77 /* set the addr pin */
78 res = mpu9250_set_addr_pin(&gs_handle, addr_pin);
79 if (res != 0)
80 {
81 mpu9250_interface_debug_print("mpu9250: set addr pin failed.\n");
82
83 return 1;
84 }
85
86 /* init */
87 res = mpu9250_init(&gs_handle);
88 if (res != 0)
89 {
90 mpu9250_interface_debug_print("mpu9250: init failed.\n");
91
92 return 1;
93 }
94
95 /* delay 100 ms */
96 mpu9250_interface_delay_ms(100);
97
98 /* disable sleep */
99 res = mpu9250_set_sleep(&gs_handle, MPU9250_BOOL_FALSE);
100 if (res != 0)
101 {
102 mpu9250_interface_debug_print("mpu9250: set sleep failed.\n");
103 (void)mpu9250_deinit(&gs_handle);
104
105 return 1;
106 }
107
108 /* if spi interface, disable iic interface */
109 if (interface == MPU9250_INTERFACE_SPI)
110 {
111 /* disable iic */
112 res = mpu9250_set_disable_iic_slave(&gs_handle, MPU9250_BOOL_TRUE);
113 if (res != 0)
114 {
115 mpu9250_interface_debug_print("mpu9250: set disable iic slave failed.\n");
116 (void)mpu9250_deinit(&gs_handle);
117
118 return 1;
119 }
120 }
121
122 /* set fifo 1024kb */
123 res = mpu9250_set_fifo_1024kb(&gs_handle);
124 if (res != 0)
125 {
126 mpu9250_interface_debug_print("mpu9250: set fifo 1024kb failed.\n");
127 (void)mpu9250_deinit(&gs_handle);
128
129 return 1;
130 }
131
132 /* set the default clock source */
133 res = mpu9250_set_clock_source(&gs_handle, MPU9250_BASIC_DEFAULT_CLOCK_SOURCE);
134 if (res != 0)
135 {
136 mpu9250_interface_debug_print("mpu9250: set clock source failed.\n");
137 (void)mpu9250_deinit(&gs_handle);
138
139 return 1;
140 }
141
142 /* set the default rate */
143 res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / MPU9250_BASIC_DEFAULT_RATE) - 1);
144 if (res != 0)
145 {
146 mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
147 (void)mpu9250_deinit(&gs_handle);
148
149 return 1;
150 }
151
152 /* enable temperature sensor */
153 res = mpu9250_set_ptat(&gs_handle, MPU9250_BOOL_TRUE);
154 if (res != 0)
155 {
156 mpu9250_interface_debug_print("mpu9250: set ptat failed.\n");
157 (void)mpu9250_deinit(&gs_handle);
158
159 return 1;
160 }
161
162 /* set the default cycle wake up */
163 res = mpu9250_set_cycle_wake_up(&gs_handle, MPU9250_BASIC_DEFAULT_CYCLE_WAKE_UP);
164 if (res != 0)
165 {
166 mpu9250_interface_debug_print("mpu9250: set cycle wake up failed.\n");
167 (void)mpu9250_deinit(&gs_handle);
168
169 return 1;
170 }
171
172 /* enable acc x */
173 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_X, MPU9250_BOOL_FALSE);
174 if (res != 0)
175 {
176 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
177 (void)mpu9250_deinit(&gs_handle);
178
179 return 1;
180 }
181
182 /* enable acc y */
183 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Y, MPU9250_BOOL_FALSE);
184 if (res != 0)
185 {
186 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
187 (void)mpu9250_deinit(&gs_handle);
188
189 return 1;
190 }
191
192 /* enable acc z */
193 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Z, MPU9250_BOOL_FALSE);
194 if (res != 0)
195 {
196 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
197 (void)mpu9250_deinit(&gs_handle);
198
199 return 1;
200 }
201
202 /* enable gyro x */
203 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_X, MPU9250_BOOL_FALSE);
204 if (res != 0)
205 {
206 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
207 (void)mpu9250_deinit(&gs_handle);
208
209 return 1;
210 }
211
212 /* enable gyro y */
213 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Y, MPU9250_BOOL_FALSE);
214 if (res != 0)
215 {
216 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
217 (void)mpu9250_deinit(&gs_handle);
218
219 return 1;
220 }
221
222 /* enable gyro z */
223 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Z, MPU9250_BOOL_FALSE);
224 if (res != 0)
225 {
226 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
227 (void)mpu9250_deinit(&gs_handle);
228
229 return 1;
230 }
231
232 /* disable gyroscope x test */
233 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
234 if (res != 0)
235 {
236 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
237 (void)mpu9250_deinit(&gs_handle);
238
239 return 1;
240 }
241
242 /* disable gyroscope y test */
243 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
244 if (res != 0)
245 {
246 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
247 (void)mpu9250_deinit(&gs_handle);
248
249 return 1;
250 }
251
252 /* disable gyroscope z test */
253 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
254 if (res != 0)
255 {
256 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
257 (void)mpu9250_deinit(&gs_handle);
258
259 return 1;
260 }
261
262 /* disable accelerometer x test */
263 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
264 if (res != 0)
265 {
266 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
267 (void)mpu9250_deinit(&gs_handle);
268
269 return 1;
270 }
271
272 /* disable accelerometer y test */
273 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
274 if (res != 0)
275 {
276 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
277 (void)mpu9250_deinit(&gs_handle);
278
279 return 1;
280 }
281
282 /* disable accelerometer z test */
283 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
284 if (res != 0)
285 {
286 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
287 (void)mpu9250_deinit(&gs_handle);
288
289 return 1;
290 }
291
292 /* disable fifo */
293 res = mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_FALSE);
294 if (res != 0)
295 {
296 mpu9250_interface_debug_print("mpu9250: set fifo failed.\n");
297 (void)mpu9250_deinit(&gs_handle);
298
299 return 1;
300 }
301
302 /* disable temp fifo */
303 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_TEMP, MPU9250_BOOL_FALSE);
304 if (res != 0)
305 {
306 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
307 (void)mpu9250_deinit(&gs_handle);
308
309 return 1;
310 }
311
312 /* disable xg fifo */
313 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_XG, MPU9250_BOOL_FALSE);
314 if (res != 0)
315 {
316 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
317 (void)mpu9250_deinit(&gs_handle);
318
319 return 1;
320 }
321
322 /* disable yg fifo */
323 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_YG, MPU9250_BOOL_FALSE);
324 if (res != 0)
325 {
326 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
327 (void)mpu9250_deinit(&gs_handle);
328
329 return 1;
330 }
331
332 /* disable zg fifo */
333 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ZG, MPU9250_BOOL_FALSE);
334 if (res != 0)
335 {
336 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
337 (void)mpu9250_deinit(&gs_handle);
338
339 return 1;
340 }
341
342 /* disable accel fifo */
343 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ACCEL, MPU9250_BOOL_FALSE);
344 if (res != 0)
345 {
346 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
347 (void)mpu9250_deinit(&gs_handle);
348
349 return 1;
350 }
351
352 /* set the default interrupt level */
353 res = mpu9250_set_interrupt_level(&gs_handle, MPU9250_BASIC_DEFAULT_INTERRUPT_PIN_LEVEL);
354 if (res != 0)
355 {
356 mpu9250_interface_debug_print("mpu9250: set interrupt level failed.\n");
357 (void)mpu9250_deinit(&gs_handle);
358
359 return 1;
360 }
361
362 /* set the default pin type */
363 res = mpu9250_set_interrupt_pin_type(&gs_handle, MPU9250_BASIC_DEFAULT_INTERRUPT_PIN_TYPE);
364 if (res != 0)
365 {
366 mpu9250_interface_debug_print("mpu9250: set interrupt pin type failed.\n");
367 (void)mpu9250_deinit(&gs_handle);
368
369 return 1;
370 }
371
372 /* set the default motion interrupt */
373 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_MOTION, MPU9250_BASIC_DEFAULT_INTERRUPT_MOTION);
374 if (res != 0)
375 {
376 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
377 (void)mpu9250_deinit(&gs_handle);
378
379 return 1;
380 }
381
382 /* set the default fifo overflow interrupt */
383 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FIFO_OVERFLOW, MPU9250_BASIC_DEFAULT_INTERRUPT_FIFO_OVERFLOW);
384 if (res != 0)
385 {
386 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
387 (void)mpu9250_deinit(&gs_handle);
388
389 return 1;
390 }
391
392 /* set the default dmp interrupt */
393 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DMP, MPU9250_BASIC_DEFAULT_INTERRUPT_DMP);
394 if (res != 0)
395 {
396 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
397 (void)mpu9250_deinit(&gs_handle);
398
399 return 1;
400 }
401
402 /* set the default fsync int interrupt */
403 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FSYNC_INT, MPU9250_BASIC_DEFAULT_INTERRUPT_FSYNC_INT);
404 if (res != 0)
405 {
406 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
407 (void)mpu9250_deinit(&gs_handle);
408
409 return 1;
410 }
411
412 /* set the default data ready interrupt */
413 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DATA_READY, MPU9250_BASIC_DEFAULT_INTERRUPT_DATA_READY);
414 if (res != 0)
415 {
416 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
417 (void)mpu9250_deinit(&gs_handle);
418
419 return 1;
420 }
421
422 /* set the default interrupt latch */
423 res = mpu9250_set_interrupt_latch(&gs_handle, MPU9250_BASIC_DEFAULT_INTERRUPT_LATCH);
424 if (res != 0)
425 {
426 mpu9250_interface_debug_print("mpu9250: set interrupt latch failed.\n");
427 (void)mpu9250_deinit(&gs_handle);
428
429 return 1;
430 }
431
432 /* set the default interrupt read clear */
433 res = mpu9250_set_interrupt_read_clear(&gs_handle, MPU9250_BASIC_DEFAULT_INTERRUPT_READ_CLEAR);
434 if (res != 0)
435 {
436 mpu9250_interface_debug_print("mpu9250: set interrupt read clear failed.\n");
437 (void)mpu9250_deinit(&gs_handle);
438
439 return 1;
440 }
441
442 /* set the extern sync */
443 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_BASIC_DEFAULT_EXTERN_SYNC);
444 if (res != 0)
445 {
446 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
447 (void)mpu9250_deinit(&gs_handle);
448
449 return 1;
450 }
451
452 /* set the default fsync interrupt */
453 res = mpu9250_set_fsync_interrupt(&gs_handle, MPU9250_BASIC_DEFAULT_FSYNC_INTERRUPT);
454 if (res != 0)
455 {
456 mpu9250_interface_debug_print("mpu9250: set fsync interrupt failed.\n");
457 (void)mpu9250_deinit(&gs_handle);
458
459 return 1;
460 }
461
462 /* set the default fsync interrupt level */
463 res = mpu9250_set_fsync_interrupt_level(&gs_handle, MPU9250_BASIC_DEFAULT_FSYNC_INTERRUPT_LEVEL);
464 if (res != 0)
465 {
466 mpu9250_interface_debug_print("mpu9250: set fsync interrupt level failed.\n");
467 (void)mpu9250_deinit(&gs_handle);
468
469 return 1;
470 }
471
472 /* set the default iic master */
473 res = mpu9250_set_iic_master(&gs_handle, MPU9250_BASIC_DEFAULT_IIC_MASTER);
474 if (res != 0)
475 {
476 mpu9250_interface_debug_print("mpu9250: set iic master failed.\n");
477 (void)mpu9250_deinit(&gs_handle);
478
479 return 1;
480 }
481
482 /* set the default iic bypass */
483 res = mpu9250_set_iic_bypass(&gs_handle, MPU9250_BASIC_DEFAULT_IIC_BYPASS);
484 if (res != 0)
485 {
486 mpu9250_interface_debug_print("mpu9250: set iic bypass failed.\n");
487 (void)mpu9250_deinit(&gs_handle);
488
489 return 1;
490 }
491
492 /* set the default accelerometer range */
493 res = mpu9250_set_accelerometer_range(&gs_handle, MPU9250_BASIC_DEFAULT_ACCELEROMETER_RANGE);
494 if (res != 0)
495 {
496 mpu9250_interface_debug_print("mpu9250: set accelerometer range failed.\n");
497 (void)mpu9250_deinit(&gs_handle);
498
499 return 1;
500 }
501
502 /* set the default gyroscope range */
503 res = mpu9250_set_gyroscope_range(&gs_handle, MPU9250_BASIC_DEFAULT_GYROSCOPE_RANGE);
504 if (res != 0)
505 {
506 mpu9250_interface_debug_print("mpu9250: set gyroscope range failed.\n");
507 (void)mpu9250_deinit(&gs_handle);
508
509 return 1;
510 }
511
512 /* set the default gyro standby */
513 res = mpu9250_set_gyro_standby(&gs_handle, MPU9250_BASIC_DEFAULT_GYROSCOPE_STANDBY);
514 if (res != 0)
515 {
516 mpu9250_interface_debug_print("mpu9250: set gyro standby failed.\n");
517 (void)mpu9250_deinit(&gs_handle);
518
519 return 1;
520 }
521
522 /* set the default fifo mode */
523 res = mpu9250_set_fifo_mode(&gs_handle, MPU9250_BASIC_DEFAULT_FIFO_MODE);
524 if (res != 0)
525 {
526 mpu9250_interface_debug_print("mpu9250: set fifo mode failed.\n");
527 (void)mpu9250_deinit(&gs_handle);
528
529 return 1;
530 }
531
532 /* set the default gyroscope choice */
533 res = mpu9250_set_gyroscope_choice(&gs_handle, MPU9250_BASIC_DEFAULT_GYROSCOPE_CHOICE);
534 if (res != 0)
535 {
536 mpu9250_interface_debug_print("mpu9250: set gyroscope choice failed.\n");
537 (void)mpu9250_deinit(&gs_handle);
538
539 return 1;
540 }
541
542 /* set the default low pass filter */
543 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_BASIC_DEFAULT_LOW_PASS_FILTER);
544 if (res != 0)
545 {
546 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
547 (void)mpu9250_deinit(&gs_handle);
548
549 return 1;
550 }
551
552 /* set the default accelerometer choice */
553 res = mpu9250_set_accelerometer_choice(&gs_handle, MPU9250_BASIC_DEFAULT_ACCELEROMETER_CHOICE);
554 if (res != 0)
555 {
556 mpu9250_interface_debug_print("mpu9250: set accelerometer choice failed.\n");
557 (void)mpu9250_deinit(&gs_handle);
558
559 return 1;
560 }
561
562 /* set the default accelerometer low pass filter */
563 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_BASIC_DEFAULT_ACCELEROMETER_LOW_PASS_FILTER);
564 if (res != 0)
565 {
566 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
567 (void)mpu9250_deinit(&gs_handle);
568
569 return 1;
570 }
571
572 /* set the default low power accel output rate */
573 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_BASIC_DEFAULT_LOW_POWER_ACCEL_OUTPUT_RATE);
574 if (res != 0)
575 {
576 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
577 (void)mpu9250_deinit(&gs_handle);
578
579 return 1;
580 }
581
582 /* set the default wake on motion */
583 res = mpu9250_set_wake_on_motion(&gs_handle, MPU9250_BASIC_DEFAULT_WAKE_ON_MOTION);
584 if (res != 0)
585 {
586 mpu9250_interface_debug_print("mpu9250: set wake on motion failed.\n");
587 (void)mpu9250_deinit(&gs_handle);
588
589 return 1;
590 }
591
592 /* set the default accel compare with previous sample */
593 res = mpu9250_set_accel_compare_with_previous_sample(&gs_handle, MPU9250_BASIC_DEFAULT_ACCELEROMETER_COMPARE);
594 if (res != 0)
595 {
596 mpu9250_interface_debug_print("mpu9250: set accel compare with previous sample failed.\n");
597 (void)mpu9250_deinit(&gs_handle);
598
599 return 1;
600 }
601
602 /* if iic interface */
603 if (interface == MPU9250_INTERFACE_IIC)
604 {
605 /* mag init */
606 res = mpu9250_mag_init(&gs_handle);
607 if (res != 0)
608 {
609 mpu9250_interface_debug_print("mpu9250: mag init failed.\n");
610 (void)mpu9250_deinit(&gs_handle);
611
612 return 1;
613 }
614
615 /* set the mag default mode */
616 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_BASIC_DEFAULT_MAGNETOMETER_MODE);
617 if (res != 0)
618 {
619 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
620 (void)mpu9250_mag_deinit(&gs_handle);
621 (void)mpu9250_deinit(&gs_handle);
622
623 return 1;
624 }
625
626 /* set the mag default bits */
627 res = mpu9250_mag_set_bits(&gs_handle, MPU9250_BASIC_DEFAULT_MAGNETOMETER_BITS);
628 if (res != 0)
629 {
630 mpu9250_interface_debug_print("mpu9250: mag set bits failed.\n");
631 (void)mpu9250_mag_deinit(&gs_handle);
632 (void)mpu9250_deinit(&gs_handle);
633
634 return 1;
635 }
636 }
637
638 return 0;
639 }
640
649 uint8_t mpu9250_basic_read_temperature(float *degrees)
650 {
651 int16_t raw;
652
653 /* read temperature */
654 if (mpu9250_read_temperature(&gs_handle, &raw, degrees) != 0)
655 {
656 return 1;
657 }
658
659 return 0;
660 }
661
672 uint8_t mpu9250_basic_read(float g[3], float dps[3], float ut[3])
673 {
674 uint16_t len;
675 int16_t accel_raw[3];
676 int16_t gyro_raw[3];
677 int16_t mag_raw[3];
678 float accel[3];
679 float gyro[3];
680 float mag[3];
681
682 /* set 1 */
683 len = 1;
684
685 /* read data */
686 if (mpu9250_read(&gs_handle,
687 (int16_t (*)[3])&accel_raw, (float (*)[3])&accel,
688 (int16_t (*)[3])&gyro_raw, (float (*)[3])&gyro,
689 (int16_t (*)[3])&mag_raw, (float (*)[3])&mag,
690 &len) != 0
691 )
692 {
693 return 1;
694 }
695
696 /* copy the data */
697 g[0] = accel[0];
698 g[1] = accel[1];
699 g[2] = accel[2];
700 dps[0] = gyro[0];
701 dps[1] = gyro[1];
702 dps[2] = gyro[2];
703 ut[0] = mag[0];
704 ut[1] = mag[1];
705 ut[2] = mag[2];
706
707 return 0;
708 }
709
717 uint8_t mpu9250_basic_deinit(void)
718 {
719 mpu9250_interface_t interface;
720
721 /* get the interface */
722 if (mpu9250_get_interface(&gs_handle, &interface) != 0)
723 {
724 return 1;
725 }
726
727 /* if interface iic*/
728 if (interface == MPU9250_INTERFACE_IIC)
729 {
730 /* mag deinit */
731 if (mpu9250_mag_deinit(&gs_handle) != 0)
732 {
733 return 1;
734 }
735 }
736
737 /* deinit */
738 if (mpu9250_deinit(&gs_handle) != 0)
739 {
740 return 1;
741 }
742
743 return 0;
744 }
driver_mpu9250_basic.h
driver mpu9250 basic 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_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_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_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_read_temperature
uint8_t mpu9250_read_temperature(mpu9250_handle_t *handle, int16_t(*raw), float *degrees)
read the temperature
Definition: driver_mpu9250.c:4631
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_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_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_BASIC_DEFAULT_INTERRUPT_LATCH
#define MPU9250_BASIC_DEFAULT_INTERRUPT_LATCH
Definition: driver_mpu9250_basic.h:69
mpu9250_basic_deinit
uint8_t mpu9250_basic_deinit(void)
basic example deinit
Definition: driver_mpu9250_basic.c:717
MPU9250_BASIC_DEFAULT_CYCLE_WAKE_UP
#define MPU9250_BASIC_DEFAULT_CYCLE_WAKE_UP
Definition: driver_mpu9250_basic.h:59
MPU9250_BASIC_DEFAULT_LOW_POWER_ACCEL_OUTPUT_RATE
#define MPU9250_BASIC_DEFAULT_LOW_POWER_ACCEL_OUTPUT_RATE
Definition: driver_mpu9250_basic.h:81
MPU9250_BASIC_DEFAULT_FSYNC_INTERRUPT
#define MPU9250_BASIC_DEFAULT_FSYNC_INTERRUPT
Definition: driver_mpu9250_basic.h:72
MPU9250_BASIC_DEFAULT_ACCELEROMETER_COMPARE
#define MPU9250_BASIC_DEFAULT_ACCELEROMETER_COMPARE
Definition: driver_mpu9250_basic.h:83
MPU9250_BASIC_DEFAULT_GYROSCOPE_RANGE
#define MPU9250_BASIC_DEFAULT_GYROSCOPE_RANGE
Definition: driver_mpu9250_basic.h:63
MPU9250_BASIC_DEFAULT_ACCELEROMETER_CHOICE
#define MPU9250_BASIC_DEFAULT_ACCELEROMETER_CHOICE
Definition: driver_mpu9250_basic.h:79
MPU9250_BASIC_DEFAULT_ACCELEROMETER_RANGE
#define MPU9250_BASIC_DEFAULT_ACCELEROMETER_RANGE
Definition: driver_mpu9250_basic.h:62
MPU9250_BASIC_DEFAULT_GYROSCOPE_CHOICE
#define MPU9250_BASIC_DEFAULT_GYROSCOPE_CHOICE
Definition: driver_mpu9250_basic.h:78
MPU9250_BASIC_DEFAULT_INTERRUPT_READ_CLEAR
#define MPU9250_BASIC_DEFAULT_INTERRUPT_READ_CLEAR
Definition: driver_mpu9250_basic.h:70
mpu9250_basic_init
uint8_t mpu9250_basic_init(mpu9250_interface_t interface, mpu9250_address_t addr_pin)
basic example init
Definition: driver_mpu9250_basic.c:50
MPU9250_BASIC_DEFAULT_CLOCK_SOURCE
#define MPU9250_BASIC_DEFAULT_CLOCK_SOURCE
mpu9250 basic example default definition
Definition: driver_mpu9250_basic.h:56
MPU9250_BASIC_DEFAULT_INTERRUPT_PIN_LEVEL
#define MPU9250_BASIC_DEFAULT_INTERRUPT_PIN_LEVEL
Definition: driver_mpu9250_basic.h:60
MPU9250_BASIC_DEFAULT_WAKE_ON_MOTION
#define MPU9250_BASIC_DEFAULT_WAKE_ON_MOTION
Definition: driver_mpu9250_basic.h:82
mpu9250_basic_read_temperature
uint8_t mpu9250_basic_read_temperature(float *degrees)
basic example read temperature
Definition: driver_mpu9250_basic.c:649
MPU9250_BASIC_DEFAULT_MAGNETOMETER_MODE
#define MPU9250_BASIC_DEFAULT_MAGNETOMETER_MODE
Definition: driver_mpu9250_basic.h:84
MPU9250_BASIC_DEFAULT_LOW_PASS_FILTER
#define MPU9250_BASIC_DEFAULT_LOW_PASS_FILTER
Definition: driver_mpu9250_basic.h:58
MPU9250_BASIC_DEFAULT_INTERRUPT_DATA_READY
#define MPU9250_BASIC_DEFAULT_INTERRUPT_DATA_READY
Definition: driver_mpu9250_basic.h:68
MPU9250_BASIC_DEFAULT_RATE
#define MPU9250_BASIC_DEFAULT_RATE
Definition: driver_mpu9250_basic.h:57
MPU9250_BASIC_DEFAULT_INTERRUPT_PIN_TYPE
#define MPU9250_BASIC_DEFAULT_INTERRUPT_PIN_TYPE
Definition: driver_mpu9250_basic.h:61
MPU9250_BASIC_DEFAULT_INTERRUPT_DMP
#define MPU9250_BASIC_DEFAULT_INTERRUPT_DMP
Definition: driver_mpu9250_basic.h:66
MPU9250_BASIC_DEFAULT_MAGNETOMETER_BITS
#define MPU9250_BASIC_DEFAULT_MAGNETOMETER_BITS
Definition: driver_mpu9250_basic.h:85
MPU9250_BASIC_DEFAULT_ACCELEROMETER_LOW_PASS_FILTER
#define MPU9250_BASIC_DEFAULT_ACCELEROMETER_LOW_PASS_FILTER
Definition: driver_mpu9250_basic.h:80
MPU9250_BASIC_DEFAULT_INTERRUPT_FIFO_OVERFLOW
#define MPU9250_BASIC_DEFAULT_INTERRUPT_FIFO_OVERFLOW
Definition: driver_mpu9250_basic.h:65
MPU9250_BASIC_DEFAULT_FSYNC_INTERRUPT_LEVEL
#define MPU9250_BASIC_DEFAULT_FSYNC_INTERRUPT_LEVEL
Definition: driver_mpu9250_basic.h:73
MPU9250_BASIC_DEFAULT_IIC_BYPASS
#define MPU9250_BASIC_DEFAULT_IIC_BYPASS
Definition: driver_mpu9250_basic.h:75
MPU9250_BASIC_DEFAULT_INTERRUPT_FSYNC_INT
#define MPU9250_BASIC_DEFAULT_INTERRUPT_FSYNC_INT
Definition: driver_mpu9250_basic.h:67
MPU9250_BASIC_DEFAULT_FIFO_MODE
#define MPU9250_BASIC_DEFAULT_FIFO_MODE
Definition: driver_mpu9250_basic.h:77
MPU9250_BASIC_DEFAULT_IIC_MASTER
#define MPU9250_BASIC_DEFAULT_IIC_MASTER
Definition: driver_mpu9250_basic.h:74
MPU9250_BASIC_DEFAULT_GYROSCOPE_STANDBY
#define MPU9250_BASIC_DEFAULT_GYROSCOPE_STANDBY
Definition: driver_mpu9250_basic.h:76
mpu9250_basic_read
uint8_t mpu9250_basic_read(float g[3], float dps[3], float ut[3])
basic example read
Definition: driver_mpu9250_basic.c:672
MPU9250_BASIC_DEFAULT_INTERRUPT_MOTION
#define MPU9250_BASIC_DEFAULT_INTERRUPT_MOTION
Definition: driver_mpu9250_basic.h:64
MPU9250_BASIC_DEFAULT_EXTERN_SYNC
#define MPU9250_BASIC_DEFAULT_EXTERN_SYNC
Definition: driver_mpu9250_basic.h:71
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_handle_s
mpu9250 handle structure definition
Definition: driver_mpu9250.h:502