| LibDriver MPU9250 1.0.0 MPU9250 full function driver

driver_mpu9250_register_test.c
Go to the documentation of this file.
1
37 #include "driver_mpu9250_register_test.h"
38 #include <stdlib.h>
39
40 static mpu9250_handle_t gs_handle;
51 uint8_t mpu9250_register_test(mpu9250_interface_t interface, mpu9250_address_t addr)
52 {
53 uint8_t res;
54 uint8_t reg;
55 uint8_t i;
56 uint8_t div_in;
57 uint8_t div_check;
58 uint8_t data[8];
59 uint8_t data_check[8];
60 uint16_t cnt;
61 uint8_t status;
62 uint8_t test;
63 uint8_t test_check;
64 int16_t offset;
65 int16_t offset_check;
66 float test_f;
67 float test_check_f;
68 mpu9250_info_t info;
69 mpu9250_address_t addr_pin;
70 mpu9250_interface_t interface_check;
71 mpu9250_bool_t enable;
72 mpu9250_clock_source_t clock_source;
73 mpu9250_extern_sync_t sync;
74 mpu9250_low_pass_filter_t filter;
75 mpu9250_gyroscope_range_t range_g;
76 mpu9250_accelerometer_range_t range_a;
77 mpu9250_pin_level_t level;
78 mpu9250_pin_type_t pin;
79 mpu9250_iic_clock_t clk;
80 mpu9250_iic_read_mode_t read_mode;
81 mpu9250_iic4_transaction_mode_t transaction_mode;
82 mpu9250_iic_transaction_mode_t tran_mode;
83 mpu9250_iic_mode_t mode;
84 mpu9250_iic_group_order_t order;
85 mpu9250_fifo_mode fifo_mode;
86 mpu9250_accelerometer_low_pass_filter_t accelerometer_filter;
87 mpu9250_low_power_accel_output_rate_t rate;
88 mpu9250_magnetometer_mode_t mag_mode;
89 mpu9250_magnetometer_bits_t bits;
90
91 /* link interface function */
92 DRIVER_MPU9250_LINK_INIT(&gs_handle, mpu9250_handle_t);
93 DRIVER_MPU9250_LINK_IIC_INIT(&gs_handle, mpu9250_interface_iic_init);
94 DRIVER_MPU9250_LINK_IIC_DEINIT(&gs_handle, mpu9250_interface_iic_deinit);
95 DRIVER_MPU9250_LINK_IIC_READ(&gs_handle, mpu9250_interface_iic_read);
96 DRIVER_MPU9250_LINK_IIC_WRITE(&gs_handle, mpu9250_interface_iic_write);
97 DRIVER_MPU9250_LINK_SPI_INIT(&gs_handle, mpu9250_interface_spi_init);
98 DRIVER_MPU9250_LINK_SPI_DEINIT(&gs_handle, mpu9250_interface_spi_deinit);
99 DRIVER_MPU9250_LINK_SPI_READ(&gs_handle, mpu9250_interface_spi_read);
100 DRIVER_MPU9250_LINK_SPI_WRITE(&gs_handle, mpu9250_interface_spi_write);
101 DRIVER_MPU9250_LINK_DELAY_MS(&gs_handle, mpu9250_interface_delay_ms);
102 DRIVER_MPU9250_LINK_DEBUG_PRINT(&gs_handle, mpu9250_interface_debug_print);
103 DRIVER_MPU9250_LINK_RECEIVE_CALLBACK(&gs_handle, mpu9250_interface_receive_callback);
104
105 /* get information */
106 res = mpu9250_info(&info);
107 if (res != 0)
108 {
109 mpu9250_interface_debug_print("mpu9250: get info failed.\n");
110
111 return 1;
112 }
113 else
114 {
115 /* print chip info */
116 mpu9250_interface_debug_print("mpu9250: chip is %s.\n", info.chip_name);
117 mpu9250_interface_debug_print("mpu9250: manufacturer is %s.\n", info.manufacturer_name);
118 mpu9250_interface_debug_print("mpu9250: interface is %s.\n", info.interface);
119 mpu9250_interface_debug_print("mpu9250: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
120 mpu9250_interface_debug_print("mpu9250: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
121 mpu9250_interface_debug_print("mpu9250: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
122 mpu9250_interface_debug_print("mpu9250: max current is %0.2fmA.\n", info.max_current_ma);
123 mpu9250_interface_debug_print("mpu9250: max temperature is %0.1fC.\n", info.temperature_max);
124 mpu9250_interface_debug_print("mpu9250: min temperature is %0.1fC.\n", info.temperature_min);
125 }
126
127 /* start register test */
128 mpu9250_interface_debug_print("mpu9250: start register test.\n");
129
130 /* mpu9250_set_interface/mpu9250_get_interface test */
131 mpu9250_interface_debug_print("mpu9250: mpu9250_set_interface/mpu9250_get_interface test.\n");
132
133 /* iic */
134 res = mpu9250_set_interface(&gs_handle, MPU9250_INTERFACE_IIC);
135 if (res != 0)
136 {
137 mpu9250_interface_debug_print("mpu9250: set interface failed.\n");
138
139 return 1;
140 }
141 mpu9250_interface_debug_print("mpu9250: set interface iic.\n");
142 res = mpu9250_get_interface(&gs_handle, &interface_check);
143 if (res != 0)
144 {
145 mpu9250_interface_debug_print("mpu9250: get interface failed.\n");
146
147 return 1;
148 }
149 mpu9250_interface_debug_print("mpu9250: check interface %s.\n", interface_check == MPU9250_INTERFACE_IIC ? "ok" : "error");
150
151 /* spi */
152 res = mpu9250_set_interface(&gs_handle, MPU9250_INTERFACE_SPI);
153 if (res != 0)
154 {
155 mpu9250_interface_debug_print("mpu9250: set interface failed.\n");
156
157 return 1;
158 }
159 mpu9250_interface_debug_print("mpu9250: set interface spi.\n");
160 res = mpu9250_get_interface(&gs_handle, &interface_check);
161 if (res != 0)
162 {
163 mpu9250_interface_debug_print("mpu9250: get interface failed.\n");
164
165 return 1;
166 }
167 mpu9250_interface_debug_print("mpu9250: check interface %s.\n", interface_check == MPU9250_INTERFACE_SPI ? "ok" : "error");
168
169 /* mpu9250_set_addr_pin/mpu9250_get_addr_pin test */
170 mpu9250_interface_debug_print("mpu9250: mpu9250_set_addr_pin/mpu9250_get_addr_pin test.\n");
171
172 /* set low */
173 res = mpu9250_set_addr_pin(&gs_handle, MPU9250_ADDRESS_AD0_LOW);
174 if (res != 0)
175 {
176 mpu9250_interface_debug_print("mpu9250: set addr pin failed.\n");
177
178 return 1;
179 }
180 mpu9250_interface_debug_print("mpu9250: set addr pin low.\n");
181 res = mpu9250_get_addr_pin(&gs_handle, &addr_pin);
182 if (res != 0)
183 {
184 mpu9250_interface_debug_print("mpu9250: get addr pin failed.\n");
185
186 return 1;
187 }
188 mpu9250_interface_debug_print("mpu9250: check addr pin %s.\n", addr_pin == MPU9250_ADDRESS_AD0_LOW ? "ok" : "error");
189
190 /* set high */
191 res = mpu9250_set_addr_pin(&gs_handle, MPU9250_ADDRESS_AD0_HIGH);
192 if (res != 0)
193 {
194 mpu9250_interface_debug_print("mpu9250: set addr pin failed.\n");
195
196 return 1;
197 }
198 mpu9250_interface_debug_print("mpu9250: set addr pin high.\n");
199 res = mpu9250_get_addr_pin(&gs_handle, &addr_pin);
200 if (res != 0)
201 {
202 mpu9250_interface_debug_print("mpu9250: get addr pin failed.\n");
203
204 return 1;
205 }
206 mpu9250_interface_debug_print("mpu9250: check addr pin %s.\n", addr_pin == MPU9250_ADDRESS_AD0_HIGH ? "ok" : "error");
207
208 /* set the interface */
209 res = mpu9250_set_interface(&gs_handle, interface);
210 if (res != 0)
211 {
212 mpu9250_interface_debug_print("mpu9250: set interface failed.\n");
213
214 return 1;
215 }
216
217 /* set the addr pin */
218 res = mpu9250_set_addr_pin(&gs_handle, addr);
219 if (res != 0)
220 {
221 mpu9250_interface_debug_print("mpu9250: set addr pin failed.\n");
222
223 return 1;
224 }
225
226 /* init */
227 res = mpu9250_init(&gs_handle);
228 if (res != 0)
229 {
230 mpu9250_interface_debug_print("mpu9250: init failed.\n");
231
232 return 1;
233 }
234
235 /* delay 100 ms */
236 mpu9250_interface_delay_ms(100);
237
238 /* disable sleep */
239 res = mpu9250_set_sleep(&gs_handle, MPU9250_BOOL_FALSE);
240 if (res != 0)
241 {
242 mpu9250_interface_debug_print("mpu9250: set sleep failed.\n");
243 (void)mpu9250_deinit(&gs_handle);
244
245 return 1;
246 }
247
248 /* if spi interface, disable iic interface */
249 if (interface == MPU9250_INTERFACE_SPI)
250 {
251 /* disable iic */
252 res = mpu9250_set_disable_iic_slave(&gs_handle, MPU9250_BOOL_TRUE);
253 if (res != 0)
254 {
255 mpu9250_interface_debug_print("mpu9250: set disable iic slave failed.\n");
256 (void)mpu9250_deinit(&gs_handle);
257
258 return 1;
259 }
260 }
261
262 /* set fifo 1024kb */
263 res = mpu9250_set_fifo_1024kb(&gs_handle);
264 if (res != 0)
265 {
266 mpu9250_interface_debug_print("mpu9250: set fifo 1024kb failed.\n");
267 (void)mpu9250_deinit(&gs_handle);
268
269 return 1;
270 }
271
272 /* mpu9250_set_fifo/mpu9250_get_fifo test */
273 mpu9250_interface_debug_print("mpu9250: mpu9250_set_fifo/mpu9250_get_fifo test.\n");
274
275 /* enable fifo */
276 res = mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_TRUE);
277 if (res != 0)
278 {
279 mpu9250_interface_debug_print("mpu9250: set fifo failed.\n");
280 (void)mpu9250_deinit(&gs_handle);
281
282 return 1;
283 }
284 mpu9250_interface_debug_print("mpu9250: enable fifo.\n");
285
286 res = mpu9250_get_fifo(&gs_handle, &enable);
287 if (res != 0)
288 {
289 mpu9250_interface_debug_print("mpu9250: get fifo failed.\n");
290 (void)mpu9250_deinit(&gs_handle);
291
292 return 1;
293 }
294 mpu9250_interface_debug_print("mpu9250: check fifo %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
295
296 /* disable fifo */
297 res = mpu9250_set_fifo(&gs_handle, MPU9250_BOOL_FALSE);
298 if (res != 0)
299 {
300 mpu9250_interface_debug_print("mpu9250: set fifo failed.\n");
301 (void)mpu9250_deinit(&gs_handle);
302
303 return 1;
304 }
305 mpu9250_interface_debug_print("mpu9250: disable fifo.\n");
306 res = mpu9250_get_fifo(&gs_handle, &enable);
307 if (res != 0)
308 {
309 mpu9250_interface_debug_print("mpu9250: get fifo failed.\n");
310 (void)mpu9250_deinit(&gs_handle);
311
312 return 1;
313 }
314 mpu9250_interface_debug_print("mpu9250: check fifo %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
315
316 /* mpu9250_set_iic_master/mpu9250_get_iic_master test */
317 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_master/mpu9250_get_iic_master test.\n");
318
319 /* enable iic master */
320 res = mpu9250_set_iic_master(&gs_handle, MPU9250_BOOL_TRUE);
321 if (res != 0)
322 {
323 mpu9250_interface_debug_print("mpu9250: set iic master failed.\n");
324 (void)mpu9250_deinit(&gs_handle);
325
326 return 1;
327 }
328 mpu9250_interface_debug_print("mpu9250: enable iic master.\n");
329 res = mpu9250_get_iic_master(&gs_handle, &enable);
330 if (res != 0)
331 {
332 mpu9250_interface_debug_print("mpu9250: get iic master failed.\n");
333 (void)mpu9250_deinit(&gs_handle);
334
335 return 1;
336 }
337 mpu9250_interface_debug_print("mpu9250: check iic master %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
338
339 /* disable iic master */
340 res = mpu9250_set_iic_master(&gs_handle, MPU9250_BOOL_FALSE);
341 if (res != 0)
342 {
343 mpu9250_interface_debug_print("mpu9250: set iic master failed.\n");
344 (void)mpu9250_deinit(&gs_handle);
345
346 return 1;
347 }
348 mpu9250_interface_debug_print("mpu9250: disable iic master.\n");
349 res = mpu9250_get_iic_master(&gs_handle, &enable);
350 if (res != 0)
351 {
352 mpu9250_interface_debug_print("mpu9250: get iic master failed.\n");
353 (void)mpu9250_deinit(&gs_handle);
354
355 return 1;
356 }
357 mpu9250_interface_debug_print("mpu9250: check iic master %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
358
359 /* mpu9250_fifo_reset/mpu9250_get_fifo_reset test */
360 mpu9250_interface_debug_print("mpu9250: mpu9250_fifo_reset/mpu9250_get_fifo_reset test.\n");
361
362 /* fifo reset */
363 res = mpu9250_fifo_reset(&gs_handle);
364 if (res != 0)
365 {
366 mpu9250_interface_debug_print("mpu9250: fifo reset failed.\n");
367 (void)mpu9250_deinit(&gs_handle);
368
369 return 1;
370 }
371 mpu9250_interface_debug_print("mpu9250: fifo reset.\n");
372 res = mpu9250_get_fifo_reset(&gs_handle, &enable);
373 if (res != 0)
374 {
375 mpu9250_interface_debug_print("mpu9250: get fifo reset failed.\n");
376 (void)mpu9250_deinit(&gs_handle);
377
378 return 1;
379 }
380 mpu9250_interface_debug_print("mpu9250: check fifo reset %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
381
382 /* mpu9250_iic_master_reset/mpu9250_get_iic_master_reset test */
383 mpu9250_interface_debug_print("mpu9250: mpu9250_iic_master_reset/mpu9250_get_iic_master_reset test.\n");
384
385 /* reset the iic master */
386 res = mpu9250_iic_master_reset(&gs_handle);
387 if (res != 0)
388 {
389 mpu9250_interface_debug_print("mpu9250: iic master failed.\n");
390 (void)mpu9250_deinit(&gs_handle);
391
392 return 1;
393 }
394 mpu9250_interface_debug_print("mpu9250: iic master reset.\n");
395 res = mpu9250_get_iic_master_reset(&gs_handle, &enable);
396 if (res != 0)
397 {
398 mpu9250_interface_debug_print("mpu9250: get iic master failed.\n");
399 (void)mpu9250_deinit(&gs_handle);
400
401 return 1;
402 }
403 mpu9250_interface_debug_print("mpu9250: check iic master %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
404
405 /* mpu9250_sensor_reset/mpu9250_get_sensor_reset test */
406 mpu9250_interface_debug_print("mpu9250: mpu9250_sensor_reset/mpu9250_get_sensor_reset test.\n");
407
408 /* sensor reset */
409 res = mpu9250_sensor_reset(&gs_handle);
410 if (res != 0)
411 {
412 mpu9250_interface_debug_print("mpu9250: sensor reset failed.\n");
413 (void)mpu9250_deinit(&gs_handle);
414
415 return 1;
416 }
417 mpu9250_interface_debug_print("mpu9250: sensor reset.\n");
418 res = mpu9250_get_sensor_reset(&gs_handle, &enable);
419 if (res != 0)
420 {
421 mpu9250_interface_debug_print("mpu9250: get sensor reset failed.\n");
422 (void)mpu9250_deinit(&gs_handle);
423
424 return 1;
425 }
426 mpu9250_interface_debug_print("mpu9250: check sensor reset %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
427
428 /* mpu9250_device_reset/mpu9250_get_device_reset test */
429 mpu9250_interface_debug_print("mpu9250: mpu9250_device_reset/mpu9250_get_device_reset test.\n");
430
431 /* device reset */
432 res = mpu9250_device_reset(&gs_handle);
433 if (res != 0)
434 {
435 mpu9250_interface_debug_print("mpu9250: device reset failed.\n");
436 (void)mpu9250_deinit(&gs_handle);
437
438 return 1;
439 }
440 mpu9250_interface_debug_print("mpu9250: device reset.\n");
441 res = mpu9250_get_device_reset(&gs_handle, &enable);
442 if (res != 0)
443 {
444 mpu9250_interface_debug_print("mpu9250: get device reset failed.\n");
445 (void)mpu9250_deinit(&gs_handle);
446
447 return 1;
448 }
449 mpu9250_interface_debug_print("mpu9250: check device reset %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
450
451 /* delay 100 ms */
452 mpu9250_interface_delay_ms(100);
453
454 /* disable sleep */
455 res = mpu9250_set_sleep(&gs_handle, MPU9250_BOOL_FALSE);
456 if (res != 0)
457 {
458 mpu9250_interface_debug_print("mpu9250: set sleep failed.\n");
459 (void)mpu9250_deinit(&gs_handle);
460
461 return 1;
462 }
463
464 /* if spi interface, disable iic interface */
465 if (interface == MPU9250_INTERFACE_SPI)
466 {
467 /* disable iic */
468 res = mpu9250_set_disable_iic_slave(&gs_handle, MPU9250_BOOL_TRUE);
469 if (res != 0)
470 {
471 mpu9250_interface_debug_print("mpu9250: set disable iic slave failed.\n");
472 (void)mpu9250_deinit(&gs_handle);
473
474 return 1;
475 }
476 }
477
478 /* mpu9250_set_clock_source/mpu9250_get_clock_source test */
479 mpu9250_interface_debug_print("mpu9250: mpu9250_set_clock_source/mpu9250_get_clock_source test.\n");
480
481 /* stop the clock */
482 res = mpu9250_set_clock_source(&gs_handle, MPU9250_CLOCK_SOURCE_STOP_CLOCK);
483 if (res != 0)
484 {
485 mpu9250_interface_debug_print("mpu9250: set clock source failed.\n");
486 (void)mpu9250_deinit(&gs_handle);
487
488 return 1;
489 }
490 mpu9250_interface_debug_print("mpu9250: stop the clock.\n");
491 res = mpu9250_get_clock_source(&gs_handle, &clock_source);
492 if (res != 0)
493 {
494 mpu9250_interface_debug_print("mpu9250: get clock source failed.\n");
495 (void)mpu9250_deinit(&gs_handle);
496
497 return 1;
498 }
499 mpu9250_interface_debug_print("mpu9250: check clock source %s.\n", clock_source == MPU9250_CLOCK_SOURCE_STOP_CLOCK ? "ok" : "error");
500
501 /* internal 20.0 MHz */
502 res = mpu9250_set_clock_source(&gs_handle, MPU9250_CLOCK_SOURCE_INTERNAL_20MHZ);
503 if (res != 0)
504 {
505 mpu9250_interface_debug_print("mpu9250: set clock source failed.\n");
506 (void)mpu9250_deinit(&gs_handle);
507
508 return 1;
509 }
510 mpu9250_interface_debug_print("mpu9250: set the clock source extern 20.0 MHz.\n");
511 res = mpu9250_get_clock_source(&gs_handle, &clock_source);
512 if (res != 0)
513 {
514 mpu9250_interface_debug_print("mpu9250: get clock source failed.\n");
515 (void)mpu9250_deinit(&gs_handle);
516
517 return 1;
518 }
519 mpu9250_interface_debug_print("mpu9250: check clock source %s.\n", clock_source == MPU9250_CLOCK_SOURCE_INTERNAL_20MHZ ? "ok" : "error");
520
521 /* pll */
522 res = mpu9250_set_clock_source(&gs_handle, MPU9250_CLOCK_SOURCE_PLL);
523 if (res != 0)
524 {
525 mpu9250_interface_debug_print("mpu9250: set clock source failed.\n");
526 (void)mpu9250_deinit(&gs_handle);
527
528 return 1;
529 }
530 mpu9250_interface_debug_print("mpu9250: set the clock source pll.\n");
531 res = mpu9250_get_clock_source(&gs_handle, &clock_source);
532 if (res != 0)
533 {
534 mpu9250_interface_debug_print("mpu9250: get clock source failed.\n");
535 (void)mpu9250_deinit(&gs_handle);
536
537 return 1;
538 }
539 mpu9250_interface_debug_print("mpu9250: check clock source %s.\n", clock_source == MPU9250_CLOCK_SOURCE_PLL ? "ok" : "error");
540
541 /* mpu9250_set_ptat/mpu9250_get_ptat test */
542 mpu9250_interface_debug_print("mpu9250: mpu9250_set_ptat/mpu9250_get_ptat test.\n");
543
544 /* enable temperature sensor */
545 res = mpu9250_set_ptat(&gs_handle, MPU9250_BOOL_TRUE);
546 if (res != 0)
547 {
548 mpu9250_interface_debug_print("mpu9250: set ptat failed.\n");
549 (void)mpu9250_deinit(&gs_handle);
550
551 return 1;
552 }
553 mpu9250_interface_debug_print("mpu9250: enable temperature sensor.\n");
554 res = mpu9250_get_ptat(&gs_handle, &enable);
555 if (res != 0)
556 {
557 mpu9250_interface_debug_print("mpu9250: get ptat failed.\n");
558 (void)mpu9250_deinit(&gs_handle);
559
560 return 1;
561 }
562 mpu9250_interface_debug_print("mpu9250: check ptat %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
563
564 /* disable temperature sensor */
565 res = mpu9250_set_ptat(&gs_handle, MPU9250_BOOL_FALSE);
566 if (res != 0)
567 {
568 mpu9250_interface_debug_print("mpu9250: set ptat failed.\n");
569 (void)mpu9250_deinit(&gs_handle);
570
571 return 1;
572 }
573 mpu9250_interface_debug_print("mpu9250: disable temperature sensor.\n");
574 res = mpu9250_get_ptat(&gs_handle, &enable);
575 if (res != 0)
576 {
577 mpu9250_interface_debug_print("mpu9250: get ptat failed.\n");
578 (void)mpu9250_deinit(&gs_handle);
579
580 return 1;
581 }
582 mpu9250_interface_debug_print("mpu9250: check ptat %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
583
584 /* mpu9250_set_cycle_wake_up/mpu9250_get_cycle_wake_up test */
585 mpu9250_interface_debug_print("mpu9250: mpu9250_set_cycle_wake_up/mpu9250_get_cycle_wake_up test.\n");
586
587 /* enable cycle wake up */
588 res = mpu9250_set_cycle_wake_up(&gs_handle, MPU9250_BOOL_TRUE);
589 if (res != 0)
590 {
591 mpu9250_interface_debug_print("mpu9250: set cycle wake up failed.\n");
592 (void)mpu9250_deinit(&gs_handle);
593
594 return 1;
595 }
596 mpu9250_interface_debug_print("mpu9250: enable cycle wake up.\n");
597 res = mpu9250_get_cycle_wake_up(&gs_handle, &enable);
598 if (res != 0)
599 {
600 mpu9250_interface_debug_print("mpu9250: get cycle wake up failed.\n");
601 (void)mpu9250_deinit(&gs_handle);
602
603 return 1;
604 }
605 mpu9250_interface_debug_print("mpu9250: check cycle wake up %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
606
607 /* disable cycle wake up */
608 res = mpu9250_set_cycle_wake_up(&gs_handle, MPU9250_BOOL_FALSE);
609 if (res != 0)
610 {
611 mpu9250_interface_debug_print("mpu9250: set cycle wake up failed.\n");
612 (void)mpu9250_deinit(&gs_handle);
613
614 return 1;
615 }
616 mpu9250_interface_debug_print("mpu9250: disable cycle wake up.\n");
617 res = mpu9250_get_cycle_wake_up(&gs_handle, &enable);
618 if (res != 0)
619 {
620 mpu9250_interface_debug_print("mpu9250: get cycle wake up failed.\n");
621 (void)mpu9250_deinit(&gs_handle);
622
623 return 1;
624 }
625 mpu9250_interface_debug_print("mpu9250: check cycle wake up %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
626
627 /* mpu9250_set_sleep/mpu9250_get_sleep test */
628 mpu9250_interface_debug_print("mpu9250: mpu9250_set_sleep/mpu9250_get_sleep test.\n");
629
630 /* enable the sleep */
631 res = mpu9250_set_sleep(&gs_handle, MPU9250_BOOL_TRUE);
632 if (res != 0)
633 {
634 mpu9250_interface_debug_print("mpu9250: set sleep failed.\n");
635 (void)mpu9250_deinit(&gs_handle);
636
637 return 1;
638 }
639 mpu9250_interface_debug_print("mpu9250: enable the sleep.\n");
640 res = mpu9250_get_sleep(&gs_handle, &enable);
641 if (res != 0)
642 {
643 mpu9250_interface_debug_print("mpu9250: get sleep failed.\n");
644 (void)mpu9250_deinit(&gs_handle);
645
646 return 1;
647 }
648 mpu9250_interface_debug_print("mpu9250: check sleep %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
649
650 /* disable the sleep */
651 res = mpu9250_set_sleep(&gs_handle, MPU9250_BOOL_FALSE);
652 if (res != 0)
653 {
654 mpu9250_interface_debug_print("mpu9250: set sleep failed.\n");
655 (void)mpu9250_deinit(&gs_handle);
656
657 return 1;
658 }
659 mpu9250_interface_debug_print("mpu9250: disable the sleep.\n");
660 res = mpu9250_get_sleep(&gs_handle, &enable);
661 if (res != 0)
662 {
663 mpu9250_interface_debug_print("mpu9250: get sleep failed.\n");
664 (void)mpu9250_deinit(&gs_handle);
665
666 return 1;
667 }
668 mpu9250_interface_debug_print("mpu9250: check sleep %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
669
670 /* mpu9250_set_standby_mode/mpu9250_get_standby_mode test */
671 mpu9250_interface_debug_print("mpu9250: mpu9250_set_standby_mode/mpu9250_get_standby_mode test.\n");
672
673 /* enable standby mode */
674 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_X, MPU9250_BOOL_TRUE);
675 if (res != 0)
676 {
677 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
678 (void)mpu9250_deinit(&gs_handle);
679
680 return 1;
681 }
682 mpu9250_interface_debug_print("mpu9250: enable acc x standby mode.\n");
683 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_X, &enable);
684 if (res != 0)
685 {
686 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
687 (void)mpu9250_deinit(&gs_handle);
688
689 return 1;
690 }
691 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
692
693 /* disable standby mode */
694 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_X, MPU9250_BOOL_FALSE);
695 if (res != 0)
696 {
697 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
698 (void)mpu9250_deinit(&gs_handle);
699
700 return 1;
701 }
702 mpu9250_interface_debug_print("mpu9250: disable acc x standby mode.\n");
703 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_X, &enable);
704 if (res != 0)
705 {
706 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
707 (void)mpu9250_deinit(&gs_handle);
708
709 return 1;
710 }
711 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
712
713 /* enable standby mode */
714 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Y, MPU9250_BOOL_TRUE);
715 if (res != 0)
716 {
717 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
718 (void)mpu9250_deinit(&gs_handle);
719
720 return 1;
721 }
722 mpu9250_interface_debug_print("mpu9250: enable acc y standby mode.\n");
723 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Y, &enable);
724 if (res != 0)
725 {
726 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
727 (void)mpu9250_deinit(&gs_handle);
728
729 return 1;
730 }
731 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
732
733 /* disable standby mode */
734 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Y, MPU9250_BOOL_FALSE);
735 if (res != 0)
736 {
737 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
738 (void)mpu9250_deinit(&gs_handle);
739
740 return 1;
741 }
742 mpu9250_interface_debug_print("mpu9250: disable acc y standby mode.\n");
743 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Y, &enable);
744 if (res != 0)
745 {
746 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
747 (void)mpu9250_deinit(&gs_handle);
748
749 return 1;
750 }
751 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
752
753 /* enable standby mode */
754 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Z, MPU9250_BOOL_TRUE);
755 if (res != 0)
756 {
757 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
758 (void)mpu9250_deinit(&gs_handle);
759
760 return 1;
761 }
762 mpu9250_interface_debug_print("mpu9250: enable acc z standby mode.\n");
763 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Z, &enable);
764 if (res != 0)
765 {
766 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
767 (void)mpu9250_deinit(&gs_handle);
768
769 return 1;
770 }
771 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
772
773 /* disable standby mode */
774 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Z, MPU9250_BOOL_FALSE);
775 if (res != 0)
776 {
777 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
778 (void)mpu9250_deinit(&gs_handle);
779
780 return 1;
781 }
782 mpu9250_interface_debug_print("mpu9250: disable acc z standby mode.\n");
783 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_ACC_Z, &enable);
784 if (res != 0)
785 {
786 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
787 (void)mpu9250_deinit(&gs_handle);
788
789 return 1;
790 }
791 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
792
793 /* enable standby mode */
794 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_X, MPU9250_BOOL_TRUE);
795 if (res != 0)
796 {
797 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
798 (void)mpu9250_deinit(&gs_handle);
799
800 return 1;
801 }
802 mpu9250_interface_debug_print("mpu9250: enable gyro x standby mode.\n");
803 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_X, &enable);
804 if (res != 0)
805 {
806 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
807 (void)mpu9250_deinit(&gs_handle);
808
809 return 1;
810 }
811 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
812
813 /* disable standby mode */
814 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_X, MPU9250_BOOL_FALSE);
815 if (res != 0)
816 {
817 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
818 (void)mpu9250_deinit(&gs_handle);
819
820 return 1;
821 }
822 mpu9250_interface_debug_print("mpu9250: disable gyro x standby mode.\n");
823 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_X, &enable);
824 if (res != 0)
825 {
826 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
827 (void)mpu9250_deinit(&gs_handle);
828
829 return 1;
830 }
831 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
832
833 /* enable standby mode */
834 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Y, MPU9250_BOOL_TRUE);
835 if (res != 0)
836 {
837 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
838 (void)mpu9250_deinit(&gs_handle);
839
840 return 1;
841 }
842 mpu9250_interface_debug_print("mpu9250: enable gyro y standby mode.\n");
843 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Y, &enable);
844 if (res != 0)
845 {
846 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
847 (void)mpu9250_deinit(&gs_handle);
848
849 return 1;
850 }
851 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
852
853 /* disable standby mode */
854 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Y, MPU9250_BOOL_FALSE);
855 if (res != 0)
856 {
857 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
858 (void)mpu9250_deinit(&gs_handle);
859
860 return 1;
861 }
862 mpu9250_interface_debug_print("mpu9250: disable gyro y standby mode.\n");
863 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Y, &enable);
864 if (res != 0)
865 {
866 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
867 (void)mpu9250_deinit(&gs_handle);
868
869 return 1;
870 }
871 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
872
873 /* enable standby mode */
874 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Z, MPU9250_BOOL_TRUE);
875 if (res != 0)
876 {
877 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
878 (void)mpu9250_deinit(&gs_handle);
879
880 return 1;
881 }
882 mpu9250_interface_debug_print("mpu9250: enable gyro z standby mode.\n");
883 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Z, &enable);
884 if (res != 0)
885 {
886 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
887 (void)mpu9250_deinit(&gs_handle);
888
889 return 1;
890 }
891 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
892
893 /* disable standby mode */
894 res = mpu9250_set_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Z, MPU9250_BOOL_FALSE);
895 if (res != 0)
896 {
897 mpu9250_interface_debug_print("mpu9250: set standby mode failed.\n");
898 (void)mpu9250_deinit(&gs_handle);
899
900 return 1;
901 }
902 mpu9250_interface_debug_print("mpu9250: disable gyro z standby mode.\n");
903 res = mpu9250_get_standby_mode(&gs_handle, MPU9250_SOURCE_GYRO_Z, &enable);
904 if (res != 0)
905 {
906 mpu9250_interface_debug_print("mpu9250: get standby mode failed.\n");
907 (void)mpu9250_deinit(&gs_handle);
908
909 return 1;
910 }
911 mpu9250_interface_debug_print("mpu9250: check standby mode %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
912
913 /* mpu9250_fifo_get/mpu9250_fifo_set test */
914 mpu9250_interface_debug_print("mpu9250: mpu9250_fifo_get/mpu9250_fifo_set test.\n");
915
916 for (i = 0; i < 8; i++)
917 {
918 data[i] = (uint8_t)(rand() % 256);
919 }
920 /* fifo set */
921 res = mpu9250_fifo_set(&gs_handle, data, 8);
922 if (res != 0)
923 {
924 mpu9250_interface_debug_print("mpu9250: fifo write failed.\n");
925 (void)mpu9250_deinit(&gs_handle);
926
927 return 1;
928 }
929 mpu9250_interface_debug_print("mpu9250: check fifo write %s.\n", (res == 0) ? "ok" : "error");
930
931 /* fifo get */
932 res = mpu9250_fifo_get(&gs_handle, data_check, 8);
933 if (res != 0)
934 {
935 mpu9250_interface_debug_print("mpu9250: fifo read failed.\n");
936 (void)mpu9250_deinit(&gs_handle);
937
938 return 1;
939 }
940 mpu9250_interface_debug_print("mpu9250: check fifo read %s.\n", (res == 0) ? "ok" : "error");
941
942 /* mpu9250_get_fifo_count test */
943 mpu9250_interface_debug_print("mpu9250: mpu9250_get_fifo_count test.\n");
944
945 /* fifo count */
946 res = mpu9250_get_fifo_count(&gs_handle, &cnt);
947 if (res != 0)
948 {
949 mpu9250_interface_debug_print("mpu9250: fifo count failed.\n");
950 (void)mpu9250_deinit(&gs_handle);
951
952 return 1;
953 }
954 mpu9250_interface_debug_print("mpu9250: fifo count %d.\n", cnt);
955
956 /* mpu9250_set_signal_path_reset test */
957 mpu9250_interface_debug_print("mpu9250: mpu9250_set_signal_path_reset test.\n");
958
959 /* temp reset */
960 res = mpu9250_set_signal_path_reset(&gs_handle, MPU9250_SIGNAL_PATH_RESET_TEMP);
961 if (res != 0)
962 {
963 mpu9250_interface_debug_print("mpu9250: set signal path reset failed.\n");
964 (void)mpu9250_deinit(&gs_handle);
965
966 return 1;
967 }
968 mpu9250_interface_debug_print("mpu9250: temp signal path reset.\n");
969 mpu9250_interface_debug_print("mpu9250: check signal path reset %s.\n", (res == 0) ? "ok" : "error");
970
971 /* accel reset */
972 res = mpu9250_set_signal_path_reset(&gs_handle, MPU9250_SIGNAL_PATH_RESET_ACCEL);
973 if (res != 0)
974 {
975 mpu9250_interface_debug_print("mpu9250: set signal path reset failed.\n");
976 (void)mpu9250_deinit(&gs_handle);
977
978 return 1;
979 }
980 mpu9250_interface_debug_print("mpu9250: accel signal path reset.\n");
981 mpu9250_interface_debug_print("mpu9250: check signal path reset %s.\n", (res == 0) ? "ok" : "error");
982
983 /* gyro reset */
984 res = mpu9250_set_signal_path_reset(&gs_handle, MPU9250_SIGNAL_PATH_RESET_GYRO);
985 if (res != 0)
986 {
987 mpu9250_interface_debug_print("mpu9250: set signal path reset failed.\n");
988 (void)mpu9250_deinit(&gs_handle);
989
990 return 1;
991 }
992 mpu9250_interface_debug_print("mpu9250: gyro signal path reset.\n");
993 mpu9250_interface_debug_print("mpu9250: check signal path reset %s.\n", (res == 0) ? "ok" : "error");
994
995 /* mpu9250_set_sample_rate_divider/mpu9250_get_sample_rate_divider test */
996 mpu9250_interface_debug_print("mpu9250: mpu9250_set_sample_rate_divider/mpu9250_get_sample_rate_divider test.\n");
997
998 div_in = (uint8_t)(rand() % 256);
999 res = mpu9250_set_sample_rate_divider(&gs_handle, div_in);
1000 if (res != 0)
1001 {
1002 mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
1003 (void)mpu9250_deinit(&gs_handle);
1004
1005 return 1;
1006 }
1007 mpu9250_interface_debug_print("mpu9250: set sample rate divider 0x%02X.\n", div);
1008 res = mpu9250_get_sample_rate_divider(&gs_handle, &div_check);
1009 if (res != 0)
1010 {
1011 mpu9250_interface_debug_print("mpu9250: get sample rate divider failed.\n");
1012 (void)mpu9250_deinit(&gs_handle);
1013
1014 return 1;
1015 }
1016 mpu9250_interface_debug_print("mpu9250: check sample rate divider %s.\n", (div_in == div_check) ? "ok" : "error");
1017
1018 /* mpu9250_set_extern_sync/mpu9250_get_extern_sync test */
1019 mpu9250_interface_debug_print("mpu9250: mpu9250_set_extern_sync/mpu9250_get_extern_sync test.\n");
1020
1021 /* input disabled */
1022 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_INPUT_DISABLED);
1023 if (res != 0)
1024 {
1025 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1026 (void)mpu9250_deinit(&gs_handle);
1027
1028 return 1;
1029 }
1030 mpu9250_interface_debug_print("mpu9250: set extern sync input disabled.\n");
1031 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1032 if (res != 0)
1033 {
1034 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1035 (void)mpu9250_deinit(&gs_handle);
1036
1037 return 1;
1038 }
1039 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_INPUT_DISABLED) ? "ok" : "error");
1040
1041 /* temp out low */
1042 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_TEMP_OUT_L);
1043 if (res != 0)
1044 {
1045 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1046 (void)mpu9250_deinit(&gs_handle);
1047
1048 return 1;
1049 }
1050 mpu9250_interface_debug_print("mpu9250: set extern sync temp out low.\n");
1051 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1052 if (res != 0)
1053 {
1054 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1055 (void)mpu9250_deinit(&gs_handle);
1056
1057 return 1;
1058 }
1059 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_TEMP_OUT_L) ? "ok" : "error");
1060
1061 /* gyro xout low */
1062 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_GYRO_XOUT_L);
1063 if (res != 0)
1064 {
1065 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1066 (void)mpu9250_deinit(&gs_handle);
1067
1068 return 1;
1069 }
1070 mpu9250_interface_debug_print("mpu9250: set extern sync gyro xout low.\n");
1071 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1072 if (res != 0)
1073 {
1074 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1075 (void)mpu9250_deinit(&gs_handle);
1076
1077 return 1;
1078 }
1079 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_GYRO_XOUT_L) ? "ok" : "error");
1080
1081 /* gyro yout low */
1082 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_GYRO_YOUT_L);
1083 if (res != 0)
1084 {
1085 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1086 (void)mpu9250_deinit(&gs_handle);
1087
1088 return 1;
1089 }
1090 mpu9250_interface_debug_print("mpu9250: set extern sync gyro yout low.\n");
1091 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1092 if (res != 0)
1093 {
1094 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1095 (void)mpu9250_deinit(&gs_handle);
1096
1097 return 1;
1098 }
1099 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_GYRO_YOUT_L) ? "ok" : "error");
1100
1101 /* gyro zout low */
1102 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_GYRO_ZOUT_L);
1103 if (res != 0)
1104 {
1105 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1106 (void)mpu9250_deinit(&gs_handle);
1107
1108 return 1;
1109 }
1110 mpu9250_interface_debug_print("mpu9250: set extern sync gyro zout low.\n");
1111 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1112 if (res != 0)
1113 {
1114 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1115 (void)mpu9250_deinit(&gs_handle);
1116
1117 return 1;
1118 }
1119 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_GYRO_ZOUT_L) ? "ok" : "error");
1120
1121 /* accel xout low */
1122 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_ACCEL_XOUT_L);
1123 if (res != 0)
1124 {
1125 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1126 (void)mpu9250_deinit(&gs_handle);
1127
1128 return 1;
1129 }
1130 mpu9250_interface_debug_print("mpu9250: set extern sync accel xout low.\n");
1131 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1132 if (res != 0)
1133 {
1134 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1135 (void)mpu9250_deinit(&gs_handle);
1136
1137 return 1;
1138 }
1139 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_ACCEL_XOUT_L) ? "ok" : "error");
1140
1141 /* accel yout low */
1142 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_ACCEL_YOUT_L);
1143 if (res != 0)
1144 {
1145 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1146 (void)mpu9250_deinit(&gs_handle);
1147
1148 return 1;
1149 }
1150 mpu9250_interface_debug_print("mpu9250: set extern sync accel yout low.\n");
1151 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1152 if (res != 0)
1153 {
1154 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1155 (void)mpu9250_deinit(&gs_handle);
1156
1157 return 1;
1158 }
1159 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_ACCEL_YOUT_L) ? "ok" : "error");
1160
1161 /* accel zout low */
1162 res = mpu9250_set_extern_sync(&gs_handle, MPU9250_EXTERN_SYNC_ACCEL_ZOUT_L);
1163 if (res != 0)
1164 {
1165 mpu9250_interface_debug_print("mpu9250: set extern sync failed.\n");
1166 (void)mpu9250_deinit(&gs_handle);
1167
1168 return 1;
1169 }
1170 mpu9250_interface_debug_print("mpu9250: set extern sync accel zout low.\n");
1171 res = mpu9250_get_extern_sync(&gs_handle, &sync);
1172 if (res != 0)
1173 {
1174 mpu9250_interface_debug_print("mpu9250: get extern sync failed.\n");
1175 (void)mpu9250_deinit(&gs_handle);
1176
1177 return 1;
1178 }
1179 mpu9250_interface_debug_print("mpu9250: check extern sync %s.\n", (sync == MPU9250_EXTERN_SYNC_ACCEL_ZOUT_L) ? "ok" : "error");
1180
1181 /* mpu9250_set_low_pass_filter/mpu9250_get_low_pass_filter test */
1182 mpu9250_interface_debug_print("mpu9250: mpu9250_set_low_pass_filter/mpu9250_get_low_pass_filter test.\n");
1183
1184 /* filter 0 */
1185 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_0);
1186 if (res != 0)
1187 {
1188 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
1189 (void)mpu9250_deinit(&gs_handle);
1190
1191 return 1;
1192 }
1193 mpu9250_interface_debug_print("mpu9250: set low pass filter 0.\n");
1194 res = mpu9250_get_low_pass_filter(&gs_handle, &filter);
1195 if (res != 0)
1196 {
1197 mpu9250_interface_debug_print("mpu9250: get low pass filter failed.\n");
1198 (void)mpu9250_deinit(&gs_handle);
1199
1200 return 1;
1201 }
1202 mpu9250_interface_debug_print("mpu9250: check low pass filter %s.\n", (filter == MPU9250_LOW_PASS_FILTER_0) ? "ok" : "error");
1203
1204 /* filter 1 */
1205 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_1);
1206 if (res != 0)
1207 {
1208 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
1209 (void)mpu9250_deinit(&gs_handle);
1210
1211 return 1;
1212 }
1213 mpu9250_interface_debug_print("mpu9250: set low pass filter 1.\n");
1214 res = mpu9250_get_low_pass_filter(&gs_handle, &filter);
1215 if (res != 0)
1216 {
1217 mpu9250_interface_debug_print("mpu9250: get low pass filter failed.\n");
1218 (void)mpu9250_deinit(&gs_handle);
1219
1220 return 1;
1221 }
1222 mpu9250_interface_debug_print("mpu9250: check low pass filter %s.\n", (filter == MPU9250_LOW_PASS_FILTER_1) ? "ok" : "error");
1223
1224 /* filter 2 */
1225 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_2);
1226 if (res != 0)
1227 {
1228 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
1229 (void)mpu9250_deinit(&gs_handle);
1230
1231 return 1;
1232 }
1233 mpu9250_interface_debug_print("mpu9250: set low pass filter 2.\n");
1234 res = mpu9250_get_low_pass_filter(&gs_handle, &filter);
1235 if (res != 0)
1236 {
1237 mpu9250_interface_debug_print("mpu9250: get low pass filter failed.\n");
1238 (void)mpu9250_deinit(&gs_handle);
1239
1240 return 1;
1241 }
1242 mpu9250_interface_debug_print("mpu9250: check low pass filter %s.\n", (filter == MPU9250_LOW_PASS_FILTER_2) ? "ok" : "error");
1243
1244 /* filter 3 */
1245 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_3);
1246 if (res != 0)
1247 {
1248 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
1249 (void)mpu9250_deinit(&gs_handle);
1250
1251 return 1;
1252 }
1253 mpu9250_interface_debug_print("mpu9250: set low pass filter 3.\n");
1254 res = mpu9250_get_low_pass_filter(&gs_handle, &filter);
1255 if (res != 0)
1256 {
1257 mpu9250_interface_debug_print("mpu9250: get low pass filter failed.\n");
1258 (void)mpu9250_deinit(&gs_handle);
1259
1260 return 1;
1261 }
1262 mpu9250_interface_debug_print("mpu9250: check low pass filter %s.\n", (filter == MPU9250_LOW_PASS_FILTER_3) ? "ok" : "error");
1263
1264 /* filter 4 */
1265 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_4);
1266 if (res != 0)
1267 {
1268 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
1269 (void)mpu9250_deinit(&gs_handle);
1270
1271 return 1;
1272 }
1273 mpu9250_interface_debug_print("mpu9250: set low pass filter 4.\n");
1274 res = mpu9250_get_low_pass_filter(&gs_handle, &filter);
1275 if (res != 0)
1276 {
1277 mpu9250_interface_debug_print("mpu9250: get low pass filter failed.\n");
1278 (void)mpu9250_deinit(&gs_handle);
1279
1280 return 1;
1281 }
1282 mpu9250_interface_debug_print("mpu9250: check low pass filter %s.\n", (filter == MPU9250_LOW_PASS_FILTER_4) ? "ok" : "error");
1283
1284 /* filter 5 */
1285 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_5);
1286 if (res != 0)
1287 {
1288 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
1289 (void)mpu9250_deinit(&gs_handle);
1290
1291 return 1;
1292 }
1293 mpu9250_interface_debug_print("mpu9250: set low pass filter 5.\n");
1294 res = mpu9250_get_low_pass_filter(&gs_handle, &filter);
1295 if (res != 0)
1296 {
1297 mpu9250_interface_debug_print("mpu9250: get low pass filter failed.\n");
1298 (void)mpu9250_deinit(&gs_handle);
1299
1300 return 1;
1301 }
1302 mpu9250_interface_debug_print("mpu9250: check low pass filter %s.\n", (filter == MPU9250_LOW_PASS_FILTER_5) ? "ok" : "error");
1303
1304 /* filter 6 */
1305 res = mpu9250_set_low_pass_filter(&gs_handle, MPU9250_LOW_PASS_FILTER_6);
1306 if (res != 0)
1307 {
1308 mpu9250_interface_debug_print("mpu9250: set low pass filter failed.\n");
1309 (void)mpu9250_deinit(&gs_handle);
1310
1311 return 1;
1312 }
1313 mpu9250_interface_debug_print("mpu9250: set low pass filter 6.\n");
1314 res = mpu9250_get_low_pass_filter(&gs_handle, &filter);
1315 if (res != 0)
1316 {
1317 mpu9250_interface_debug_print("mpu9250: get low pass filter failed.\n");
1318 (void)mpu9250_deinit(&gs_handle);
1319
1320 return 1;
1321 }
1322 mpu9250_interface_debug_print("mpu9250: check low pass filter %s.\n", (filter == MPU9250_LOW_PASS_FILTER_6) ? "ok" : "error");
1323
1324 /* mpu9250_set_gyroscope_test/mpu9250_get_gyroscope_test test */
1325 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyroscope_test/mpu9250_get_gyroscope_test test.\n");
1326
1327 /* enable axis x */
1328 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_TRUE);
1329 if (res != 0)
1330 {
1331 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
1332 (void)mpu9250_deinit(&gs_handle);
1333
1334 return 1;
1335 }
1336 mpu9250_interface_debug_print("mpu9250: enable axis x.\n");
1337 res = mpu9250_get_gyroscope_test(&gs_handle, MPU9250_AXIS_X, &enable);
1338 if (res != 0)
1339 {
1340 mpu9250_interface_debug_print("mpu9250: get gyroscope test failed.\n");
1341 (void)mpu9250_deinit(&gs_handle);
1342
1343 return 1;
1344 }
1345 mpu9250_interface_debug_print("mpu9250: check gyroscope test %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1346
1347 /* disable axis x */
1348 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
1349 if (res != 0)
1350 {
1351 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
1352 (void)mpu9250_deinit(&gs_handle);
1353
1354 return 1;
1355 }
1356 mpu9250_interface_debug_print("mpu9250: disable axis x.\n");
1357 res = mpu9250_get_gyroscope_test(&gs_handle, MPU9250_AXIS_X, &enable);
1358 if (res != 0)
1359 {
1360 mpu9250_interface_debug_print("mpu9250: get gyroscope test failed.\n");
1361 (void)mpu9250_deinit(&gs_handle);
1362
1363 return 1;
1364 }
1365 mpu9250_interface_debug_print("mpu9250: check gyroscope test %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1366
1367 /* enable axis y */
1368 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_TRUE);
1369 if (res != 0)
1370 {
1371 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
1372 (void)mpu9250_deinit(&gs_handle);
1373
1374 return 1;
1375 }
1376 mpu9250_interface_debug_print("mpu9250: enable axis y.\n");
1377 res = mpu9250_get_gyroscope_test(&gs_handle, MPU9250_AXIS_Y, &enable);
1378 if (res != 0)
1379 {
1380 mpu9250_interface_debug_print("mpu9250: get gyroscope test failed.\n");
1381 (void)mpu9250_deinit(&gs_handle);
1382
1383 return 1;
1384 }
1385 mpu9250_interface_debug_print("mpu9250: check gyroscope test %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1386
1387 /* disable axis y */
1388 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
1389 if (res != 0)
1390 {
1391 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
1392 (void)mpu9250_deinit(&gs_handle);
1393
1394 return 1;
1395 }
1396 mpu9250_interface_debug_print("mpu9250: disable axis y.\n");
1397 res = mpu9250_get_gyroscope_test(&gs_handle, MPU9250_AXIS_Y, &enable);
1398 if (res != 0)
1399 {
1400 mpu9250_interface_debug_print("mpu9250: get gyroscope test failed.\n");
1401 (void)mpu9250_deinit(&gs_handle);
1402
1403 return 1;
1404 }
1405 mpu9250_interface_debug_print("mpu9250: check gyroscope test %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1406
1407 /* enable axis z */
1408 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_TRUE);
1409 if (res != 0)
1410 {
1411 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
1412 (void)mpu9250_deinit(&gs_handle);
1413
1414 return 1;
1415 }
1416 mpu9250_interface_debug_print("mpu9250: enable axis z.\n");
1417 res = mpu9250_get_gyroscope_test(&gs_handle, MPU9250_AXIS_Z, &enable);
1418 if (res != 0)
1419 {
1420 mpu9250_interface_debug_print("mpu9250: get gyroscope test failed.\n");
1421 (void)mpu9250_deinit(&gs_handle);
1422
1423 return 1;
1424 }
1425 mpu9250_interface_debug_print("mpu9250: check gyroscope test %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1426
1427 /* disable axis z */
1428 res = mpu9250_set_gyroscope_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
1429 if (res != 0)
1430 {
1431 mpu9250_interface_debug_print("mpu9250: set gyroscope test failed.\n");
1432 (void)mpu9250_deinit(&gs_handle);
1433
1434 return 1;
1435 }
1436 mpu9250_interface_debug_print("mpu9250: disable axis z.\n");
1437 res = mpu9250_get_gyroscope_test(&gs_handle, MPU9250_AXIS_Z, &enable);
1438 if (res != 0)
1439 {
1440 mpu9250_interface_debug_print("mpu9250: get gyroscope test failed.\n");
1441 (void)mpu9250_deinit(&gs_handle);
1442
1443 return 1;
1444 }
1445 mpu9250_interface_debug_print("mpu9250: check gyroscope test %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1446
1447 /* mpu9250_set_gyroscope_range/mpu9250_get_gyroscope_range test */
1448 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyroscope_range/mpu9250_get_gyroscope_range test.\n");
1449
1450 /* 250 dps */
1451 res = mpu9250_set_gyroscope_range(&gs_handle, MPU9250_GYROSCOPE_RANGE_250DPS);
1452 if (res != 0)
1453 {
1454 mpu9250_interface_debug_print("mpu9250: set gyroscope range failed.\n");
1455 (void)mpu9250_deinit(&gs_handle);
1456
1457 return 1;
1458 }
1459 mpu9250_interface_debug_print("mpu9250: set gyroscope range 250 dps.\n");
1460 res = mpu9250_get_gyroscope_range(&gs_handle, &range_g);
1461 if (res != 0)
1462 {
1463 mpu9250_interface_debug_print("mpu9250: get gyroscope range failed.\n");
1464 (void)mpu9250_deinit(&gs_handle);
1465
1466 return 1;
1467 }
1468 mpu9250_interface_debug_print("mpu9250: check gyroscope range %s.\n", range_g == MPU9250_GYROSCOPE_RANGE_250DPS ? "ok" : "error");
1469
1470 /* 500 dps */
1471 res = mpu9250_set_gyroscope_range(&gs_handle, MPU9250_GYROSCOPE_RANGE_500DPS);
1472 if (res != 0)
1473 {
1474 mpu9250_interface_debug_print("mpu9250: set gyroscope range failed.\n");
1475 (void)mpu9250_deinit(&gs_handle);
1476
1477 return 1;
1478 }
1479 mpu9250_interface_debug_print("mpu9250: set gyroscope range 500 dps.\n");
1480 res = mpu9250_get_gyroscope_range(&gs_handle, &range_g);
1481 if (res != 0)
1482 {
1483 mpu9250_interface_debug_print("mpu9250: get gyroscope range failed.\n");
1484 (void)mpu9250_deinit(&gs_handle);
1485
1486 return 1;
1487 }
1488 mpu9250_interface_debug_print("mpu9250: check gyroscope range %s.\n", range_g == MPU9250_GYROSCOPE_RANGE_500DPS ? "ok" : "error");
1489
1490 /* 1000 dps */
1491 res = mpu9250_set_gyroscope_range(&gs_handle, MPU9250_GYROSCOPE_RANGE_1000DPS);
1492 if (res != 0)
1493 {
1494 mpu9250_interface_debug_print("mpu9250: set gyroscope range failed.\n");
1495 (void)mpu9250_deinit(&gs_handle);
1496
1497 return 1;
1498 }
1499 mpu9250_interface_debug_print("mpu9250: set gyroscope range 1000 dps.\n");
1500 res = mpu9250_get_gyroscope_range(&gs_handle, &range_g);
1501 if (res != 0)
1502 {
1503 mpu9250_interface_debug_print("mpu9250: get gyroscope range failed.\n");
1504 (void)mpu9250_deinit(&gs_handle);
1505
1506 return 1;
1507 }
1508 mpu9250_interface_debug_print("mpu9250: check gyroscope range %s.\n", range_g == MPU9250_GYROSCOPE_RANGE_1000DPS ? "ok" : "error");
1509
1510 /* 2000 dps */
1511 res = mpu9250_set_gyroscope_range(&gs_handle, MPU9250_GYROSCOPE_RANGE_2000DPS);
1512 if (res != 0)
1513 {
1514 mpu9250_interface_debug_print("mpu9250: set gyroscope range failed.\n");
1515 (void)mpu9250_deinit(&gs_handle);
1516
1517 return 1;
1518 }
1519 mpu9250_interface_debug_print("mpu9250: set gyroscope range 2000 dps.\n");
1520 res = mpu9250_get_gyroscope_range(&gs_handle, &range_g);
1521 if (res != 0)
1522 {
1523 mpu9250_interface_debug_print("mpu9250: get gyroscope range failed.\n");
1524 (void)mpu9250_deinit(&gs_handle);
1525
1526 return 1;
1527 }
1528 mpu9250_interface_debug_print("mpu9250: check gyroscope range %s.\n", range_g == MPU9250_GYROSCOPE_RANGE_2000DPS ? "ok" : "error");
1529
1530 /* mpu9250_set_accelerometer_test/mpu9250_get_accelerometer_test test */
1531 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_test/mpu9250_get_accelerometer_test test.\n");
1532
1533 /* enable accelerometer x */
1534 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_TRUE);
1535 if (res != 0)
1536 {
1537 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
1538 (void)mpu9250_deinit(&gs_handle);
1539
1540 return 1;
1541 }
1542 mpu9250_interface_debug_print("mpu9250: enable accelerometer x.\n");
1543 res = mpu9250_get_accelerometer_test(&gs_handle, MPU9250_AXIS_X, &enable);
1544 if (res != 0)
1545 {
1546 mpu9250_interface_debug_print("mpu9250: get accelerometer test failed.\n");
1547 (void)mpu9250_deinit(&gs_handle);
1548
1549 return 1;
1550 }
1551 mpu9250_interface_debug_print("mpu9250: check accelerometer test %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1552
1553 /* disable accelerometer x */
1554 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_X, MPU9250_BOOL_FALSE);
1555 if (res != 0)
1556 {
1557 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
1558 (void)mpu9250_deinit(&gs_handle);
1559
1560 return 1;
1561 }
1562 mpu9250_interface_debug_print("mpu9250: disable accelerometer x.\n");
1563 res = mpu9250_get_accelerometer_test(&gs_handle, MPU9250_AXIS_X, &enable);
1564 if (res != 0)
1565 {
1566 mpu9250_interface_debug_print("mpu9250: get accelerometer test failed.\n");
1567 (void)mpu9250_deinit(&gs_handle);
1568
1569 return 1;
1570 }
1571 mpu9250_interface_debug_print("mpu9250: check accelerometer test %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1572
1573 /* enable accelerometer y */
1574 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_TRUE);
1575 if (res != 0)
1576 {
1577 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
1578 (void)mpu9250_deinit(&gs_handle);
1579
1580 return 1;
1581 }
1582 mpu9250_interface_debug_print("mpu9250: enable accelerometer y.\n");
1583 res = mpu9250_get_accelerometer_test(&gs_handle, MPU9250_AXIS_Y, &enable);
1584 if (res != 0)
1585 {
1586 mpu9250_interface_debug_print("mpu9250: get accelerometer test failed.\n");
1587 (void)mpu9250_deinit(&gs_handle);
1588
1589 return 1;
1590 }
1591 mpu9250_interface_debug_print("mpu9250: check accelerometer test %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1592
1593 /* disable accelerometer y */
1594 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Y, MPU9250_BOOL_FALSE);
1595 if (res != 0)
1596 {
1597 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
1598 (void)mpu9250_deinit(&gs_handle);
1599
1600 return 1;
1601 }
1602 mpu9250_interface_debug_print("mpu9250: disable accelerometer y.\n");
1603 res = mpu9250_get_accelerometer_test(&gs_handle, MPU9250_AXIS_Y, &enable);
1604 if (res != 0)
1605 {
1606 mpu9250_interface_debug_print("mpu9250: get accelerometer test failed.\n");
1607 (void)mpu9250_deinit(&gs_handle);
1608
1609 return 1;
1610 }
1611 mpu9250_interface_debug_print("mpu9250: check accelerometer test %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1612
1613 /* enable accelerometer z */
1614 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_TRUE);
1615 if (res != 0)
1616 {
1617 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
1618 (void)mpu9250_deinit(&gs_handle);
1619
1620 return 1;
1621 }
1622 mpu9250_interface_debug_print("mpu9250: enable accelerometer z.\n");
1623 res = mpu9250_get_accelerometer_test(&gs_handle, MPU9250_AXIS_Z, &enable);
1624 if (res != 0)
1625 {
1626 mpu9250_interface_debug_print("mpu9250: get accelerometer test failed.\n");
1627 (void)mpu9250_deinit(&gs_handle);
1628
1629 return 1;
1630 }
1631 mpu9250_interface_debug_print("mpu9250: check accelerometer test %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1632
1633 /* disable accelerometer z */
1634 res = mpu9250_set_accelerometer_test(&gs_handle, MPU9250_AXIS_Z, MPU9250_BOOL_FALSE);
1635 if (res != 0)
1636 {
1637 mpu9250_interface_debug_print("mpu9250: set accelerometer test failed.\n");
1638 (void)mpu9250_deinit(&gs_handle);
1639
1640 return 1;
1641 }
1642 mpu9250_interface_debug_print("mpu9250: disable accelerometer z.\n");
1643 res = mpu9250_get_accelerometer_test(&gs_handle, MPU9250_AXIS_Z, &enable);
1644 if (res != 0)
1645 {
1646 mpu9250_interface_debug_print("mpu9250: get accelerometer test failed.\n");
1647 (void)mpu9250_deinit(&gs_handle);
1648
1649 return 1;
1650 }
1651 mpu9250_interface_debug_print("mpu9250: check accelerometer test %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1652
1653 /* mpu9250_set_accelerometer_range/mpu9250_get_accelerometer_range test */
1654 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_range/mpu9250_get_accelerometer_range test.\n");
1655
1656 /* 2g */
1657 res = mpu9250_set_accelerometer_range(&gs_handle, MPU9250_ACCELEROMETER_RANGE_2G);
1658 if (res != 0)
1659 {
1660 mpu9250_interface_debug_print("mpu9250: set accelerometer range failed.\n");
1661 (void)mpu9250_deinit(&gs_handle);
1662
1663 return 1;
1664 }
1665 mpu9250_interface_debug_print("mpu9250: set accelerometer range 2g.\n");
1666 res = mpu9250_get_accelerometer_range(&gs_handle, &range_a);
1667 if (res != 0)
1668 {
1669 mpu9250_interface_debug_print("mpu9250: get accelerometer range failed.\n");
1670 (void)mpu9250_deinit(&gs_handle);
1671
1672 return 1;
1673 }
1674 mpu9250_interface_debug_print("mpu9250: check accelerometer range %s.\n", range_a == MPU9250_ACCELEROMETER_RANGE_2G ? "ok" : "error");
1675
1676 /* 4g */
1677 res = mpu9250_set_accelerometer_range(&gs_handle, MPU9250_ACCELEROMETER_RANGE_4G);
1678 if (res != 0)
1679 {
1680 mpu9250_interface_debug_print("mpu9250: set accelerometer range failed.\n");
1681 (void)mpu9250_deinit(&gs_handle);
1682
1683 return 1;
1684 }
1685 mpu9250_interface_debug_print("mpu9250: set accelerometer range 4g.\n");
1686 res = mpu9250_get_accelerometer_range(&gs_handle, &range_a);
1687 if (res != 0)
1688 {
1689 mpu9250_interface_debug_print("mpu9250: get accelerometer range failed.\n");
1690 (void)mpu9250_deinit(&gs_handle);
1691
1692 return 1;
1693 }
1694 mpu9250_interface_debug_print("mpu9250: check accelerometer range %s.\n", range_a == MPU9250_ACCELEROMETER_RANGE_4G ? "ok" : "error");
1695
1696 /* 8g */
1697 res = mpu9250_set_accelerometer_range(&gs_handle, MPU9250_ACCELEROMETER_RANGE_8G);
1698 if (res != 0)
1699 {
1700 mpu9250_interface_debug_print("mpu9250: set accelerometer range failed.\n");
1701 (void)mpu9250_deinit(&gs_handle);
1702
1703 return 1;
1704 }
1705 mpu9250_interface_debug_print("mpu9250: set accelerometer range 8g.\n");
1706 res = mpu9250_get_accelerometer_range(&gs_handle, &range_a);
1707 if (res != 0)
1708 {
1709 mpu9250_interface_debug_print("mpu9250: get accelerometer range failed.\n");
1710 (void)mpu9250_deinit(&gs_handle);
1711
1712 return 1;
1713 }
1714 mpu9250_interface_debug_print("mpu9250: check accelerometer range %s.\n", range_a == MPU9250_ACCELEROMETER_RANGE_8G ? "ok" : "error");
1715
1716 /* 16g */
1717 res = mpu9250_set_accelerometer_range(&gs_handle, MPU9250_ACCELEROMETER_RANGE_16G);
1718 if (res != 0)
1719 {
1720 mpu9250_interface_debug_print("mpu9250: set accelerometer range failed.\n");
1721 (void)mpu9250_deinit(&gs_handle);
1722
1723 return 1;
1724 }
1725 mpu9250_interface_debug_print("mpu9250: set accelerometer range 16g.\n");
1726 res = mpu9250_get_accelerometer_range(&gs_handle, &range_a);
1727 if (res != 0)
1728 {
1729 mpu9250_interface_debug_print("mpu9250: get accelerometer range failed.\n");
1730 (void)mpu9250_deinit(&gs_handle);
1731
1732 return 1;
1733 }
1734 mpu9250_interface_debug_print("mpu9250: check accelerometer range %s.\n", range_a == MPU9250_ACCELEROMETER_RANGE_16G ? "ok" : "error");
1735
1736 /* mpu9250_set_fifo_enable/mpu9250_get_fifo_enable test */
1737 mpu9250_interface_debug_print("mpu9250: mpu9250_set_fifo_enable/mpu9250_get_fifo_enable test.\n");
1738
1739 /* set fifo temp enable */
1740 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_TEMP, MPU9250_BOOL_TRUE);
1741 if (res != 0)
1742 {
1743 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1744 (void)mpu9250_deinit(&gs_handle);
1745
1746 return 1;
1747 }
1748 mpu9250_interface_debug_print("mpu9250: set fifo temp enable.\n");
1749 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_TEMP, &enable);
1750 if (res != 0)
1751 {
1752 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1753 (void)mpu9250_deinit(&gs_handle);
1754
1755 return 1;
1756 }
1757 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1758
1759 /* set fifo temp disable */
1760 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_TEMP, MPU9250_BOOL_FALSE);
1761 if (res != 0)
1762 {
1763 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1764 (void)mpu9250_deinit(&gs_handle);
1765
1766 return 1;
1767 }
1768 mpu9250_interface_debug_print("mpu9250: set fifo temp disable.\n");
1769 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_TEMP, &enable);
1770 if (res != 0)
1771 {
1772 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1773 (void)mpu9250_deinit(&gs_handle);
1774
1775 return 1;
1776 }
1777 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1778
1779 /* set fifo gyroscope x enable */
1780 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_XG, MPU9250_BOOL_TRUE);
1781 if (res != 0)
1782 {
1783 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1784 (void)mpu9250_deinit(&gs_handle);
1785
1786 return 1;
1787 }
1788 mpu9250_interface_debug_print("mpu9250: set fifo gyroscope x enable.\n");
1789 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_XG, &enable);
1790 if (res != 0)
1791 {
1792 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1793 (void)mpu9250_deinit(&gs_handle);
1794
1795 return 1;
1796 }
1797 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1798
1799 /* set fifo gyroscope x disable */
1800 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_XG, MPU9250_BOOL_FALSE);
1801 if (res != 0)
1802 {
1803 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1804 (void)mpu9250_deinit(&gs_handle);
1805
1806 return 1;
1807 }
1808 mpu9250_interface_debug_print("mpu9250: set fifo gyroscope x disable.\n");
1809 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_XG, &enable);
1810 if (res != 0)
1811 {
1812 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1813 (void)mpu9250_deinit(&gs_handle);
1814
1815 return 1;
1816 }
1817 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1818
1819 /* set fifo gyroscope y enable */
1820 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_YG, MPU9250_BOOL_TRUE);
1821 if (res != 0)
1822 {
1823 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1824 (void)mpu9250_deinit(&gs_handle);
1825
1826 return 1;
1827 }
1828 mpu9250_interface_debug_print("mpu9250: set fifo gyroscope y enable.\n");
1829 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_YG, &enable);
1830 if (res != 0)
1831 {
1832 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1833 (void)mpu9250_deinit(&gs_handle);
1834
1835 return 1;
1836 }
1837 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1838
1839 /* set fifo gyroscope y disable */
1840 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_YG, MPU9250_BOOL_FALSE);
1841 if (res != 0)
1842 {
1843 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1844 (void)mpu9250_deinit(&gs_handle);
1845
1846 return 1;
1847 }
1848 mpu9250_interface_debug_print("mpu9250: set fifo gyroscope y disable.\n");
1849 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_YG, &enable);
1850 if (res != 0)
1851 {
1852 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1853 (void)mpu9250_deinit(&gs_handle);
1854
1855 return 1;
1856 }
1857 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1858
1859 /* set fifo gyroscope z enable */
1860 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ZG, MPU9250_BOOL_TRUE);
1861 if (res != 0)
1862 {
1863 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1864 (void)mpu9250_deinit(&gs_handle);
1865
1866 return 1;
1867 }
1868 mpu9250_interface_debug_print("mpu9250: set fifo gyroscope z enable.\n");
1869 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_ZG, &enable);
1870 if (res != 0)
1871 {
1872 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1873 (void)mpu9250_deinit(&gs_handle);
1874
1875 return 1;
1876 }
1877 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1878
1879 /* set fifo gyroscope z disable */
1880 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ZG, MPU9250_BOOL_FALSE);
1881 if (res != 0)
1882 {
1883 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1884 (void)mpu9250_deinit(&gs_handle);
1885
1886 return 1;
1887 }
1888 mpu9250_interface_debug_print("mpu9250: set fifo gyroscope z disable.\n");
1889 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_ZG, &enable);
1890 if (res != 0)
1891 {
1892 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1893 (void)mpu9250_deinit(&gs_handle);
1894
1895 return 1;
1896 }
1897 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1898
1899 /* set fifo accelerometer enable */
1900 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ACCEL, MPU9250_BOOL_TRUE);
1901 if (res != 0)
1902 {
1903 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1904 (void)mpu9250_deinit(&gs_handle);
1905
1906 return 1;
1907 }
1908 mpu9250_interface_debug_print("mpu9250: set fifo accelerometer enable.\n");
1909 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_ACCEL, &enable);
1910 if (res != 0)
1911 {
1912 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1913 (void)mpu9250_deinit(&gs_handle);
1914
1915 return 1;
1916 }
1917 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
1918
1919 /* set fifo accelerometer disable */
1920 res = mpu9250_set_fifo_enable(&gs_handle, MPU9250_FIFO_ACCEL, MPU9250_BOOL_FALSE);
1921 if (res != 0)
1922 {
1923 mpu9250_interface_debug_print("mpu9250: set fifo enable failed.\n");
1924 (void)mpu9250_deinit(&gs_handle);
1925
1926 return 1;
1927 }
1928 mpu9250_interface_debug_print("mpu9250: set fifo accelerometer disable.\n");
1929 res = mpu9250_get_fifo_enable(&gs_handle, MPU9250_FIFO_ACCEL, &enable);
1930 if (res != 0)
1931 {
1932 mpu9250_interface_debug_print("mpu9250: get fifo enable failed.\n");
1933 (void)mpu9250_deinit(&gs_handle);
1934
1935 return 1;
1936 }
1937 mpu9250_interface_debug_print("mpu9250: check fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
1938
1939 /* mpu9250_set_interrupt_level/mpu9250_get_interrupt_level test */
1940 mpu9250_interface_debug_print("mpu9250: mpu9250_set_interrupt_level/mpu9250_get_interrupt_level test.\n");
1941
1942 /* high level */
1943 res = mpu9250_set_interrupt_level(&gs_handle, MPU9250_PIN_LEVEL_HIGH);
1944 if (res != 0)
1945 {
1946 mpu9250_interface_debug_print("mpu9250: set interrupt level failed.\n");
1947 (void)mpu9250_deinit(&gs_handle);
1948
1949 return 1;
1950 }
1951 mpu9250_interface_debug_print("mpu9250: set interrupt high level.\n");
1952 res = mpu9250_get_interrupt_level(&gs_handle, &level);
1953 if (res != 0)
1954 {
1955 mpu9250_interface_debug_print("mpu9250: get interrupt level failed.\n");
1956 (void)mpu9250_deinit(&gs_handle);
1957
1958 return 1;
1959 }
1960 mpu9250_interface_debug_print("mpu9250: check interrupt level %s.\n", level == MPU9250_PIN_LEVEL_HIGH ? "ok" : "error");
1961
1962 /* low level */
1963 res = mpu9250_set_interrupt_level(&gs_handle, MPU9250_PIN_LEVEL_LOW);
1964 if (res != 0)
1965 {
1966 mpu9250_interface_debug_print("mpu9250: set interrupt level failed.\n");
1967 (void)mpu9250_deinit(&gs_handle);
1968
1969 return 1;
1970 }
1971 mpu9250_interface_debug_print("mpu9250: set interrupt low level.\n");
1972 res = mpu9250_get_interrupt_level(&gs_handle, &level);
1973 if (res != 0)
1974 {
1975 mpu9250_interface_debug_print("mpu9250: get interrupt level failed.\n");
1976 (void)mpu9250_deinit(&gs_handle);
1977
1978 return 1;
1979 }
1980 mpu9250_interface_debug_print("mpu9250: check interrupt level %s.\n", level == MPU9250_PIN_LEVEL_LOW ? "ok" : "error");
1981
1982 /* mpu9250_set_interrupt_pin_type/mpu9250_get_interrupt_pin_type test */
1983 mpu9250_interface_debug_print("mpu9250: mpu9250_set_interrupt_pin_type/mpu9250_get_interrupt_pin_type test.\n");
1984
1985 /* push-pull */
1986 res = mpu9250_set_interrupt_pin_type(&gs_handle, MPU9250_PIN_TYPE_PUSH_PULL);
1987 if (res != 0)
1988 {
1989 mpu9250_interface_debug_print("mpu9250: set interrupt pin type failed.\n");
1990 (void)mpu9250_deinit(&gs_handle);
1991
1992 return 1;
1993 }
1994 mpu9250_interface_debug_print("mpu9250: set interrupt pin type push pull.\n");
1995 res = mpu9250_get_interrupt_pin_type(&gs_handle, &pin);
1996 if (res != 0)
1997 {
1998 mpu9250_interface_debug_print("mpu9250: get interrupt pin type failed.\n");
1999 (void)mpu9250_deinit(&gs_handle);
2000
2001 return 1;
2002 }
2003 mpu9250_interface_debug_print("mpu9250: check interrupt pin type %s.\n", pin == MPU9250_PIN_TYPE_PUSH_PULL ? "ok" : "error");
2004
2005 /* open drain */
2006 res = mpu9250_set_interrupt_pin_type(&gs_handle, MPU9250_PIN_TYPE_OPEN_DRAIN);
2007 if (res != 0)
2008 {
2009 mpu9250_interface_debug_print("mpu9250: set interrupt pin type failed.\n");
2010 (void)mpu9250_deinit(&gs_handle);
2011
2012 return 1;
2013 }
2014 mpu9250_interface_debug_print("mpu9250: set interrupt pin type open drain.\n");
2015 res = mpu9250_get_interrupt_pin_type(&gs_handle, &pin);
2016 if (res != 0)
2017 {
2018 mpu9250_interface_debug_print("mpu9250: get interrupt pin type failed.\n");
2019 (void)mpu9250_deinit(&gs_handle);
2020
2021 return 1;
2022 }
2023 mpu9250_interface_debug_print("mpu9250: check interrupt pin type %s.\n", pin == MPU9250_PIN_TYPE_OPEN_DRAIN ? "ok" : "error");
2024
2025 /* mpu9250_set_interrupt_latch/mpu9250_get_interrupt_latch test */
2026 mpu9250_interface_debug_print("mpu9250: mpu9250_set_interrupt_latch/mpu9250_get_interrupt_latch test.\n");
2027
2028 /* enable latch */
2029 res = mpu9250_set_interrupt_latch(&gs_handle, MPU9250_BOOL_TRUE);
2030 if (res != 0)
2031 {
2032 mpu9250_interface_debug_print("mpu9250: set interrupt latch failed.\n");
2033 (void)mpu9250_deinit(&gs_handle);
2034
2035 return 1;
2036 }
2037 mpu9250_interface_debug_print("mpu9250: enable interrupt latch.\n");
2038 res = mpu9250_get_interrupt_latch(&gs_handle, &enable);
2039 if (res != 0)
2040 {
2041 mpu9250_interface_debug_print("mpu9250: get interrupt latch failed.\n");
2042 (void)mpu9250_deinit(&gs_handle);
2043
2044 return 1;
2045 }
2046 mpu9250_interface_debug_print("mpu9250: check interrupt latch %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2047
2048 /* disable latch */
2049 res = mpu9250_set_interrupt_latch(&gs_handle, MPU9250_BOOL_FALSE);
2050 if (res != 0)
2051 {
2052 mpu9250_interface_debug_print("mpu9250: set interrupt latch failed.\n");
2053 (void)mpu9250_deinit(&gs_handle);
2054
2055 return 1;
2056 }
2057 mpu9250_interface_debug_print("mpu9250: disable interrupt latch.\n");
2058 res = mpu9250_get_interrupt_latch(&gs_handle, &enable);
2059 if (res != 0)
2060 {
2061 mpu9250_interface_debug_print("mpu9250: get interrupt latch failed.\n");
2062 (void)mpu9250_deinit(&gs_handle);
2063
2064 return 1;
2065 }
2066 mpu9250_interface_debug_print("mpu9250: check interrupt latch %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2067
2068 /* mpu9250_set_interrupt_read_clear/mpu9250_get_interrupt_read_clear test */
2069 mpu9250_interface_debug_print("mpu9250: mpu9250_set_interrupt_read_clear/mpu9250_get_interrupt_read_clear test.\n");
2070
2071 /* enable interrupt read clear */
2072 res = mpu9250_set_interrupt_read_clear(&gs_handle, MPU9250_BOOL_TRUE);
2073 if (res != 0)
2074 {
2075 mpu9250_interface_debug_print("mpu9250: set interrupt read clear failed.\n");
2076 (void)mpu9250_deinit(&gs_handle);
2077
2078 return 1;
2079 }
2080 mpu9250_interface_debug_print("mpu9250: enable interrupt read clear.\n");
2081 res = mpu9250_get_interrupt_read_clear(&gs_handle, &enable);
2082 if (res != 0)
2083 {
2084 mpu9250_interface_debug_print("mpu9250: get interrupt read clear failed.\n");
2085 (void)mpu9250_deinit(&gs_handle);
2086
2087 return 1;
2088 }
2089 mpu9250_interface_debug_print("mpu9250: check interrupt read clear %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2090
2091 /* disable interrupt read clear */
2092 res = mpu9250_set_interrupt_read_clear(&gs_handle, MPU9250_BOOL_FALSE);
2093 if (res != 0)
2094 {
2095 mpu9250_interface_debug_print("mpu9250: set interrupt read clear failed.\n");
2096 (void)mpu9250_deinit(&gs_handle);
2097
2098 return 1;
2099 }
2100 mpu9250_interface_debug_print("mpu9250: disable interrupt read clear.\n");
2101 res = mpu9250_get_interrupt_read_clear(&gs_handle, &enable);
2102 if (res != 0)
2103 {
2104 mpu9250_interface_debug_print("mpu9250: get interrupt read clear failed.\n");
2105 (void)mpu9250_deinit(&gs_handle);
2106
2107 return 1;
2108 }
2109 mpu9250_interface_debug_print("mpu9250: check interrupt read clear %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2110
2111 /* mpu9250_set_fsync_interrupt_level/mpu9250_get_fsync_interrupt_level test */
2112 mpu9250_interface_debug_print("mpu9250: mpu9250_set_fsync_interrupt_level/mpu9250_get_fsync_interrupt_level test.\n");
2113
2114 /* set fsync interrupt level high */
2115 res = mpu9250_set_fsync_interrupt_level(&gs_handle, MPU9250_PIN_LEVEL_HIGH);
2116 if (res != 0)
2117 {
2118 mpu9250_interface_debug_print("mpu9250: set fsync interrupt level failed.\n");
2119 (void)mpu9250_deinit(&gs_handle);
2120
2121 return 1;
2122 }
2123 mpu9250_interface_debug_print("mpu9250: set fsync interrupt level high.\n");
2124 res = mpu9250_get_fsync_interrupt_level(&gs_handle, &level);
2125 if (res != 0)
2126 {
2127 mpu9250_interface_debug_print("mpu9250: get fsync interrupt level failed.\n");
2128 (void)mpu9250_deinit(&gs_handle);
2129
2130 return 1;
2131 }
2132 mpu9250_interface_debug_print("mpu9250: check fsync interrupt level %s.\n", level == MPU9250_PIN_LEVEL_HIGH ? "ok" : "error");
2133
2134 /* set fsync interrupt level low */
2135 res = mpu9250_set_fsync_interrupt_level(&gs_handle, MPU9250_PIN_LEVEL_LOW);
2136 if (res != 0)
2137 {
2138 mpu9250_interface_debug_print("mpu9250: set fsync interrupt level failed.\n");
2139 (void)mpu9250_deinit(&gs_handle);
2140
2141 return 1;
2142 }
2143 mpu9250_interface_debug_print("mpu9250: set fsync interrupt level low.\n");
2144 res = mpu9250_get_fsync_interrupt_level(&gs_handle, &level);
2145 if (res != 0)
2146 {
2147 mpu9250_interface_debug_print("mpu9250: get fsync interrupt level failed.\n");
2148 (void)mpu9250_deinit(&gs_handle);
2149
2150 return 1;
2151 }
2152 mpu9250_interface_debug_print("mpu9250: check fsync interrupt level %s.\n", level == MPU9250_PIN_LEVEL_LOW ? "ok" : "error");
2153
2154 /* mpu9250_set_fsync_interrupt/mpu9250_get_fsync_interrupt test */
2155 mpu9250_interface_debug_print("mpu9250: mpu9250_set_fsync_interrupt/mpu9250_get_fsync_interrupt test.\n");
2156
2157 /* enable fsync interrupt */
2158 res = mpu9250_set_fsync_interrupt(&gs_handle, MPU9250_BOOL_TRUE);
2159 if (res != 0)
2160 {
2161 mpu9250_interface_debug_print("mpu9250: set fsync interrupt failed.\n");
2162 (void)mpu9250_deinit(&gs_handle);
2163
2164 return 1;
2165 }
2166 mpu9250_interface_debug_print("mpu9250: enable fsync interrupt.\n");
2167 res = mpu9250_get_fsync_interrupt(&gs_handle, &enable);
2168 if (res != 0)
2169 {
2170 mpu9250_interface_debug_print("mpu9250: get fsync interrupt failed.\n");
2171 (void)mpu9250_deinit(&gs_handle);
2172
2173 return 1;
2174 }
2175 mpu9250_interface_debug_print("mpu9250: check fsync interrupt %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2176
2177 /* disable fsync interrupt */
2178 res = mpu9250_set_fsync_interrupt(&gs_handle, MPU9250_BOOL_FALSE);
2179 if (res != 0)
2180 {
2181 mpu9250_interface_debug_print("mpu9250: set fsync interrupt failed.\n");
2182 (void)mpu9250_deinit(&gs_handle);
2183
2184 return 1;
2185 }
2186 mpu9250_interface_debug_print("mpu9250: disable fsync interrupt.\n");
2187 res = mpu9250_get_fsync_interrupt(&gs_handle, &enable);
2188 if (res != 0)
2189 {
2190 mpu9250_interface_debug_print("mpu9250: get fsync interrupt failed.\n");
2191 (void)mpu9250_deinit(&gs_handle);
2192
2193 return 1;
2194 }
2195 mpu9250_interface_debug_print("mpu9250: check fsync interrupt %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2196
2197 /* mpu9250_set_iic_bypass/mpu9250_get_iic_bypass test */
2198 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_bypass/mpu9250_get_iic_bypass test.\n");
2199
2200 /* enable iic bypass */
2201 res = mpu9250_set_iic_bypass(&gs_handle, MPU9250_BOOL_TRUE);
2202 if (res != 0)
2203 {
2204 mpu9250_interface_debug_print("mpu9250: set iic bypass failed.\n");
2205 (void)mpu9250_deinit(&gs_handle);
2206
2207 return 1;
2208 }
2209 mpu9250_interface_debug_print("mpu9250: enable iic bypass.\n");
2210 res = mpu9250_get_iic_bypass(&gs_handle, &enable);
2211 if (res != 0)
2212 {
2213 mpu9250_interface_debug_print("mpu9250: get iic bypass failed.\n");
2214 (void)mpu9250_deinit(&gs_handle);
2215
2216 return 1;
2217 }
2218 mpu9250_interface_debug_print("mpu9250: check iic bypass %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2219
2220 /* disable iic bypass */
2221 res = mpu9250_set_iic_bypass(&gs_handle, MPU9250_BOOL_FALSE);
2222 if (res != 0)
2223 {
2224 mpu9250_interface_debug_print("mpu9250: set iic bypass failed.\n");
2225 (void)mpu9250_deinit(&gs_handle);
2226
2227 return 1;
2228 }
2229 mpu9250_interface_debug_print("mpu9250: disable iic bypass.\n");
2230 res = mpu9250_get_iic_bypass(&gs_handle, &enable);
2231 if (res != 0)
2232 {
2233 mpu9250_interface_debug_print("mpu9250: get iic bypass failed.\n");
2234 (void)mpu9250_deinit(&gs_handle);
2235
2236 return 1;
2237 }
2238 mpu9250_interface_debug_print("mpu9250: check iic bypass %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2239
2240 /* mpu9250_set_interrupt/mpu9250_get_interrupt test */
2241 mpu9250_interface_debug_print("mpu9250: mpu9250_set_interrupt/mpu9250_get_interrupt test.\n");
2242
2243 /* enable motion interrupt */
2244 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_MOTION, MPU9250_BOOL_TRUE);
2245 if (res != 0)
2246 {
2247 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2248 (void)mpu9250_deinit(&gs_handle);
2249
2250 return 1;
2251 }
2252 mpu9250_interface_debug_print("mpu9250: enable motion interrupt.\n");
2253 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_MOTION, &enable);
2254 if (res != 0)
2255 {
2256 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2257 (void)mpu9250_deinit(&gs_handle);
2258
2259 return 1;
2260 }
2261 mpu9250_interface_debug_print("mpu9250: check motion interrupt %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2262
2263 /* disable motion interrupt */
2264 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_MOTION, MPU9250_BOOL_FALSE);
2265 if (res != 0)
2266 {
2267 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2268 (void)mpu9250_deinit(&gs_handle);
2269
2270 return 1;
2271 }
2272 mpu9250_interface_debug_print("mpu9250: disable motion interrupt.\n");
2273 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_MOTION, &enable);
2274 if (res != 0)
2275 {
2276 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2277 (void)mpu9250_deinit(&gs_handle);
2278
2279 return 1;
2280 }
2281 mpu9250_interface_debug_print("mpu9250: check motion interrupt %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2282
2283 /* enable fifo overflow interrupt */
2284 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FIFO_OVERFLOW, MPU9250_BOOL_TRUE);
2285 if (res != 0)
2286 {
2287 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2288 (void)mpu9250_deinit(&gs_handle);
2289
2290 return 1;
2291 }
2292 mpu9250_interface_debug_print("mpu9250: enable fifo overflow interrupt.\n");
2293 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_FIFO_OVERFLOW, &enable);
2294 if (res != 0)
2295 {
2296 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2297 (void)mpu9250_deinit(&gs_handle);
2298
2299 return 1;
2300 }
2301 mpu9250_interface_debug_print("mpu9250: check fifo overflow interrupt %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2302
2303 /* disable fifo overflow interrupt */
2304 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FIFO_OVERFLOW, MPU9250_BOOL_FALSE);
2305 if (res != 0)
2306 {
2307 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2308 (void)mpu9250_deinit(&gs_handle);
2309
2310 return 1;
2311 }
2312 mpu9250_interface_debug_print("mpu9250: disable fifo overflow interrupt.\n");
2313 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_FIFO_OVERFLOW, &enable);
2314 if (res != 0)
2315 {
2316 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2317 (void)mpu9250_deinit(&gs_handle);
2318
2319 return 1;
2320 }
2321 mpu9250_interface_debug_print("mpu9250: check fifo overflow interrupt %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2322
2323 /* enable dmp interrupt */
2324 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DMP, MPU9250_BOOL_TRUE);
2325 if (res != 0)
2326 {
2327 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2328 (void)mpu9250_deinit(&gs_handle);
2329
2330 return 1;
2331 }
2332 mpu9250_interface_debug_print("mpu9250: enable dmp interrupt.\n");
2333 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_DMP, &enable);
2334 if (res != 0)
2335 {
2336 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2337 (void)mpu9250_deinit(&gs_handle);
2338
2339 return 1;
2340 }
2341 mpu9250_interface_debug_print("mpu9250: check dmp interrupt %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2342
2343 /* disable dmp interrupt */
2344 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DMP, MPU9250_BOOL_FALSE);
2345 if (res != 0)
2346 {
2347 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2348 (void)mpu9250_deinit(&gs_handle);
2349
2350 return 1;
2351 }
2352 mpu9250_interface_debug_print("mpu9250: disable dmp interrupt.\n");
2353 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_DMP, &enable);
2354 if (res != 0)
2355 {
2356 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2357 (void)mpu9250_deinit(&gs_handle);
2358
2359 return 1;
2360 }
2361 mpu9250_interface_debug_print("mpu9250: check dmp interrupt %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2362
2363 /* enable fsync init interrupt */
2364 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FSYNC_INT, MPU9250_BOOL_TRUE);
2365 if (res != 0)
2366 {
2367 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2368 (void)mpu9250_deinit(&gs_handle);
2369
2370 return 1;
2371 }
2372 mpu9250_interface_debug_print("mpu9250: enable fsync init interrupt.\n");
2373 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_FSYNC_INT, &enable);
2374 if (res != 0)
2375 {
2376 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2377 (void)mpu9250_deinit(&gs_handle);
2378
2379 return 1;
2380 }
2381 mpu9250_interface_debug_print("mpu9250: check fsync init interrupt %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2382
2383 /* disable fsync init interrupt */
2384 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_FSYNC_INT, MPU9250_BOOL_FALSE);
2385 if (res != 0)
2386 {
2387 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2388 (void)mpu9250_deinit(&gs_handle);
2389
2390 return 1;
2391 }
2392 mpu9250_interface_debug_print("mpu9250: disable fsync init interrupt.\n");
2393 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_FSYNC_INT, &enable);
2394 if (res != 0)
2395 {
2396 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2397 (void)mpu9250_deinit(&gs_handle);
2398
2399 return 1;
2400 }
2401 mpu9250_interface_debug_print("mpu9250: check fsync init interrupt %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2402
2403 /* enable data ready interrupt */
2404 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DATA_READY, MPU9250_BOOL_TRUE);
2405 if (res != 0)
2406 {
2407 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2408 (void)mpu9250_deinit(&gs_handle);
2409
2410 return 1;
2411 }
2412 mpu9250_interface_debug_print("mpu9250: enable data ready interrupt.\n");
2413 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_DATA_READY, &enable);
2414 if (res != 0)
2415 {
2416 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2417 (void)mpu9250_deinit(&gs_handle);
2418
2419 return 1;
2420 }
2421 mpu9250_interface_debug_print("mpu9250: check data ready interrupt %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2422
2423 /* disable data ready interrupt */
2424 res = mpu9250_set_interrupt(&gs_handle, MPU9250_INTERRUPT_DATA_READY, MPU9250_BOOL_FALSE);
2425 if (res != 0)
2426 {
2427 mpu9250_interface_debug_print("mpu9250: set interrupt failed.\n");
2428 (void)mpu9250_deinit(&gs_handle);
2429
2430 return 1;
2431 }
2432 mpu9250_interface_debug_print("mpu9250: disable data ready interrupt.\n");
2433 res = mpu9250_get_interrupt(&gs_handle, MPU9250_INTERRUPT_DATA_READY, &enable);
2434 if (res != 0)
2435 {
2436 mpu9250_interface_debug_print("mpu9250: get interrupt failed.\n");
2437 (void)mpu9250_deinit(&gs_handle);
2438
2439 return 1;
2440 }
2441 mpu9250_interface_debug_print("mpu9250: check data ready interrupt %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
2442
2443 /* mpu9250_get_interrupt_status test */
2444 mpu9250_interface_debug_print("mpu9250: mpu9250_get_interrupt_status test.\n");
2445
2446 /* get interrupt status */
2447 res = mpu9250_get_interrupt_status(&gs_handle, &status);
2448 if (res != 0)
2449 {
2450 mpu9250_interface_debug_print("mpu9250: get interrupt status failed.\n");
2451 (void)mpu9250_deinit(&gs_handle);
2452
2453 return 1;
2454 }
2455 mpu9250_interface_debug_print("mpu9250: get interrupt status 0x%02x.\n", status);
2456
2457 /* mpu9250_set_gyroscope_x_test/mpu9250_get_gyroscope_x_test test */
2458 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyroscope_x_test/mpu9250_get_gyroscope_x_test test.\n");
2459
2460 test = rand() % 0x20;
2461 res = mpu9250_set_gyroscope_x_test(&gs_handle, test);
2462 if (res != 0)
2463 {
2464 mpu9250_interface_debug_print("mpu9250: set gyroscope x test failed.\n");
2465 (void)mpu9250_deinit(&gs_handle);
2466
2467 return 1;
2468 }
2469 mpu9250_interface_debug_print("mpu9250: set gyroscope x test 0x%02X.\n", test);
2470 res = mpu9250_get_gyroscope_x_test(&gs_handle, &test_check);
2471 if (res != 0)
2472 {
2473 mpu9250_interface_debug_print("mpu9250: get gyroscope x test failed.\n");
2474 (void)mpu9250_deinit(&gs_handle);
2475
2476 return 1;
2477 }
2478 mpu9250_interface_debug_print("mpu9250: check gyroscope x test %s.\n", test == test_check ? "ok" : "error");
2479
2480 /* mpu9250_set_gyroscope_y_test/mpu9250_get_gyroscope_y_test test */
2481 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyroscope_y_test/mpu9250_get_gyroscope_y_test test.\n");
2482
2483 test = rand() % 0x20;
2484 res = mpu9250_set_gyroscope_y_test(&gs_handle, test);
2485 if (res != 0)
2486 {
2487 mpu9250_interface_debug_print("mpu9250: set gyroscope y test failed.\n");
2488 (void)mpu9250_deinit(&gs_handle);
2489
2490 return 1;
2491 }
2492 mpu9250_interface_debug_print("mpu9250: set gyroscope y test 0x%02X.\n", test);
2493 res = mpu9250_get_gyroscope_y_test(&gs_handle, &test_check);
2494 if (res != 0)
2495 {
2496 mpu9250_interface_debug_print("mpu9250: get gyroscope y test failed.\n");
2497 (void)mpu9250_deinit(&gs_handle);
2498
2499 return 1;
2500 }
2501 mpu9250_interface_debug_print("mpu9250: check gyroscope y test %s.\n", test == test_check ? "ok" : "error");
2502
2503 /* mpu9250_set_gyroscope_z_test/mpu9250_get_gyroscope_z_test test */
2504 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyroscope_z_test/mpu9250_get_gyroscope_z_test test.\n");
2505
2506 test = rand() % 0x20;
2507 res = mpu9250_set_gyroscope_z_test(&gs_handle, test);
2508 if (res != 0)
2509 {
2510 mpu9250_interface_debug_print("mpu9250: set gyroscope z test failed.\n");
2511 (void)mpu9250_deinit(&gs_handle);
2512
2513 return 1;
2514 }
2515 mpu9250_interface_debug_print("mpu9250: set gyroscope z test 0x%02X.\n", test);
2516 res = mpu9250_get_gyroscope_z_test(&gs_handle, &test_check);
2517 if (res != 0)
2518 {
2519 mpu9250_interface_debug_print("mpu9250: get gyroscope z test failed.\n");
2520 (void)mpu9250_deinit(&gs_handle);
2521
2522 return 1;
2523 }
2524 mpu9250_interface_debug_print("mpu9250: check gyroscope z test %s.\n", test == test_check ? "ok" : "error");
2525
2526 /* mpu9250_set_accelerometer_x_test/mpu9250_get_accelerometer_x_test test */
2527 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_x_test/mpu9250_get_accelerometer_x_test test.\n");
2528
2529 test = rand() % 0x20;
2530 res = mpu9250_set_accelerometer_x_test(&gs_handle, test);
2531 if (res != 0)
2532 {
2533 mpu9250_interface_debug_print("mpu9250: set accelerometer x test failed.\n");
2534 (void)mpu9250_deinit(&gs_handle);
2535
2536 return 1;
2537 }
2538 mpu9250_interface_debug_print("mpu9250: set accelerometer x test 0x%02X.\n", test);
2539 res = mpu9250_get_accelerometer_x_test(&gs_handle, &test_check);
2540 if (res != 0)
2541 {
2542 mpu9250_interface_debug_print("mpu9250: get accelerometer x test failed.\n");
2543 (void)mpu9250_deinit(&gs_handle);
2544
2545 return 1;
2546 }
2547 mpu9250_interface_debug_print("mpu9250: check accelerometer x test %s.\n", test == test_check ? "ok" : "error");
2548
2549 /* mpu9250_set_accelerometer_y_test/mpu9250_get_accelerometer_y_test test */
2550 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_y_test/mpu9250_get_accelerometer_y_test test.\n");
2551
2552 test = rand() % 0x20;
2553 res = mpu9250_set_accelerometer_y_test(&gs_handle, test);
2554 if (res != 0)
2555 {
2556 mpu9250_interface_debug_print("mpu9250: set accelerometer y test failed.\n");
2557 (void)mpu9250_deinit(&gs_handle);
2558
2559 return 1;
2560 }
2561 mpu9250_interface_debug_print("mpu9250: set accelerometer y test 0x%02X.\n", test);
2562 res = mpu9250_get_accelerometer_y_test(&gs_handle, &test_check);
2563 if (res != 0)
2564 {
2565 mpu9250_interface_debug_print("mpu9250: get accelerometer y test failed.\n");
2566 (void)mpu9250_deinit(&gs_handle);
2567
2568 return 1;
2569 }
2570 mpu9250_interface_debug_print("mpu9250: check accelerometer y test %s.\n", test == test_check ? "ok" : "error");
2571
2572 /* mpu9250_set_accelerometer_z_test/mpu9250_get_accelerometer_z_test test */
2573 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_z_test/mpu9250_get_accelerometer_z_test test.\n");
2574
2575 test = rand() % 0x20;
2576 res = mpu9250_set_accelerometer_z_test(&gs_handle, test);
2577 if (res != 0)
2578 {
2579 mpu9250_interface_debug_print("mpu9250: set accelerometer z test failed.\n");
2580 (void)mpu9250_deinit(&gs_handle);
2581
2582 return 1;
2583 }
2584 mpu9250_interface_debug_print("mpu9250: set accelerometer z test 0x%02X.\n", test);
2585 res = mpu9250_get_accelerometer_z_test(&gs_handle, &test_check);
2586 if (res != 0)
2587 {
2588 mpu9250_interface_debug_print("mpu9250: get accelerometer z test failed.\n");
2589 (void)mpu9250_deinit(&gs_handle);
2590
2591 return 1;
2592 }
2593 mpu9250_interface_debug_print("mpu9250: check accelerometer z test %s.\n", test == test_check ? "ok" : "error");
2594
2595 /* mpu9250_set_motion_threshold/mpu9250_get_motion_threshold test */
2596 mpu9250_interface_debug_print("mpu9250: mpu9250_set_motion_threshold/mpu9250_get_motion_threshold test.\n");
2597
2598 test = rand() % 256;
2599 res = mpu9250_set_motion_threshold(&gs_handle, test);
2600 if (res != 0)
2601 {
2602 mpu9250_interface_debug_print("mpu9250: set motion threshold failed.\n");
2603 (void)mpu9250_deinit(&gs_handle);
2604
2605 return 1;
2606 }
2607 mpu9250_interface_debug_print("mpu9250: set motion threshold 0x%02X.\n", test);
2608 res = mpu9250_get_motion_threshold(&gs_handle, &test_check);
2609 if (res != 0)
2610 {
2611 mpu9250_interface_debug_print("mpu9250: get motion threshold failed.\n");
2612 (void)mpu9250_deinit(&gs_handle);
2613
2614 return 1;
2615 }
2616 mpu9250_interface_debug_print("mpu9250: check motion threshold %s.\n", test == test_check ? "ok" : "error");
2617
2618 /* mpu9250_motion_threshold_convert_to_register/mpu9250_motion_threshold_convert_to_data test */
2619 mpu9250_interface_debug_print("mpu9250: mpu9250_motion_threshold_convert_to_register/mpu9250_motion_threshold_convert_to_data test.\n");
2620
2621 test_f = (rand() % 10000) / 10.0f + 32.0f;
2622 res = mpu9250_motion_threshold_convert_to_register(&gs_handle, test_f, &reg);
2623 if (res != 0)
2624 {
2625 mpu9250_interface_debug_print("mpu9250: motion threshold convert to register failed.\n");
2626 (void)mpu9250_deinit(&gs_handle);
2627
2628 return 1;
2629 }
2630 mpu9250_interface_debug_print("mpu9250: motion threshold convert to register %0.2f.\n", test_f);
2631 res = mpu9250_motion_threshold_convert_to_data(&gs_handle, reg, &test_check_f);
2632 if (res != 0)
2633 {
2634 mpu9250_interface_debug_print("mpu9250: motion threshold convert to data failed.\n");
2635 (void)mpu9250_deinit(&gs_handle);
2636
2637 return 1;
2638 }
2639 mpu9250_interface_debug_print("mpu9250: check motion threshold %0.2f.\n", test_check_f);
2640
2641 /* mpu9250_set_iic_clock/mpu9250_get_iic_clock test */
2642 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_clock/mpu9250_get_iic_clock test.\n");
2643
2644 /* 348 kHz */
2645 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_348_KHZ);
2646 if (res != 0)
2647 {
2648 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2649 (void)mpu9250_deinit(&gs_handle);
2650
2651 return 1;
2652 }
2653 mpu9250_interface_debug_print("mpu9250: set iic clock 348 kHz.\n");
2654 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2655 if (res != 0)
2656 {
2657 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2658 (void)mpu9250_deinit(&gs_handle);
2659
2660 return 1;
2661 }
2662 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_348_KHZ ? "ok" : "error");
2663
2664 /* 333 kHz */
2665 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_333_KHZ);
2666 if (res != 0)
2667 {
2668 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2669 (void)mpu9250_deinit(&gs_handle);
2670
2671 return 1;
2672 }
2673 mpu9250_interface_debug_print("mpu9250: set iic clock 333 kHz.\n");
2674 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2675 if (res != 0)
2676 {
2677 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2678 (void)mpu9250_deinit(&gs_handle);
2679
2680 return 1;
2681 }
2682 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_333_KHZ ? "ok" : "error");
2683
2684 /* 320 kHz */
2685 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_320_KHZ);
2686 if (res != 0)
2687 {
2688 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2689 (void)mpu9250_deinit(&gs_handle);
2690
2691 return 1;
2692 }
2693 mpu9250_interface_debug_print("mpu9250: set iic clock 320 kHz.\n");
2694 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2695 if (res != 0)
2696 {
2697 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2698 (void)mpu9250_deinit(&gs_handle);
2699
2700 return 1;
2701 }
2702 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_320_KHZ ? "ok" : "error");
2703
2704 /* 308 kHz */
2705 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_308_KHZ);
2706 if (res != 0)
2707 {
2708 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2709 (void)mpu9250_deinit(&gs_handle);
2710
2711 return 1;
2712 }
2713 mpu9250_interface_debug_print("mpu9250: set iic clock 308 kHz.\n");
2714 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2715 if (res != 0)
2716 {
2717 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2718 (void)mpu9250_deinit(&gs_handle);
2719
2720 return 1;
2721 }
2722 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_308_KHZ ? "ok" : "error");
2723
2724 /* 296 kHz */
2725 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_296_KHZ);
2726 if (res != 0)
2727 {
2728 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2729 (void)mpu9250_deinit(&gs_handle);
2730
2731 return 1;
2732 }
2733 mpu9250_interface_debug_print("mpu9250: set iic clock 296 kHz.\n");
2734 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2735 if (res != 0)
2736 {
2737 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2738 (void)mpu9250_deinit(&gs_handle);
2739
2740 return 1;
2741 }
2742 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_296_KHZ ? "ok" : "error");
2743
2744 /* 286 kHz */
2745 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_286_KHZ);
2746 if (res != 0)
2747 {
2748 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2749 (void)mpu9250_deinit(&gs_handle);
2750
2751 return 1;
2752 }
2753 mpu9250_interface_debug_print("mpu9250: set iic clock 286 kHz.\n");
2754 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2755 if (res != 0)
2756 {
2757 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2758 (void)mpu9250_deinit(&gs_handle);
2759
2760 return 1;
2761 }
2762 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_286_KHZ ? "ok" : "error");
2763
2764 /* 276 kHz */
2765 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_276_KHZ);
2766 if (res != 0)
2767 {
2768 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2769 (void)mpu9250_deinit(&gs_handle);
2770
2771 return 1;
2772 }
2773 mpu9250_interface_debug_print("mpu9250: set iic clock 276 kHz.\n");
2774 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2775 if (res != 0)
2776 {
2777 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2778 (void)mpu9250_deinit(&gs_handle);
2779
2780 return 1;
2781 }
2782 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_276_KHZ ? "ok" : "error");
2783
2784 /* 267 kHz */
2785 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_267_KHZ);
2786 if (res != 0)
2787 {
2788 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2789 (void)mpu9250_deinit(&gs_handle);
2790
2791 return 1;
2792 }
2793 mpu9250_interface_debug_print("mpu9250: set iic clock 267 kHz.\n");
2794 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2795 if (res != 0)
2796 {
2797 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2798 (void)mpu9250_deinit(&gs_handle);
2799
2800 return 1;
2801 }
2802 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_267_KHZ ? "ok" : "error");
2803
2804 /* 258 kHz */
2805 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_258_KHZ);
2806 if (res != 0)
2807 {
2808 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2809 (void)mpu9250_deinit(&gs_handle);
2810
2811 return 1;
2812 }
2813 mpu9250_interface_debug_print("mpu9250: set iic clock 258 kHz.\n");
2814 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2815 if (res != 0)
2816 {
2817 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2818 (void)mpu9250_deinit(&gs_handle);
2819
2820 return 1;
2821 }
2822 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_258_KHZ ? "ok" : "error");
2823
2824 /* 500 kHz */
2825 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_500_KHZ);
2826 if (res != 0)
2827 {
2828 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2829 (void)mpu9250_deinit(&gs_handle);
2830
2831 return 1;
2832 }
2833 mpu9250_interface_debug_print("mpu9250: set iic clock 500 kHz.\n");
2834 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2835 if (res != 0)
2836 {
2837 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2838 (void)mpu9250_deinit(&gs_handle);
2839
2840 return 1;
2841 }
2842 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_500_KHZ ? "ok" : "error");
2843
2844 /* 471 kHz */
2845 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_471_KHZ);
2846 if (res != 0)
2847 {
2848 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2849 (void)mpu9250_deinit(&gs_handle);
2850
2851 return 1;
2852 }
2853 mpu9250_interface_debug_print("mpu9250: set iic clock 471 kHz.\n");
2854 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2855 if (res != 0)
2856 {
2857 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2858 (void)mpu9250_deinit(&gs_handle);
2859
2860 return 1;
2861 }
2862 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_471_KHZ ? "ok" : "error");
2863
2864 /* 444 kHz */
2865 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_444_KHZ);
2866 if (res != 0)
2867 {
2868 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2869 (void)mpu9250_deinit(&gs_handle);
2870
2871 return 1;
2872 }
2873 mpu9250_interface_debug_print("mpu9250: set iic clock 444 kHz.\n");
2874 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2875 if (res != 0)
2876 {
2877 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2878 (void)mpu9250_deinit(&gs_handle);
2879
2880 return 1;
2881 }
2882 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_444_KHZ ? "ok" : "error");
2883
2884 /* 421 kHz */
2885 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_421_KHZ);
2886 if (res != 0)
2887 {
2888 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2889 (void)mpu9250_deinit(&gs_handle);
2890
2891 return 1;
2892 }
2893 mpu9250_interface_debug_print("mpu9250: set iic clock 421 kHz.\n");
2894 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2895 if (res != 0)
2896 {
2897 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2898 (void)mpu9250_deinit(&gs_handle);
2899
2900 return 1;
2901 }
2902 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_421_KHZ ? "ok" : "error");
2903
2904 /* 400 kHz */
2905 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_400_KHZ);
2906 if (res != 0)
2907 {
2908 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2909 (void)mpu9250_deinit(&gs_handle);
2910
2911 return 1;
2912 }
2913 mpu9250_interface_debug_print("mpu9250: set iic clock 400 kHz.\n");
2914 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2915 if (res != 0)
2916 {
2917 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2918 (void)mpu9250_deinit(&gs_handle);
2919
2920 return 1;
2921 }
2922 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_400_KHZ ? "ok" : "error");
2923
2924 /* 381 kHz */
2925 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_381_KHZ);
2926 if (res != 0)
2927 {
2928 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2929 (void)mpu9250_deinit(&gs_handle);
2930
2931 return 1;
2932 }
2933 mpu9250_interface_debug_print("mpu9250: set iic clock 381 kHz.\n");
2934 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2935 if (res != 0)
2936 {
2937 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2938 (void)mpu9250_deinit(&gs_handle);
2939
2940 return 1;
2941 }
2942 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_381_KHZ ? "ok" : "error");
2943
2944 /* 364 kHz */
2945 res = mpu9250_set_iic_clock(&gs_handle, MPU9250_IIC_CLOCK_364_KHZ);
2946 if (res != 0)
2947 {
2948 mpu9250_interface_debug_print("mpu9250: set iic clock failed.\n");
2949 (void)mpu9250_deinit(&gs_handle);
2950
2951 return 1;
2952 }
2953 mpu9250_interface_debug_print("mpu9250: set iic clock 364 kHz.\n");
2954 res = mpu9250_get_iic_clock(&gs_handle, &clk);
2955 if (res != 0)
2956 {
2957 mpu9250_interface_debug_print("mpu9250: get iic clock failed.\n");
2958 (void)mpu9250_deinit(&gs_handle);
2959
2960 return 1;
2961 }
2962 mpu9250_interface_debug_print("mpu9250: check iic clock %s.\n", clk == MPU9250_IIC_CLOCK_364_KHZ ? "ok" : "error");
2963
2964 /* mpu9250_set_iic_multi_master/mpu9250_get_iic_multi_master test */
2965 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_multi_master/mpu9250_get_iic_multi_master test.\n");
2966
2967 /* enable multi master */
2968 res = mpu9250_set_iic_multi_master(&gs_handle, MPU9250_BOOL_TRUE);
2969 if (res != 0)
2970 {
2971 mpu9250_interface_debug_print("mpu9250: set iic multi master failed.\n");
2972 (void)mpu9250_deinit(&gs_handle);
2973
2974 return 1;
2975 }
2976 mpu9250_interface_debug_print("mpu9250: enable iic multi master.\n");
2977 res = mpu9250_get_iic_multi_master(&gs_handle, &enable);
2978 if (res != 0)
2979 {
2980 mpu9250_interface_debug_print("mpu9250: get iic multi master failed.\n");
2981 (void)mpu9250_deinit(&gs_handle);
2982
2983 return 1;
2984 }
2985 mpu9250_interface_debug_print("mpu9250: check iic multi master %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
2986
2987 /* disable multi master */
2988 res = mpu9250_set_iic_multi_master(&gs_handle, MPU9250_BOOL_FALSE);
2989 if (res != 0)
2990 {
2991 mpu9250_interface_debug_print("mpu9250: set iic multi master failed.\n");
2992 (void)mpu9250_deinit(&gs_handle);
2993
2994 return 1;
2995 }
2996 mpu9250_interface_debug_print("mpu9250: disable iic multi master.\n");
2997 res = mpu9250_get_iic_multi_master(&gs_handle, &enable);
2998 if (res != 0)
2999 {
3000 mpu9250_interface_debug_print("mpu9250: get iic multi master failed.\n");
3001 (void)mpu9250_deinit(&gs_handle);
3002
3003 return 1;
3004 }
3005 mpu9250_interface_debug_print("mpu9250: check iic multi master %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3006
3007 /* mpu9250_set_iic_wait_for_external_sensor/mpu9250_get_iic_wait_for_external_sensor test */
3008 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_wait_for_external_sensor/mpu9250_get_iic_wait_for_external_sensor test.\n");
3009
3010 /* enable iic wait for external sensor */
3011 res = mpu9250_set_iic_wait_for_external_sensor(&gs_handle, MPU9250_BOOL_TRUE);
3012 if (res != 0)
3013 {
3014 mpu9250_interface_debug_print("mpu9250: set iic wait for external sensor failed.\n");
3015 (void)mpu9250_deinit(&gs_handle);
3016
3017 return 1;
3018 }
3019 mpu9250_interface_debug_print("mpu9250: enable iic wait for external sensor.\n");
3020 res = mpu9250_get_iic_wait_for_external_sensor(&gs_handle, &enable);
3021 if (res != 0)
3022 {
3023 mpu9250_interface_debug_print("mpu9250: get iic wait for external sensor failed.\n");
3024 (void)mpu9250_deinit(&gs_handle);
3025
3026 return 1;
3027 }
3028 mpu9250_interface_debug_print("mpu9250: check iic wait for external sensor %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3029
3030 /* disable iic wait for external sensor */
3031 res = mpu9250_set_iic_wait_for_external_sensor(&gs_handle, MPU9250_BOOL_FALSE);
3032 if (res != 0)
3033 {
3034 mpu9250_interface_debug_print("mpu9250: set iic wait for external sensor failed.\n");
3035 (void)mpu9250_deinit(&gs_handle);
3036
3037 return 1;
3038 }
3039 mpu9250_interface_debug_print("mpu9250: disable iic wait for external sensor.\n");
3040 res = mpu9250_get_iic_wait_for_external_sensor(&gs_handle, &enable);
3041 if (res != 0)
3042 {
3043 mpu9250_interface_debug_print("mpu9250: get iic wait for external sensor failed.\n");
3044 (void)mpu9250_deinit(&gs_handle);
3045
3046 return 1;
3047 }
3048 mpu9250_interface_debug_print("mpu9250: check iic wait for external sensor %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3049
3050 /* mpu9250_set_iic_read_mode/mpu9250_get_iic_read_mode test */
3051 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_read_mode/mpu9250_get_iic_read_mode test.\n");
3052
3053 /* restart read mode */
3054 res = mpu9250_set_iic_read_mode(&gs_handle, MPU9250_IIC_READ_MODE_RESTART);
3055 if (res != 0)
3056 {
3057 mpu9250_interface_debug_print("mpu9250: set iic read mode failed.\n");
3058 (void)mpu9250_deinit(&gs_handle);
3059
3060 return 1;
3061 }
3062 mpu9250_interface_debug_print("mpu9250: set restart read mode.\n");
3063 res = mpu9250_get_iic_read_mode(&gs_handle, &read_mode);
3064 if (res != 0)
3065 {
3066 mpu9250_interface_debug_print("mpu9250: get iic read mode failed.\n");
3067 (void)mpu9250_deinit(&gs_handle);
3068
3069 return 1;
3070 }
3071 mpu9250_interface_debug_print("mpu9250: check iic read mode %s.\n", read_mode == MPU9250_IIC_READ_MODE_RESTART ? "ok" : "error");
3072
3073 /* stop and start read mode */
3074 res = mpu9250_set_iic_read_mode(&gs_handle, MPU9250_IIC_READ_MODE_STOP_AND_START);
3075 if (res != 0)
3076 {
3077 mpu9250_interface_debug_print("mpu9250: set iic read mode failed.\n");
3078 (void)mpu9250_deinit(&gs_handle);
3079
3080 return 1;
3081 }
3082 mpu9250_interface_debug_print("mpu9250: set stop and start read mode.\n");
3083 res = mpu9250_get_iic_read_mode(&gs_handle, &read_mode);
3084 if (res != 0)
3085 {
3086 mpu9250_interface_debug_print("mpu9250: get iic read mode failed.\n");
3087 (void)mpu9250_deinit(&gs_handle);
3088
3089 return 1;
3090 }
3091 mpu9250_interface_debug_print("mpu9250: check iic read mode %s.\n", read_mode == MPU9250_IIC_READ_MODE_STOP_AND_START ? "ok" : "error");
3092
3093 /* mpu9250_set_iic_fifo_enable/mpu9250_get_iic_fifo_enable test */
3094 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_fifo_enable/mpu9250_get_iic_fifo_enable test.\n");
3095
3096 /* enable iic fifo slave0 */
3097 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_BOOL_TRUE);
3098 if (res != 0)
3099 {
3100 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3101 (void)mpu9250_deinit(&gs_handle);
3102
3103 return 1;
3104 }
3105 mpu9250_interface_debug_print("mpu9250: enable iic fifo slave0.\n");
3106 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_0, &enable);
3107 if (res != 0)
3108 {
3109 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3110 (void)mpu9250_deinit(&gs_handle);
3111
3112 return 1;
3113 }
3114 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3115
3116 /* disable iic fifo slave0 */
3117 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_BOOL_FALSE);
3118 if (res != 0)
3119 {
3120 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3121 (void)mpu9250_deinit(&gs_handle);
3122
3123 return 1;
3124 }
3125 mpu9250_interface_debug_print("mpu9250: disable iic fifo slave0.\n");
3126 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_0, &enable);
3127 if (res != 0)
3128 {
3129 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3130 (void)mpu9250_deinit(&gs_handle);
3131
3132 return 1;
3133 }
3134 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3135
3136 /* enable iic fifo slave1 */
3137 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_BOOL_TRUE);
3138 if (res != 0)
3139 {
3140 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3141 (void)mpu9250_deinit(&gs_handle);
3142
3143 return 1;
3144 }
3145 mpu9250_interface_debug_print("mpu9250: enable iic fifo slave1.\n");
3146 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_1, &enable);
3147 if (res != 0)
3148 {
3149 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3150 (void)mpu9250_deinit(&gs_handle);
3151
3152 return 1;
3153 }
3154 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3155
3156 /* disable iic fifo slave1 */
3157 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_BOOL_FALSE);
3158 if (res != 0)
3159 {
3160 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3161 (void)mpu9250_deinit(&gs_handle);
3162
3163 return 1;
3164 }
3165 mpu9250_interface_debug_print("mpu9250: disable iic fifo slave1.\n");
3166 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_1, &enable);
3167 if (res != 0)
3168 {
3169 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3170 (void)mpu9250_deinit(&gs_handle);
3171
3172 return 1;
3173 }
3174 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3175
3176 /* enable iic fifo slave2 */
3177 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_BOOL_TRUE);
3178 if (res != 0)
3179 {
3180 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3181 (void)mpu9250_deinit(&gs_handle);
3182
3183 return 1;
3184 }
3185 mpu9250_interface_debug_print("mpu9250: enable iic fifo slave2.\n");
3186 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_2, &enable);
3187 if (res != 0)
3188 {
3189 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3190 (void)mpu9250_deinit(&gs_handle);
3191
3192 return 1;
3193 }
3194 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3195
3196 /* disable iic fifo slave2 */
3197 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_BOOL_FALSE);
3198 if (res != 0)
3199 {
3200 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3201 (void)mpu9250_deinit(&gs_handle);
3202
3203 return 1;
3204 }
3205 mpu9250_interface_debug_print("mpu9250: disable iic fifo slave2.\n");
3206 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_2, &enable);
3207 if (res != 0)
3208 {
3209 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3210 (void)mpu9250_deinit(&gs_handle);
3211
3212 return 1;
3213 }
3214 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3215
3216 /* enable iic fifo slave3 */
3217 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_BOOL_TRUE);
3218 if (res != 0)
3219 {
3220 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3221 (void)mpu9250_deinit(&gs_handle);
3222
3223 return 1;
3224 }
3225 mpu9250_interface_debug_print("mpu9250: enable iic fifo slave3.\n");
3226 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_3, &enable);
3227 if (res != 0)
3228 {
3229 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3230 (void)mpu9250_deinit(&gs_handle);
3231
3232 return 1;
3233 }
3234 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3235
3236 /* disable iic fifo slave3 */
3237 res = mpu9250_set_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_BOOL_FALSE);
3238 if (res != 0)
3239 {
3240 mpu9250_interface_debug_print("mpu9250: set iic fifo enable failed.\n");
3241 (void)mpu9250_deinit(&gs_handle);
3242
3243 return 1;
3244 }
3245 mpu9250_interface_debug_print("mpu9250: disable iic fifo slave3.\n");
3246 res = mpu9250_get_iic_fifo_enable(&gs_handle, MPU9250_IIC_SLAVE_3, &enable);
3247 if (res != 0)
3248 {
3249 mpu9250_interface_debug_print("mpu9250: get iic fifo enable failed.\n");
3250 (void)mpu9250_deinit(&gs_handle);
3251
3252 return 1;
3253 }
3254 mpu9250_interface_debug_print("mpu9250: check iic fifo enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3255
3256 /* mpu9250_set_iic_mode/mpu9250_get_iic_mode test */
3257 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_mode/mpu9250_get_iic_mode test.\n");
3258
3259 /* write mode */
3260 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_IIC_MODE_WRITE);
3261 if (res != 0)
3262 {
3263 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3264 (void)mpu9250_deinit(&gs_handle);
3265
3266 return 1;
3267 }
3268 mpu9250_interface_debug_print("mpu9250: set slave0 iic write mode.\n");
3269 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_0, &mode);
3270 if (res != 0)
3271 {
3272 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3273 (void)mpu9250_deinit(&gs_handle);
3274
3275 return 1;
3276 }
3277 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_WRITE ? "ok" : "error");
3278
3279 /* read mode */
3280 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_IIC_MODE_READ);
3281 if (res != 0)
3282 {
3283 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3284 (void)mpu9250_deinit(&gs_handle);
3285
3286 return 1;
3287 }
3288 mpu9250_interface_debug_print("mpu9250: set slave0 iic read mode.\n");
3289 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_0, &mode);
3290 if (res != 0)
3291 {
3292 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3293 (void)mpu9250_deinit(&gs_handle);
3294
3295 return 1;
3296 }
3297 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_READ ? "ok" : "error");
3298
3299 /* write mode */
3300 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_IIC_MODE_WRITE);
3301 if (res != 0)
3302 {
3303 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3304 (void)mpu9250_deinit(&gs_handle);
3305
3306 return 1;
3307 }
3308 mpu9250_interface_debug_print("mpu9250: set slave1 iic write mode.\n");
3309 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_1, &mode);
3310 if (res != 0)
3311 {
3312 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3313 (void)mpu9250_deinit(&gs_handle);
3314
3315 return 1;
3316 }
3317 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_WRITE ? "ok" : "error");
3318
3319 /* read mode */
3320 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_IIC_MODE_READ);
3321 if (res != 0)
3322 {
3323 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3324 (void)mpu9250_deinit(&gs_handle);
3325
3326 return 1;
3327 }
3328 mpu9250_interface_debug_print("mpu9250: set slave1 iic read mode.\n");
3329 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_1, &mode);
3330 if (res != 0)
3331 {
3332 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3333 (void)mpu9250_deinit(&gs_handle);
3334
3335 return 1;
3336 }
3337 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_READ ? "ok" : "error");
3338
3339 /* write mode */
3340 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_IIC_MODE_WRITE);
3341 if (res != 0)
3342 {
3343 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3344 (void)mpu9250_deinit(&gs_handle);
3345
3346 return 1;
3347 }
3348 mpu9250_interface_debug_print("mpu9250: set slave2 iic write mode.\n");
3349 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_2, &mode);
3350 if (res != 0)
3351 {
3352 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3353 (void)mpu9250_deinit(&gs_handle);
3354
3355 return 1;
3356 }
3357 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_WRITE ? "ok" : "error");
3358
3359 /* read mode */
3360 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_IIC_MODE_READ);
3361 if (res != 0)
3362 {
3363 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3364 (void)mpu9250_deinit(&gs_handle);
3365
3366 return 1;
3367 }
3368 mpu9250_interface_debug_print("mpu9250: set slave2 iic read mode.\n");
3369 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_2, &mode);
3370 if (res != 0)
3371 {
3372 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3373 (void)mpu9250_deinit(&gs_handle);
3374
3375 return 1;
3376 }
3377 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_READ ? "ok" : "error");
3378
3379 /* write mode */
3380 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_IIC_MODE_WRITE);
3381 if (res != 0)
3382 {
3383 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3384 (void)mpu9250_deinit(&gs_handle);
3385
3386 return 1;
3387 }
3388 mpu9250_interface_debug_print("mpu9250: set slave3 iic write mode.\n");
3389 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_3, &mode);
3390 if (res != 0)
3391 {
3392 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3393 (void)mpu9250_deinit(&gs_handle);
3394
3395 return 1;
3396 }
3397 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_WRITE ? "ok" : "error");
3398
3399 /* read mode */
3400 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_IIC_MODE_READ);
3401 if (res != 0)
3402 {
3403 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3404 (void)mpu9250_deinit(&gs_handle);
3405
3406 return 1;
3407 }
3408 mpu9250_interface_debug_print("mpu9250: set slave3 iic read mode.\n");
3409 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_3, &mode);
3410 if (res != 0)
3411 {
3412 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3413 (void)mpu9250_deinit(&gs_handle);
3414
3415 return 1;
3416 }
3417 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_READ ? "ok" : "error");
3418
3419 /* write mode */
3420 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_4, MPU9250_IIC_MODE_WRITE);
3421 if (res != 0)
3422 {
3423 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3424 (void)mpu9250_deinit(&gs_handle);
3425
3426 return 1;
3427 }
3428 mpu9250_interface_debug_print("mpu9250: set slave4 iic write mode.\n");
3429 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_4, &mode);
3430 if (res != 0)
3431 {
3432 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3433 (void)mpu9250_deinit(&gs_handle);
3434
3435 return 1;
3436 }
3437 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_WRITE ? "ok" : "error");
3438
3439 /* read mode */
3440 res = mpu9250_set_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_4, MPU9250_IIC_MODE_READ);
3441 if (res != 0)
3442 {
3443 mpu9250_interface_debug_print("mpu9250: set iic mode failed.\n");
3444 (void)mpu9250_deinit(&gs_handle);
3445
3446 return 1;
3447 }
3448 mpu9250_interface_debug_print("mpu9250: set slave4 iic read mode.\n");
3449 res = mpu9250_get_iic_mode(&gs_handle, MPU9250_IIC_SLAVE_4, &mode);
3450 if (res != 0)
3451 {
3452 mpu9250_interface_debug_print("mpu9250: get iic mode failed.\n");
3453 (void)mpu9250_deinit(&gs_handle);
3454
3455 return 1;
3456 }
3457 mpu9250_interface_debug_print("mpu9250: check iic mode %s.\n", mode == MPU9250_IIC_MODE_READ ? "ok" : "error");
3458
3459 /* mpu9250_set_iic_address/mpu9250_get_iic_address test */
3460 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_address/mpu9250_get_iic_address test.\n");
3461
3462 /* slave0 */
3463 test = rand() % 0x7F;
3464 res = mpu9250_set_iic_address(&gs_handle, MPU9250_IIC_SLAVE_0, test);
3465 if (res != 0)
3466 {
3467 mpu9250_interface_debug_print("mpu9250: set iic address failed.\n");
3468 (void)mpu9250_deinit(&gs_handle);
3469
3470 return 1;
3471 }
3472 mpu9250_interface_debug_print("mpu9250: set slave0 iic address 0x%02X.\n", test);
3473 res = mpu9250_get_iic_address(&gs_handle, MPU9250_IIC_SLAVE_0, &test_check);
3474 if (res != 0)
3475 {
3476 mpu9250_interface_debug_print("mpu9250: get iic address failed.\n");
3477 (void)mpu9250_deinit(&gs_handle);
3478
3479 return 1;
3480 }
3481 mpu9250_interface_debug_print("mpu9250: check iic address %s.\n", test_check == test ? "ok" : "error");
3482
3483 /* slave1 */
3484 test = rand() % 0x7F;
3485 res = mpu9250_set_iic_address(&gs_handle, MPU9250_IIC_SLAVE_1, test);
3486 if (res != 0)
3487 {
3488 mpu9250_interface_debug_print("mpu9250: set iic address failed.\n");
3489 (void)mpu9250_deinit(&gs_handle);
3490
3491 return 1;
3492 }
3493 mpu9250_interface_debug_print("mpu9250: set slave1 iic address 0x%02X.\n", test);
3494 res = mpu9250_get_iic_address(&gs_handle, MPU9250_IIC_SLAVE_1, &test_check);
3495 if (res != 0)
3496 {
3497 mpu9250_interface_debug_print("mpu9250: get iic address failed.\n");
3498 (void)mpu9250_deinit(&gs_handle);
3499
3500 return 1;
3501 }
3502 mpu9250_interface_debug_print("mpu9250: check iic address %s.\n", test_check == test ? "ok" : "error");
3503
3504 /* slave2 */
3505 test = rand() % 0x7F;
3506 res = mpu9250_set_iic_address(&gs_handle, MPU9250_IIC_SLAVE_2, test);
3507 if (res != 0)
3508 {
3509 mpu9250_interface_debug_print("mpu9250: set iic address failed.\n");
3510 (void)mpu9250_deinit(&gs_handle);
3511
3512 return 1;
3513 }
3514 mpu9250_interface_debug_print("mpu9250: set slave2 iic address 0x%02X.\n", test);
3515 res = mpu9250_get_iic_address(&gs_handle, MPU9250_IIC_SLAVE_2, &test_check);
3516 if (res != 0)
3517 {
3518 mpu9250_interface_debug_print("mpu9250: get iic address failed.\n");
3519 (void)mpu9250_deinit(&gs_handle);
3520
3521 return 1;
3522 }
3523 mpu9250_interface_debug_print("mpu9250: check iic address %s.\n", test_check == test ? "ok" : "error");
3524
3525 /* slave3 */
3526 test = rand() % 0x7F;
3527 res = mpu9250_set_iic_address(&gs_handle, MPU9250_IIC_SLAVE_3, test);
3528 if (res != 0)
3529 {
3530 mpu9250_interface_debug_print("mpu9250: set iic address failed.\n");
3531 (void)mpu9250_deinit(&gs_handle);
3532
3533 return 1;
3534 }
3535 mpu9250_interface_debug_print("mpu9250: set slave3 iic address 0x%02X.\n", test);
3536 res = mpu9250_get_iic_address(&gs_handle, MPU9250_IIC_SLAVE_3, &test_check);
3537 if (res != 0)
3538 {
3539 mpu9250_interface_debug_print("mpu9250: get iic address failed.\n");
3540 (void)mpu9250_deinit(&gs_handle);
3541
3542 return 1;
3543 }
3544 mpu9250_interface_debug_print("mpu9250: check iic address %s.\n", test_check == test ? "ok" : "error");
3545
3546 /* slave4 */
3547 test = rand() % 0x7F;
3548 res = mpu9250_set_iic_address(&gs_handle, MPU9250_IIC_SLAVE_4, test);
3549 if (res != 0)
3550 {
3551 mpu9250_interface_debug_print("mpu9250: set iic address failed.\n");
3552 (void)mpu9250_deinit(&gs_handle);
3553
3554 return 1;
3555 }
3556 mpu9250_interface_debug_print("mpu9250: set slave4 iic address 0x%02X.\n", test);
3557 res = mpu9250_get_iic_address(&gs_handle, MPU9250_IIC_SLAVE_4, &test_check);
3558 if (res != 0)
3559 {
3560 mpu9250_interface_debug_print("mpu9250: get iic address failed.\n");
3561 (void)mpu9250_deinit(&gs_handle);
3562
3563 return 1;
3564 }
3565 mpu9250_interface_debug_print("mpu9250: check iic address %s.\n", test_check == test ? "ok" : "error");
3566
3567 /* mpu9250_set_iic_register/mpu9250_get_iic_register test */
3568 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_register/mpu9250_get_iic_register test.\n");
3569
3570 /* slave0 */
3571 test = rand() % 256;
3572 res = mpu9250_set_iic_register(&gs_handle, MPU9250_IIC_SLAVE_0, test);
3573 if (res != 0)
3574 {
3575 mpu9250_interface_debug_print("mpu9250: set iic register failed.\n");
3576 (void)mpu9250_deinit(&gs_handle);
3577
3578 return 1;
3579 }
3580 mpu9250_interface_debug_print("mpu9250: set slave0 iic register 0x%02X.\n", test);
3581 res = mpu9250_get_iic_register(&gs_handle, MPU9250_IIC_SLAVE_0, &test_check);
3582 if (res != 0)
3583 {
3584 mpu9250_interface_debug_print("mpu9250: get iic register failed.\n");
3585 (void)mpu9250_deinit(&gs_handle);
3586
3587 return 1;
3588 }
3589 mpu9250_interface_debug_print("mpu9250: check iic register %s.\n", test_check == test ? "ok" : "error");
3590
3591 /* slave1 */
3592 test = rand() % 256;
3593 res = mpu9250_set_iic_register(&gs_handle, MPU9250_IIC_SLAVE_1, test);
3594 if (res != 0)
3595 {
3596 mpu9250_interface_debug_print("mpu9250: set iic register failed.\n");
3597 (void)mpu9250_deinit(&gs_handle);
3598
3599 return 1;
3600 }
3601 mpu9250_interface_debug_print("mpu9250: set slave1 iic register 0x%02X.\n", test);
3602 res = mpu9250_get_iic_register(&gs_handle, MPU9250_IIC_SLAVE_1, &test_check);
3603 if (res != 0)
3604 {
3605 mpu9250_interface_debug_print("mpu9250: get iic register failed.\n");
3606 (void)mpu9250_deinit(&gs_handle);
3607
3608 return 1;
3609 }
3610 mpu9250_interface_debug_print("mpu9250: check iic register %s.\n", test_check == test ? "ok" : "error");
3611
3612 /* slave2 */
3613 test = rand() % 256;
3614 res = mpu9250_set_iic_register(&gs_handle, MPU9250_IIC_SLAVE_2, test);
3615 if (res != 0)
3616 {
3617 mpu9250_interface_debug_print("mpu9250: set iic register failed.\n");
3618 (void)mpu9250_deinit(&gs_handle);
3619
3620 return 1;
3621 }
3622 mpu9250_interface_debug_print("mpu9250: set slave2 iic register 0x%02X.\n", test);
3623 res = mpu9250_get_iic_register(&gs_handle, MPU9250_IIC_SLAVE_2, &test_check);
3624 if (res != 0)
3625 {
3626 mpu9250_interface_debug_print("mpu9250: get iic register failed.\n");
3627 (void)mpu9250_deinit(&gs_handle);
3628
3629 return 1;
3630 }
3631 mpu9250_interface_debug_print("mpu9250: check iic register %s.\n", test_check == test ? "ok" : "error");
3632
3633 /* slave3 */
3634 test = rand() % 256;
3635 res = mpu9250_set_iic_register(&gs_handle, MPU9250_IIC_SLAVE_3, test);
3636 if (res != 0)
3637 {
3638 mpu9250_interface_debug_print("mpu9250: set iic register failed.\n");
3639 (void)mpu9250_deinit(&gs_handle);
3640
3641 return 1;
3642 }
3643 mpu9250_interface_debug_print("mpu9250: set slave3 iic register 0x%02X.\n", test);
3644 res = mpu9250_get_iic_register(&gs_handle, MPU9250_IIC_SLAVE_3, &test_check);
3645 if (res != 0)
3646 {
3647 mpu9250_interface_debug_print("mpu9250: get iic register failed.\n");
3648 (void)mpu9250_deinit(&gs_handle);
3649
3650 return 1;
3651 }
3652 mpu9250_interface_debug_print("mpu9250: check iic register %s.\n", test_check == test ? "ok" : "error");
3653
3654 /* slave4 */
3655 test = rand() % 256;
3656 res = mpu9250_set_iic_register(&gs_handle, MPU9250_IIC_SLAVE_4, test);
3657 if (res != 0)
3658 {
3659 mpu9250_interface_debug_print("mpu9250: set iic register failed.\n");
3660 (void)mpu9250_deinit(&gs_handle);
3661
3662 return 1;
3663 }
3664 mpu9250_interface_debug_print("mpu9250: set slave4 iic register 0x%02X.\n", test);
3665 res = mpu9250_get_iic_register(&gs_handle, MPU9250_IIC_SLAVE_4, &test_check);
3666 if (res != 0)
3667 {
3668 mpu9250_interface_debug_print("mpu9250: get iic register failed.\n");
3669 (void)mpu9250_deinit(&gs_handle);
3670
3671 return 1;
3672 }
3673 mpu9250_interface_debug_print("mpu9250: check iic register %s.\n", test_check == test ? "ok" : "error");
3674
3675 /* mpu9250_set_iic_data_out/mpu9250_get_iic_data_out test */
3676 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_data_out/mpu9250_get_iic_data_out test.\n");
3677
3678 /* slave0 */
3679 test = rand() % 256;
3680 res = mpu9250_set_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_0, test);
3681 if (res != 0)
3682 {
3683 mpu9250_interface_debug_print("mpu9250: set iic data out failed.\n");
3684 (void)mpu9250_deinit(&gs_handle);
3685
3686 return 1;
3687 }
3688 mpu9250_interface_debug_print("mpu9250: set slave0 iic data out 0x%02X.\n", test);
3689 res = mpu9250_get_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_0, &test_check);
3690 if (res != 0)
3691 {
3692 mpu9250_interface_debug_print("mpu9250: get iic data out failed.\n");
3693 (void)mpu9250_deinit(&gs_handle);
3694
3695 return 1;
3696 }
3697 mpu9250_interface_debug_print("mpu9250: check iic data out %s.\n", test_check == test ? "ok" : "error");
3698
3699 /* slave1 */
3700 test = rand() % 256;
3701 res = mpu9250_set_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_1, test);
3702 if (res != 0)
3703 {
3704 mpu9250_interface_debug_print("mpu9250: set iic data out failed.\n");
3705 (void)mpu9250_deinit(&gs_handle);
3706
3707 return 1;
3708 }
3709 mpu9250_interface_debug_print("mpu9250: set slave1 iic data out 0x%02X.\n", test);
3710 res = mpu9250_get_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_1, &test_check);
3711 if (res != 0)
3712 {
3713 mpu9250_interface_debug_print("mpu9250: get iic data out failed.\n");
3714 (void)mpu9250_deinit(&gs_handle);
3715
3716 return 1;
3717 }
3718 mpu9250_interface_debug_print("mpu9250: check iic data out %s.\n", test_check == test ? "ok" : "error");
3719
3720 /* slave2 */
3721 test = rand() % 256;
3722 res = mpu9250_set_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_2, test);
3723 if (res != 0)
3724 {
3725 mpu9250_interface_debug_print("mpu9250: set iic data out failed.\n");
3726 (void)mpu9250_deinit(&gs_handle);
3727
3728 return 1;
3729 }
3730 mpu9250_interface_debug_print("mpu9250: set slave2 iic data out 0x%02X.\n", test);
3731 res = mpu9250_get_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_2, &test_check);
3732 if (res != 0)
3733 {
3734 mpu9250_interface_debug_print("mpu9250: get iic data out failed.\n");
3735 (void)mpu9250_deinit(&gs_handle);
3736
3737 return 1;
3738 }
3739 mpu9250_interface_debug_print("mpu9250: check iic data out %s.\n", test_check == test ? "ok" : "error");
3740
3741 /* slave3 */
3742 test = rand() % 256;
3743 res = mpu9250_set_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_3, test);
3744 if (res != 0)
3745 {
3746 mpu9250_interface_debug_print("mpu9250: set iic data out failed.\n");
3747 (void)mpu9250_deinit(&gs_handle);
3748
3749 return 1;
3750 }
3751 mpu9250_interface_debug_print("mpu9250: set slave3 iic data out 0x%02X.\n", test);
3752 res = mpu9250_get_iic_data_out(&gs_handle, MPU9250_IIC_SLAVE_3, &test_check);
3753 if (res != 0)
3754 {
3755 mpu9250_interface_debug_print("mpu9250: get iic data out failed.\n");
3756 (void)mpu9250_deinit(&gs_handle);
3757
3758 return 1;
3759 }
3760 mpu9250_interface_debug_print("mpu9250: check iic data out %s.\n", test_check == test ? "ok" : "error");
3761
3762 /* mpu9250_set_iic_enable/mpu9250_get_iic_enable test */
3763 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_enable/mpu9250_get_iic_enable test.\n");
3764
3765 /* slave0 iic enable */
3766 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_BOOL_TRUE);
3767 if (res != 0)
3768 {
3769 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3770 (void)mpu9250_deinit(&gs_handle);
3771
3772 return 1;
3773 }
3774 mpu9250_interface_debug_print("mpu9250: slave0 iic enable.\n");
3775 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_0, &enable);
3776 if (res != 0)
3777 {
3778 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3779 (void)mpu9250_deinit(&gs_handle);
3780
3781 return 1;
3782 }
3783 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3784
3785 /* slave0 iic disable */
3786 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_BOOL_FALSE);
3787 if (res != 0)
3788 {
3789 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3790 (void)mpu9250_deinit(&gs_handle);
3791
3792 return 1;
3793 }
3794 mpu9250_interface_debug_print("mpu9250: slave0 iic disable.\n");
3795 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_0, &enable);
3796 if (res != 0)
3797 {
3798 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3799 (void)mpu9250_deinit(&gs_handle);
3800
3801 return 1;
3802 }
3803 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3804
3805 /* slave1 iic enable */
3806 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_BOOL_TRUE);
3807 if (res != 0)
3808 {
3809 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3810 (void)mpu9250_deinit(&gs_handle);
3811
3812 return 1;
3813 }
3814 mpu9250_interface_debug_print("mpu9250: slave1 iic enable.\n");
3815 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_1, &enable);
3816 if (res != 0)
3817 {
3818 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3819 (void)mpu9250_deinit(&gs_handle);
3820
3821 return 1;
3822 }
3823 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3824
3825 /* slave1 iic disable */
3826 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_BOOL_FALSE);
3827 if (res != 0)
3828 {
3829 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3830 (void)mpu9250_deinit(&gs_handle);
3831
3832 return 1;
3833 }
3834 mpu9250_interface_debug_print("mpu9250: slave1 iic disable.\n");
3835 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_1, &enable);
3836 if (res != 0)
3837 {
3838 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3839 (void)mpu9250_deinit(&gs_handle);
3840
3841 return 1;
3842 }
3843 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3844
3845 /* slave2 iic enable */
3846 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_BOOL_TRUE);
3847 if (res != 0)
3848 {
3849 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3850 (void)mpu9250_deinit(&gs_handle);
3851
3852 return 1;
3853 }
3854 mpu9250_interface_debug_print("mpu9250: slave2 iic enable.\n");
3855 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_2, &enable);
3856 if (res != 0)
3857 {
3858 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3859 (void)mpu9250_deinit(&gs_handle);
3860
3861 return 1;
3862 }
3863 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3864
3865 /* slave2 iic disable */
3866 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_BOOL_FALSE);
3867 if (res != 0)
3868 {
3869 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3870 (void)mpu9250_deinit(&gs_handle);
3871
3872 return 1;
3873 }
3874 mpu9250_interface_debug_print("mpu9250: slave2 iic disable.\n");
3875 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_2, &enable);
3876 if (res != 0)
3877 {
3878 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3879 (void)mpu9250_deinit(&gs_handle);
3880
3881 return 1;
3882 }
3883 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3884
3885 /* slave3 iic enable */
3886 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_BOOL_TRUE);
3887 if (res != 0)
3888 {
3889 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3890 (void)mpu9250_deinit(&gs_handle);
3891
3892 return 1;
3893 }
3894 mpu9250_interface_debug_print("mpu9250: slave3 iic enable.\n");
3895 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_3, &enable);
3896 if (res != 0)
3897 {
3898 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3899 (void)mpu9250_deinit(&gs_handle);
3900
3901 return 1;
3902 }
3903 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3904
3905 /* slave3 iic disable */
3906 res = mpu9250_set_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_BOOL_FALSE);
3907 if (res != 0)
3908 {
3909 mpu9250_interface_debug_print("mpu9250: set iic enable failed.\n");
3910 (void)mpu9250_deinit(&gs_handle);
3911
3912 return 1;
3913 }
3914 mpu9250_interface_debug_print("mpu9250: slave3 iic disable.\n");
3915 res = mpu9250_get_iic_enable(&gs_handle, MPU9250_IIC_SLAVE_3, &enable);
3916 if (res != 0)
3917 {
3918 mpu9250_interface_debug_print("mpu9250: get iic enable failed.\n");
3919 (void)mpu9250_deinit(&gs_handle);
3920
3921 return 1;
3922 }
3923 mpu9250_interface_debug_print("mpu9250: check iic enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3924
3925 /* mpu9250_set_iic_byte_swap/mpu9250_get_iic_byte_swap test */
3926 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_byte_swap/mpu9250_get_iic_byte_swap test.\n");
3927
3928 /* enable slave0 byte swap */
3929 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_BOOL_TRUE);
3930 if (res != 0)
3931 {
3932 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
3933 (void)mpu9250_deinit(&gs_handle);
3934
3935 return 1;
3936 }
3937 mpu9250_interface_debug_print("mpu9250: enable slave0 byte swap.\n");
3938 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_0, &enable);
3939 if (res != 0)
3940 {
3941 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
3942 (void)mpu9250_deinit(&gs_handle);
3943
3944 return 1;
3945 }
3946 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3947
3948 /* disable slave0 byte swap */
3949 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_BOOL_FALSE);
3950 if (res != 0)
3951 {
3952 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
3953 (void)mpu9250_deinit(&gs_handle);
3954
3955 return 1;
3956 }
3957 mpu9250_interface_debug_print("mpu9250: disable slave0 byte swap.\n");
3958 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_0, &enable);
3959 if (res != 0)
3960 {
3961 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
3962 (void)mpu9250_deinit(&gs_handle);
3963
3964 return 1;
3965 }
3966 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
3967
3968 /* enable slave1 byte swap */
3969 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_BOOL_TRUE);
3970 if (res != 0)
3971 {
3972 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
3973 (void)mpu9250_deinit(&gs_handle);
3974
3975 return 1;
3976 }
3977 mpu9250_interface_debug_print("mpu9250: enable slave1 byte swap.\n");
3978 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_1, &enable);
3979 if (res != 0)
3980 {
3981 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
3982 (void)mpu9250_deinit(&gs_handle);
3983
3984 return 1;
3985 }
3986 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
3987
3988 /* disable slave1 byte swap */
3989 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_BOOL_FALSE);
3990 if (res != 0)
3991 {
3992 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
3993 (void)mpu9250_deinit(&gs_handle);
3994
3995 return 1;
3996 }
3997 mpu9250_interface_debug_print("mpu9250: disable slave1 byte swap.\n");
3998 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_1, &enable);
3999 if (res != 0)
4000 {
4001 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
4002 (void)mpu9250_deinit(&gs_handle);
4003
4004 return 1;
4005 }
4006 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4007
4008 /* enable slave2 byte swap */
4009 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_BOOL_TRUE);
4010 if (res != 0)
4011 {
4012 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
4013 (void)mpu9250_deinit(&gs_handle);
4014
4015 return 1;
4016 }
4017 mpu9250_interface_debug_print("mpu9250: enable slave2 byte swap.\n");
4018 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_2, &enable);
4019 if (res != 0)
4020 {
4021 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
4022 (void)mpu9250_deinit(&gs_handle);
4023
4024 return 1;
4025 }
4026 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4027
4028 /* disable slave2 byte swap */
4029 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_BOOL_FALSE);
4030 if (res != 0)
4031 {
4032 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
4033 (void)mpu9250_deinit(&gs_handle);
4034
4035 return 1;
4036 }
4037 mpu9250_interface_debug_print("mpu9250: disable slave2 byte swap.\n");
4038 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_2, &enable);
4039 if (res != 0)
4040 {
4041 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
4042 (void)mpu9250_deinit(&gs_handle);
4043
4044 return 1;
4045 }
4046 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4047
4048 /* enable slave3 byte swap */
4049 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_BOOL_TRUE);
4050 if (res != 0)
4051 {
4052 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
4053 (void)mpu9250_deinit(&gs_handle);
4054
4055 return 1;
4056 }
4057 mpu9250_interface_debug_print("mpu9250: enable slave3 byte swap.\n");
4058 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_3, &enable);
4059 if (res != 0)
4060 {
4061 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
4062 (void)mpu9250_deinit(&gs_handle);
4063
4064 return 1;
4065 }
4066 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4067
4068 /* disable slave3 byte swap */
4069 res = mpu9250_set_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_BOOL_FALSE);
4070 if (res != 0)
4071 {
4072 mpu9250_interface_debug_print("mpu9250: set iic byte swap failed.\n");
4073 (void)mpu9250_deinit(&gs_handle);
4074
4075 return 1;
4076 }
4077 mpu9250_interface_debug_print("mpu9250: disable slave3 byte swap.\n");
4078 res = mpu9250_get_iic_byte_swap(&gs_handle, MPU9250_IIC_SLAVE_3, &enable);
4079 if (res != 0)
4080 {
4081 mpu9250_interface_debug_print("mpu9250: get iic byte swap failed.\n");
4082 (void)mpu9250_deinit(&gs_handle);
4083
4084 return 1;
4085 }
4086 mpu9250_interface_debug_print("mpu9250: check iic byte swap %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4087
4088 /* mpu9250_set_iic_transaction_mode/mpu9250_get_iic_transaction_mode test */
4089 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_transaction_mode/mpu9250_get_iic_transaction_mode test.\n");
4090
4091 /* set slave0 data transaction mode */
4092 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_IIC_TRANSACTION_MODE_DATA);
4093 if (res != 0)
4094 {
4095 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4096 (void)mpu9250_deinit(&gs_handle);
4097
4098 return 1;
4099 }
4100 mpu9250_interface_debug_print("mpu9250: set slave0 data transaction mode.\n");
4101 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_0, &tran_mode);
4102 if (res != 0)
4103 {
4104 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4105 (void)mpu9250_deinit(&gs_handle);
4106
4107 return 1;
4108 }
4109 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_DATA ? "ok" : "error");
4110
4111 /* set slave0 reg data transaction mode */
4112 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_IIC_TRANSACTION_MODE_REG_DATA);
4113 if (res != 0)
4114 {
4115 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4116 (void)mpu9250_deinit(&gs_handle);
4117
4118 return 1;
4119 }
4120 mpu9250_interface_debug_print("mpu9250: set slave0 reg data transaction mode.\n");
4121 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_0, &tran_mode);
4122 if (res != 0)
4123 {
4124 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4125 (void)mpu9250_deinit(&gs_handle);
4126
4127 return 1;
4128 }
4129 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_REG_DATA ? "ok" : "error");
4130
4131 /* set slave1 data transaction mode */
4132 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_IIC_TRANSACTION_MODE_DATA);
4133 if (res != 0)
4134 {
4135 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4136 (void)mpu9250_deinit(&gs_handle);
4137
4138 return 1;
4139 }
4140 mpu9250_interface_debug_print("mpu9250: set slave1 data transaction mode.\n");
4141 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_1, &tran_mode);
4142 if (res != 0)
4143 {
4144 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4145 (void)mpu9250_deinit(&gs_handle);
4146
4147 return 1;
4148 }
4149 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_DATA ? "ok" : "error");
4150
4151 /* set slave1 reg data transaction mode */
4152 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_IIC_TRANSACTION_MODE_REG_DATA);
4153 if (res != 0)
4154 {
4155 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4156 (void)mpu9250_deinit(&gs_handle);
4157
4158 return 1;
4159 }
4160 mpu9250_interface_debug_print("mpu9250: set slave1 reg data transaction mode.\n");
4161 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_1, &tran_mode);
4162 if (res != 0)
4163 {
4164 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4165 (void)mpu9250_deinit(&gs_handle);
4166
4167 return 1;
4168 }
4169 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_REG_DATA ? "ok" : "error");
4170
4171 /* set slave2 data transaction mode */
4172 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_IIC_TRANSACTION_MODE_DATA);
4173 if (res != 0)
4174 {
4175 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4176 (void)mpu9250_deinit(&gs_handle);
4177
4178 return 1;
4179 }
4180 mpu9250_interface_debug_print("mpu9250: set slave2 data transaction mode.\n");
4181 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_2, &tran_mode);
4182 if (res != 0)
4183 {
4184 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4185 (void)mpu9250_deinit(&gs_handle);
4186
4187 return 1;
4188 }
4189 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_DATA ? "ok" : "error");
4190
4191 /* set slave2 reg data transaction mode */
4192 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_IIC_TRANSACTION_MODE_REG_DATA);
4193 if (res != 0)
4194 {
4195 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4196 (void)mpu9250_deinit(&gs_handle);
4197
4198 return 1;
4199 }
4200 mpu9250_interface_debug_print("mpu9250: set slave2 reg data transaction mode.\n");
4201 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_2, &tran_mode);
4202 if (res != 0)
4203 {
4204 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4205 (void)mpu9250_deinit(&gs_handle);
4206
4207 return 1;
4208 }
4209 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_REG_DATA ? "ok" : "error");
4210
4211 /* set slave3 data transaction mode */
4212 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_IIC_TRANSACTION_MODE_DATA);
4213 if (res != 0)
4214 {
4215 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4216 (void)mpu9250_deinit(&gs_handle);
4217
4218 return 1;
4219 }
4220 mpu9250_interface_debug_print("mpu9250: set slave3 data transaction mode.\n");
4221 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_3, &tran_mode);
4222 if (res != 0)
4223 {
4224 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4225 (void)mpu9250_deinit(&gs_handle);
4226
4227 return 1;
4228 }
4229 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_DATA ? "ok" : "error");
4230
4231 /* set slave3 reg data transaction mode */
4232 res = mpu9250_set_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_IIC_TRANSACTION_MODE_REG_DATA);
4233 if (res != 0)
4234 {
4235 mpu9250_interface_debug_print("mpu9250: set iic transaction mode failed.\n");
4236 (void)mpu9250_deinit(&gs_handle);
4237
4238 return 1;
4239 }
4240 mpu9250_interface_debug_print("mpu9250: set slave3 reg data transaction mode.\n");
4241 res = mpu9250_get_iic_transaction_mode(&gs_handle, MPU9250_IIC_SLAVE_3, &tran_mode);
4242 if (res != 0)
4243 {
4244 mpu9250_interface_debug_print("mpu9250: get iic transaction mode failed.\n");
4245 (void)mpu9250_deinit(&gs_handle);
4246
4247 return 1;
4248 }
4249 mpu9250_interface_debug_print("mpu9250: check iic transaction mode %s.\n", tran_mode == MPU9250_IIC_TRANSACTION_MODE_REG_DATA ? "ok" : "error");
4250
4251 /* mpu9250_set_iic_group_order/mpu9250_get_iic_group_order test */
4252 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_group_order/mpu9250_get_iic_group_order test.\n");
4253
4254 /* set slave0 group order even */
4255 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_IIC_GROUP_ORDER_EVEN);
4256 if (res != 0)
4257 {
4258 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4259 (void)mpu9250_deinit(&gs_handle);
4260
4261 return 1;
4262 }
4263 mpu9250_interface_debug_print("mpu9250: set slave0 group order even.\n");
4264 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_0, &order);
4265 if (res != 0)
4266 {
4267 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4268 (void)mpu9250_deinit(&gs_handle);
4269
4270 return 1;
4271 }
4272 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_EVEN ? "ok" : "error");
4273
4274 /* set slave0 group order odd */
4275 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_0, MPU9250_IIC_GROUP_ORDER_ODD);
4276 if (res != 0)
4277 {
4278 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4279 (void)mpu9250_deinit(&gs_handle);
4280
4281 return 1;
4282 }
4283 mpu9250_interface_debug_print("mpu9250: set slave0 group order odd.\n");
4284 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_0, &order);
4285 if (res != 0)
4286 {
4287 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4288 (void)mpu9250_deinit(&gs_handle);
4289
4290 return 1;
4291 }
4292 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_ODD ? "ok" : "error");
4293
4294 /* set slave1 group order even */
4295 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_IIC_GROUP_ORDER_EVEN);
4296 if (res != 0)
4297 {
4298 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4299 (void)mpu9250_deinit(&gs_handle);
4300
4301 return 1;
4302 }
4303 mpu9250_interface_debug_print("mpu9250: set slave1 group order even.\n");
4304 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_1, &order);
4305 if (res != 0)
4306 {
4307 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4308 (void)mpu9250_deinit(&gs_handle);
4309
4310 return 1;
4311 }
4312 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_EVEN ? "ok" : "error");
4313
4314 /* set slave1 group order odd */
4315 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_1, MPU9250_IIC_GROUP_ORDER_ODD);
4316 if (res != 0)
4317 {
4318 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4319 (void)mpu9250_deinit(&gs_handle);
4320
4321 return 1;
4322 }
4323 mpu9250_interface_debug_print("mpu9250: set slave1 group order odd.\n");
4324 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_1, &order);
4325 if (res != 0)
4326 {
4327 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4328 (void)mpu9250_deinit(&gs_handle);
4329
4330 return 1;
4331 }
4332 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_ODD ? "ok" : "error");
4333
4334 /* set slave2 group order even */
4335 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_IIC_GROUP_ORDER_EVEN);
4336 if (res != 0)
4337 {
4338 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4339 (void)mpu9250_deinit(&gs_handle);
4340
4341 return 1;
4342 }
4343 mpu9250_interface_debug_print("mpu9250: set slave2 group order even.\n");
4344 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_2, &order);
4345 if (res != 0)
4346 {
4347 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4348 (void)mpu9250_deinit(&gs_handle);
4349
4350 return 1;
4351 }
4352 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_EVEN ? "ok" : "error");
4353
4354 /* set slave2 group order odd */
4355 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_2, MPU9250_IIC_GROUP_ORDER_ODD);
4356 if (res != 0)
4357 {
4358 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4359 (void)mpu9250_deinit(&gs_handle);
4360
4361 return 1;
4362 }
4363 mpu9250_interface_debug_print("mpu9250: set slave2 group order odd.\n");
4364 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_2, &order);
4365 if (res != 0)
4366 {
4367 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4368 (void)mpu9250_deinit(&gs_handle);
4369
4370 return 1;
4371 }
4372 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_ODD ? "ok" : "error");
4373
4374 /* set slave3 group order even */
4375 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_IIC_GROUP_ORDER_EVEN);
4376 if (res != 0)
4377 {
4378 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4379 (void)mpu9250_deinit(&gs_handle);
4380
4381 return 1;
4382 }
4383 mpu9250_interface_debug_print("mpu9250: set slave3 group order even.\n");
4384 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_3, &order);
4385 if (res != 0)
4386 {
4387 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4388 (void)mpu9250_deinit(&gs_handle);
4389
4390 return 1;
4391 }
4392 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_EVEN ? "ok" : "error");
4393
4394 /* set slave3 group order odd */
4395 res = mpu9250_set_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_3, MPU9250_IIC_GROUP_ORDER_ODD);
4396 if (res != 0)
4397 {
4398 mpu9250_interface_debug_print("mpu9250: set iic group order failed.\n");
4399 (void)mpu9250_deinit(&gs_handle);
4400
4401 return 1;
4402 }
4403 mpu9250_interface_debug_print("mpu9250: set slave3 group order odd.\n");
4404 res = mpu9250_get_iic_group_order(&gs_handle, MPU9250_IIC_SLAVE_3, &order);
4405 if (res != 0)
4406 {
4407 mpu9250_interface_debug_print("mpu9250: get iic group order failed.\n");
4408 (void)mpu9250_deinit(&gs_handle);
4409
4410 return 1;
4411 }
4412 mpu9250_interface_debug_print("mpu9250: check iic group order %s.\n", order == MPU9250_IIC_GROUP_ORDER_ODD ? "ok" : "error");
4413
4414 /* mpu9250_set_iic_transferred_len/mpu9250_get_iic_transferred_len test */
4415 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_transferred_len/mpu9250_get_iic_transferred_len test.\n");
4416
4417 test = rand() % 16;
4418 res = mpu9250_set_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_0, test);
4419 if (res != 0)
4420 {
4421 mpu9250_interface_debug_print("mpu9250: set iic transferred len failed.\n");
4422 (void)mpu9250_deinit(&gs_handle);
4423
4424 return 1;
4425 }
4426 mpu9250_interface_debug_print("mpu9250: set slave0 iic transferred len %d.\n", test);
4427 res = mpu9250_get_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_0, &test_check);
4428 if (res != 0)
4429 {
4430 mpu9250_interface_debug_print("mpu9250: get iic transferred len failed.\n");
4431 (void)mpu9250_deinit(&gs_handle);
4432
4433 return 1;
4434 }
4435 mpu9250_interface_debug_print("mpu9250: check iic transferred len %s.\n", test_check == test ? "ok" : "error");
4436
4437 test = rand() % 16;
4438 res = mpu9250_set_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_1, test);
4439 if (res != 0)
4440 {
4441 mpu9250_interface_debug_print("mpu9250: set iic transferred len failed.\n");
4442 (void)mpu9250_deinit(&gs_handle);
4443
4444 return 1;
4445 }
4446 mpu9250_interface_debug_print("mpu9250: set slave1 iic transferred len %d.\n", test);
4447 res = mpu9250_get_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_1, &test_check);
4448 if (res != 0)
4449 {
4450 mpu9250_interface_debug_print("mpu9250: get iic transferred len failed.\n");
4451 (void)mpu9250_deinit(&gs_handle);
4452
4453 return 1;
4454 }
4455 mpu9250_interface_debug_print("mpu9250: check iic transferred len %s.\n", test_check == test ? "ok" : "error");
4456
4457 test = rand() % 16;
4458 res = mpu9250_set_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_2, test);
4459 if (res != 0)
4460 {
4461 mpu9250_interface_debug_print("mpu9250: set iic transferred len failed.\n");
4462 (void)mpu9250_deinit(&gs_handle);
4463
4464 return 1;
4465 }
4466 mpu9250_interface_debug_print("mpu9250: set slave2 iic transferred len %d.\n", test);
4467 res = mpu9250_get_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_2, &test_check);
4468 if (res != 0)
4469 {
4470 mpu9250_interface_debug_print("mpu9250: get iic transferred len failed.\n");
4471 (void)mpu9250_deinit(&gs_handle);
4472
4473 return 1;
4474 }
4475 mpu9250_interface_debug_print("mpu9250: check iic transferred len %s.\n", test_check == test ? "ok" : "error");
4476
4477 test = rand() % 16;
4478 res = mpu9250_set_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_3, test);
4479 if (res != 0)
4480 {
4481 mpu9250_interface_debug_print("mpu9250: set iic transferred len failed.\n");
4482 (void)mpu9250_deinit(&gs_handle);
4483
4484 return 1;
4485 }
4486 mpu9250_interface_debug_print("mpu9250: set slave3 iic transferred len %d.\n", test);
4487 res = mpu9250_get_iic_transferred_len(&gs_handle, MPU9250_IIC_SLAVE_3, &test_check);
4488 if (res != 0)
4489 {
4490 mpu9250_interface_debug_print("mpu9250: get iic transferred len failed.\n");
4491 (void)mpu9250_deinit(&gs_handle);
4492
4493 return 1;
4494 }
4495 mpu9250_interface_debug_print("mpu9250: check iic transferred len %s.\n", test_check == test ? "ok" : "error");
4496
4497 /* mpu9250_get_iic_status test */
4498 mpu9250_interface_debug_print("mpu9250: mpu9250_get_iic_status test.\n");
4499
4500 /* get iic status */
4501 res = mpu9250_get_iic_status(&gs_handle, &status);
4502 if (res != 0)
4503 {
4504 mpu9250_interface_debug_print("mpu9250: get iic status failed.\n");
4505 (void)mpu9250_deinit(&gs_handle);
4506
4507 return 1;
4508 }
4509 mpu9250_interface_debug_print("mpu9250: iic status is 0x%02X.\n", status);
4510
4511 /* mpu9250_set_iic_delay_enable/mpu9250_get_iic_delay_enable test */
4512 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_delay_enable/mpu9250_get_iic_delay_enable test.\n");
4513
4514 /* enable delay shadow */
4515 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_ES_SHADOW, MPU9250_BOOL_TRUE);
4516 if (res != 0)
4517 {
4518 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4519 (void)mpu9250_deinit(&gs_handle);
4520
4521 return 1;
4522 }
4523 mpu9250_interface_debug_print("mpu9250: enable delay shadow.\n");
4524 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_ES_SHADOW, &enable);
4525 if (res != 0)
4526 {
4527 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4528 (void)mpu9250_deinit(&gs_handle);
4529
4530 return 1;
4531 }
4532 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4533
4534 /* disable delay shadow */
4535 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_ES_SHADOW, MPU9250_BOOL_FALSE);
4536 if (res != 0)
4537 {
4538 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4539 (void)mpu9250_deinit(&gs_handle);
4540
4541 return 1;
4542 }
4543 mpu9250_interface_debug_print("mpu9250: disable delay shadow.\n");
4544 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_ES_SHADOW, &enable);
4545 if (res != 0)
4546 {
4547 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4548 (void)mpu9250_deinit(&gs_handle);
4549
4550 return 1;
4551 }
4552 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4553
4554 /* enable delay slave4 */
4555 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_4, MPU9250_BOOL_TRUE);
4556 if (res != 0)
4557 {
4558 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4559 (void)mpu9250_deinit(&gs_handle);
4560
4561 return 1;
4562 }
4563 mpu9250_interface_debug_print("mpu9250: enable delay slave4.\n");
4564 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_4, &enable);
4565 if (res != 0)
4566 {
4567 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4568 (void)mpu9250_deinit(&gs_handle);
4569
4570 return 1;
4571 }
4572 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4573
4574 /* disable delay slave4 */
4575 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_4, MPU9250_BOOL_FALSE);
4576 if (res != 0)
4577 {
4578 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4579 (void)mpu9250_deinit(&gs_handle);
4580
4581 return 1;
4582 }
4583 mpu9250_interface_debug_print("mpu9250: disable delay slave4.\n");
4584 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_4, &enable);
4585 if (res != 0)
4586 {
4587 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4588 (void)mpu9250_deinit(&gs_handle);
4589
4590 return 1;
4591 }
4592 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4593
4594 /* enable delay slave3 */
4595 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_3, MPU9250_BOOL_TRUE);
4596 if (res != 0)
4597 {
4598 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4599 (void)mpu9250_deinit(&gs_handle);
4600
4601 return 1;
4602 }
4603 mpu9250_interface_debug_print("mpu9250: enable delay slave3.\n");
4604 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_3, &enable);
4605 if (res != 0)
4606 {
4607 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4608 (void)mpu9250_deinit(&gs_handle);
4609
4610 return 1;
4611 }
4612 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4613
4614 /* disable delay slave3 */
4615 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_3, MPU9250_BOOL_FALSE);
4616 if (res != 0)
4617 {
4618 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4619 (void)mpu9250_deinit(&gs_handle);
4620
4621 return 1;
4622 }
4623 mpu9250_interface_debug_print("mpu9250: disable delay slave3.\n");
4624 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_3, &enable);
4625 if (res != 0)
4626 {
4627 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4628 (void)mpu9250_deinit(&gs_handle);
4629
4630 return 1;
4631 }
4632 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4633
4634 /* enable delay slave2 */
4635 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_2, MPU9250_BOOL_TRUE);
4636 if (res != 0)
4637 {
4638 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4639 (void)mpu9250_deinit(&gs_handle);
4640
4641 return 1;
4642 }
4643 mpu9250_interface_debug_print("mpu9250: enable delay slave2.\n");
4644 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_2, &enable);
4645 if (res != 0)
4646 {
4647 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4648 (void)mpu9250_deinit(&gs_handle);
4649
4650 return 1;
4651 }
4652 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4653
4654 /* disable delay slave2 */
4655 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_2, MPU9250_BOOL_FALSE);
4656 if (res != 0)
4657 {
4658 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4659 (void)mpu9250_deinit(&gs_handle);
4660
4661 return 1;
4662 }
4663 mpu9250_interface_debug_print("mpu9250: disable delay slave2.\n");
4664 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_2, &enable);
4665 if (res != 0)
4666 {
4667 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4668 (void)mpu9250_deinit(&gs_handle);
4669
4670 return 1;
4671 }
4672 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4673
4674 /* enable delay slave1 */
4675 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_1, MPU9250_BOOL_TRUE);
4676 if (res != 0)
4677 {
4678 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4679 (void)mpu9250_deinit(&gs_handle);
4680
4681 return 1;
4682 }
4683 mpu9250_interface_debug_print("mpu9250: enable delay slave1.\n");
4684 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_1, &enable);
4685 if (res != 0)
4686 {
4687 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4688 (void)mpu9250_deinit(&gs_handle);
4689
4690 return 1;
4691 }
4692 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4693
4694 /* disable delay slave1 */
4695 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_1, MPU9250_BOOL_FALSE);
4696 if (res != 0)
4697 {
4698 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4699 (void)mpu9250_deinit(&gs_handle);
4700
4701 return 1;
4702 }
4703 mpu9250_interface_debug_print("mpu9250: disable delay slave1.\n");
4704 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_1, &enable);
4705 if (res != 0)
4706 {
4707 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4708 (void)mpu9250_deinit(&gs_handle);
4709
4710 return 1;
4711 }
4712 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4713
4714 /* enable delay slave0 */
4715 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_0, MPU9250_BOOL_TRUE);
4716 if (res != 0)
4717 {
4718 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4719 (void)mpu9250_deinit(&gs_handle);
4720
4721 return 0;
4722 }
4723 mpu9250_interface_debug_print("mpu9250: enable delay slave0.\n");
4724 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_0, &enable);
4725 if (res != 0)
4726 {
4727 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4728 (void)mpu9250_deinit(&gs_handle);
4729
4730 return 0;
4731 }
4732 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4733
4734 /* disable delay slave0 */
4735 res = mpu9250_set_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_0, MPU9250_BOOL_FALSE);
4736 if (res != 0)
4737 {
4738 mpu9250_interface_debug_print("mpu9250: set iic delay enable failed.\n");
4739 (void)mpu9250_deinit(&gs_handle);
4740
4741 return 0;
4742 }
4743 mpu9250_interface_debug_print("mpu9250: disable delay slave0.\n");
4744 res = mpu9250_get_iic_delay_enable(&gs_handle, MPU9250_IIC_DELAY_SLAVE_0, &enable);
4745 if (res != 0)
4746 {
4747 mpu9250_interface_debug_print("mpu9250: get iic delay enable failed.\n");
4748 (void)mpu9250_deinit(&gs_handle);
4749
4750 return 0;
4751 }
4752 mpu9250_interface_debug_print("mpu9250: check iic delay enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4753
4754 /* mpu9250_set_iic4_enable/mpu9250_get_iic4_enable test */
4755 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic4_enable/mpu9250_get_iic4_enable test.\n");
4756
4757 /* enable iic4 */
4758 res = mpu9250_set_iic4_enable(&gs_handle, MPU9250_BOOL_TRUE);
4759 if (res != 0)
4760 {
4761 mpu9250_interface_debug_print("mpu9250: set iic4 enable failed.\n");
4762 (void)mpu9250_deinit(&gs_handle);
4763
4764 return 0;
4765 }
4766 mpu9250_interface_debug_print("mpu9250: enable iic4.\n");
4767 res = mpu9250_get_iic4_enable(&gs_handle, &enable);
4768 if (res != 0)
4769 {
4770 mpu9250_interface_debug_print("mpu9250: get iic4 enable failed.\n");
4771 (void)mpu9250_deinit(&gs_handle);
4772
4773 return 0;
4774 }
4775 mpu9250_interface_debug_print("mpu9250: check iic4 enable %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4776
4777 /* disable iic4 */
4778 res = mpu9250_set_iic4_enable(&gs_handle, MPU9250_BOOL_FALSE);
4779 if (res != 0)
4780 {
4781 mpu9250_interface_debug_print("mpu9250: set iic4 enable failed.\n");
4782 (void)mpu9250_deinit(&gs_handle);
4783
4784 return 0;
4785 }
4786 mpu9250_interface_debug_print("mpu9250: disable iic4.\n");
4787 res = mpu9250_get_iic4_enable(&gs_handle, &enable);
4788 if (res != 0)
4789 {
4790 mpu9250_interface_debug_print("mpu9250: get iic4 enable failed.\n");
4791 (void)mpu9250_deinit(&gs_handle);
4792
4793 return 0;
4794 }
4795 mpu9250_interface_debug_print("mpu9250: check iic4 enable %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4796
4797 /* mpu9250_set_iic4_interrupt/mpu9250_get_iic4_interrupt test */
4798 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic4_interrupt/mpu9250_get_iic4_interrupt test.\n");
4799
4800 /* enable iic4 interrupt */
4801 res = mpu9250_set_iic4_interrupt(&gs_handle, MPU9250_BOOL_TRUE);
4802 if (res != 0)
4803 {
4804 mpu9250_interface_debug_print("mpu9250: set iic4 interrupt failed.\n");
4805 (void)mpu9250_deinit(&gs_handle);
4806
4807 return 0;
4808 }
4809 mpu9250_interface_debug_print("mpu9250: enable iic4 interrupt.\n");
4810 res = mpu9250_get_iic4_interrupt(&gs_handle, &enable);
4811 if (res != 0)
4812 {
4813 mpu9250_interface_debug_print("mpu9250: get iic4 interrupt failed.\n");
4814 (void)mpu9250_deinit(&gs_handle);
4815
4816 return 0;
4817 }
4818 mpu9250_interface_debug_print("mpu9250: check iic4 interrupt %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4819
4820 /* disable iic4 interrupt */
4821 res = mpu9250_set_iic4_interrupt(&gs_handle, MPU9250_BOOL_FALSE);
4822 if (res != 0)
4823 {
4824 mpu9250_interface_debug_print("mpu9250: set iic4 interrupt failed.\n");
4825 (void)mpu9250_deinit(&gs_handle);
4826
4827 return 0;
4828 }
4829 mpu9250_interface_debug_print("mpu9250: disable iic4 interrupt.\n");
4830 res = mpu9250_get_iic4_interrupt(&gs_handle, &enable);
4831 if (res != 0)
4832 {
4833 mpu9250_interface_debug_print("mpu9250: get iic4 interrupt failed.\n");
4834 (void)mpu9250_deinit(&gs_handle);
4835
4836 return 0;
4837 }
4838 mpu9250_interface_debug_print("mpu9250: check iic4 interrupt %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4839
4840 /* mpu9250_set_iic4_transaction_mode/mpu9250_get_iic4_transaction_mode test */
4841 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic4_transaction_mode/mpu9250_get_iic4_transaction_mode test.\n");
4842
4843 /* transaction mode data */
4844 res = mpu9250_set_iic4_transaction_mode(&gs_handle, MPU9250_IIC4_TRANSACTION_MODE_DATA);
4845 if (res != 0)
4846 {
4847 mpu9250_interface_debug_print("mpu9250: set iic4 transaction mode failed.\n");
4848 (void)mpu9250_deinit(&gs_handle);
4849
4850 return 0;
4851 }
4852 mpu9250_interface_debug_print("mpu9250: set iic4 transaction mode data.\n");
4853 res = mpu9250_get_iic4_transaction_mode(&gs_handle, &transaction_mode);
4854 if (res != 0)
4855 {
4856 mpu9250_interface_debug_print("mpu9250: get iic4 transaction mode failed.\n");
4857 (void)mpu9250_deinit(&gs_handle);
4858
4859 return 0;
4860 }
4861 mpu9250_interface_debug_print("mpu9250: check iic4 transaction mode %s.\n", transaction_mode == MPU9250_IIC4_TRANSACTION_MODE_DATA ? "ok" : "error");
4862
4863 /* transaction mode reg */
4864 res = mpu9250_set_iic4_transaction_mode(&gs_handle, MPU9250_IIC4_TRANSACTION_MODE_REG);
4865 if (res != 0)
4866 {
4867 mpu9250_interface_debug_print("mpu9250: set iic4 transaction mode failed.\n");
4868 (void)mpu9250_deinit(&gs_handle);
4869
4870 return 0;
4871 }
4872 mpu9250_interface_debug_print("mpu9250: set iic4 transaction mode reg.\n");
4873 res = mpu9250_get_iic4_transaction_mode(&gs_handle, &transaction_mode);
4874 if (res != 0)
4875 {
4876 mpu9250_interface_debug_print("mpu9250: get iic4 transaction mode failed.\n");
4877 (void)mpu9250_deinit(&gs_handle);
4878
4879 return 0;
4880 }
4881 mpu9250_interface_debug_print("mpu9250: check iic4 transaction mode %s.\n", transaction_mode == MPU9250_IIC4_TRANSACTION_MODE_REG ? "ok" : "error");
4882
4883 /* mpu9250_set_iic_delay/mpu9250_get_iic_delay test */
4884 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic_delay/mpu9250_get_iic_delay test.\n");
4885
4886 test = rand() % 0x1F;
4887 res = mpu9250_set_iic_delay(&gs_handle, test);
4888 if (res != 0)
4889 {
4890 mpu9250_interface_debug_print("mpu9250: set iic delay failed.\n");
4891 (void)mpu9250_deinit(&gs_handle);
4892
4893 return 0;
4894 }
4895 mpu9250_interface_debug_print("mpu9250: set iic delay 0x%02X.\n", test);
4896 res = mpu9250_get_iic_delay(&gs_handle, &test_check);
4897 if (res != 0)
4898 {
4899 mpu9250_interface_debug_print("mpu9250: get iic delay failed.\n");
4900 (void)mpu9250_deinit(&gs_handle);
4901
4902 return 0;
4903 }
4904 mpu9250_interface_debug_print("mpu9250: check iic delay %s.\n", test == test_check ? "ok" : "error");
4905
4906 /* mpu9250_set_iic4_data_out/mpu9250_get_iic4_data_out test */
4907 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic4_data_out/mpu9250_get_iic4_data_out test.\n");
4908
4909 test = rand() % 256;
4910 res = mpu9250_set_iic4_data_out(&gs_handle, test);
4911 if (res != 0)
4912 {
4913 mpu9250_interface_debug_print("mpu9250: set iic4 data out failed.\n");
4914 (void)mpu9250_deinit(&gs_handle);
4915
4916 return 0;
4917 }
4918 mpu9250_interface_debug_print("mpu9250: set iic4 data out 0x%02X.\n", test);
4919 res = mpu9250_get_iic4_data_out(&gs_handle, &test_check);
4920 if (res != 0)
4921 {
4922 mpu9250_interface_debug_print("mpu9250: get iic4 data out failed.\n");
4923 (void)mpu9250_deinit(&gs_handle);
4924
4925 return 0;
4926 }
4927 mpu9250_interface_debug_print("mpu9250: check iic4 data out %s.\n", test == test_check ? "ok" : "error");
4928
4929 /* mpu9250_set_iic4_data_in/mpu9250_get_iic4_data_in test */
4930 mpu9250_interface_debug_print("mpu9250: mpu9250_set_iic4_data_in/mpu9250_get_iic4_data_in test.\n");
4931
4932 test = rand() % 256;
4933 res = mpu9250_set_iic4_data_in(&gs_handle, test);
4934 if (res != 0)
4935 {
4936 mpu9250_interface_debug_print("mpu9250: set iic4 data in failed.\n");
4937 (void)mpu9250_deinit(&gs_handle);
4938
4939 return 0;
4940 }
4941 mpu9250_interface_debug_print("mpu9250: set iic4 data in 0x%02X.\n", test);
4942 mpu9250_interface_debug_print("mpu9250: check iic4 data in %s.\n", res == 0 ? "ok" : "error");
4943
4944 /* if spi interface */
4945 if (interface == MPU9250_INTERFACE_SPI)
4946 {
4947 /* mpu9250_set_disable_iic_slave/mpu9250_get_disable_iic_slave test */
4948 mpu9250_interface_debug_print("mpu9250: mpu9250_set_disable_iic_slave/mpu9250_get_disable_iic_slave test.\n");
4949
4950 /* enable iic slave */
4951 res = mpu9250_set_disable_iic_slave(&gs_handle, MPU9250_BOOL_FALSE);
4952 if (res != 0)
4953 {
4954 mpu9250_interface_debug_print("mpu9250: set disable iic slave failed.\n");
4955 (void)mpu9250_deinit(&gs_handle);
4956
4957 return 0;
4958 }
4959 mpu9250_interface_debug_print("mpu9250: enable iic slave.\n");
4960 res = mpu9250_get_disable_iic_slave(&gs_handle, &enable);
4961 if (res != 0)
4962 {
4963 mpu9250_interface_debug_print("mpu9250: get disable iic slave failed.\n");
4964 (void)mpu9250_deinit(&gs_handle);
4965
4966 return 0;
4967 }
4968 mpu9250_interface_debug_print("mpu9250: check disable iic slave %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
4969
4970 /* disable iic slave */
4971 res = mpu9250_set_disable_iic_slave(&gs_handle, MPU9250_BOOL_TRUE);
4972 if (res != 0)
4973 {
4974 mpu9250_interface_debug_print("mpu9250: set disable iic slave failed.\n");
4975 (void)mpu9250_deinit(&gs_handle);
4976
4977 return 0;
4978 }
4979 mpu9250_interface_debug_print("mpu9250: disable iic slave.\n");
4980 res = mpu9250_get_disable_iic_slave(&gs_handle, &enable);
4981 if (res != 0)
4982 {
4983 mpu9250_interface_debug_print("mpu9250: get disable iic slave failed.\n");
4984 (void)mpu9250_deinit(&gs_handle);
4985
4986 return 0;
4987 }
4988 mpu9250_interface_debug_print("mpu9250: check disable iic slave %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
4989 }
4990
4991 /* mpu9250_set_gyro_standby/mpu9250_get_gyro_standby test */
4992 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyro_standby/mpu9250_get_gyro_standby test.\n");
4993
4994 /* enable gyro standby */
4995 res = mpu9250_set_gyro_standby(&gs_handle, MPU9250_BOOL_TRUE);
4996 if (res != 0)
4997 {
4998 mpu9250_interface_debug_print("mpu9250: set gyro standby failed.\n");
4999 (void)mpu9250_deinit(&gs_handle);
5000
5001 return 0;
5002 }
5003 mpu9250_interface_debug_print("mpu9250: enable gyro standby.\n");
5004 res = mpu9250_get_gyro_standby(&gs_handle, &enable);
5005 if (res != 0)
5006 {
5007 mpu9250_interface_debug_print("mpu9250: get gyro standby failed.\n");
5008 (void)mpu9250_deinit(&gs_handle);
5009
5010 return 0;
5011 }
5012 mpu9250_interface_debug_print("mpu9250: check gyro standby %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
5013
5014 /* disable gyro standby */
5015 res = mpu9250_set_gyro_standby(&gs_handle, MPU9250_BOOL_FALSE);
5016 if (res != 0)
5017 {
5018 mpu9250_interface_debug_print("mpu9250: set gyro standby failed.\n");
5019 (void)mpu9250_deinit(&gs_handle);
5020
5021 return 0;
5022 }
5023 mpu9250_interface_debug_print("mpu9250: disable gyro standby.\n");
5024 res = mpu9250_get_gyro_standby(&gs_handle, &enable);
5025 if (res != 0)
5026 {
5027 mpu9250_interface_debug_print("mpu9250: get gyro standby failed.\n");
5028 (void)mpu9250_deinit(&gs_handle);
5029
5030 return 0;
5031 }
5032 mpu9250_interface_debug_print("mpu9250: check gyro standby %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
5033
5034 /* mpu9250_set_fifo_mode/mpu9250_get_fifo_mode test */
5035 mpu9250_interface_debug_print("mpu9250: mpu9250_set_fifo_mode/mpu9250_get_fifo_mode test.\n");
5036
5037 /* set fifo stream mode */
5038 res = mpu9250_set_fifo_mode(&gs_handle, MPU9250_FIFO_MODE_STREAM);
5039 if (res != 0)
5040 {
5041 mpu9250_interface_debug_print("mpu9250: set fifo mode failed.\n");
5042 (void)mpu9250_deinit(&gs_handle);
5043
5044 return 0;
5045 }
5046 mpu9250_interface_debug_print("mpu9250: set fifo stream mode.\n");
5047 res = mpu9250_get_fifo_mode(&gs_handle, &fifo_mode);
5048 if (res != 0)
5049 {
5050 mpu9250_interface_debug_print("mpu9250: get fifo mode failed.\n");
5051 (void)mpu9250_deinit(&gs_handle);
5052
5053 return 0;
5054 }
5055 mpu9250_interface_debug_print("mpu9250: check fifo mode %s.\n", fifo_mode == MPU9250_FIFO_MODE_STREAM ? "ok" : "error");
5056
5057 /* set fifo normal mode */
5058 res = mpu9250_set_fifo_mode(&gs_handle, MPU9250_FIFO_MODE_NORMAL);
5059 if (res != 0)
5060 {
5061 mpu9250_interface_debug_print("mpu9250: set fifo mode failed.\n");
5062 (void)mpu9250_deinit(&gs_handle);
5063
5064 return 0;
5065 }
5066 mpu9250_interface_debug_print("mpu9250: set fifo normal mode.\n");
5067 res = mpu9250_get_fifo_mode(&gs_handle, &fifo_mode);
5068 if (res != 0)
5069 {
5070 mpu9250_interface_debug_print("mpu9250: get fifo mode failed.\n");
5071 (void)mpu9250_deinit(&gs_handle);
5072
5073 return 0;
5074 }
5075 mpu9250_interface_debug_print("mpu9250: check fifo mode %s.\n", fifo_mode == MPU9250_FIFO_MODE_NORMAL ? "ok" : "error");
5076
5077 /* mpu9250_set_gyroscope_choice/mpu9250_get_gyroscope_choice test */
5078 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyroscope_choice/mpu9250_get_gyroscope_choice test.\n");
5079
5080 test = rand() % 4;
5081 res = mpu9250_set_gyroscope_choice(&gs_handle, test);
5082 if (res != 0)
5083 {
5084 mpu9250_interface_debug_print("mpu9250: set gyroscope choice failed.\n");
5085 (void)mpu9250_deinit(&gs_handle);
5086
5087 return 0;
5088 }
5089 mpu9250_interface_debug_print("mpu9250: set gyroscope choice 0x%02X.\n", test);
5090 res = mpu9250_get_gyroscope_choice(&gs_handle, &test_check);
5091 if (res != 0)
5092 {
5093 mpu9250_interface_debug_print("mpu9250: get gyroscope choice failed.\n");
5094 (void)mpu9250_deinit(&gs_handle);
5095
5096 return 0;
5097 }
5098 mpu9250_interface_debug_print("mpu9250: check gyroscope choice %s.\n", test_check == test ? "ok" : "error");
5099
5100 /* mpu9250_set_accelerometer_choice/mpu9250_get_accelerometer_choice test */
5101 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_choice/mpu9250_get_accelerometer_choice test.\n");
5102
5103 test = rand() % 2;
5104 res = mpu9250_set_accelerometer_choice(&gs_handle, test);
5105 if (res != 0)
5106 {
5107 mpu9250_interface_debug_print("mpu9250: set accelerometer choice failed.\n");
5108 (void)mpu9250_deinit(&gs_handle);
5109
5110 return 0;
5111 }
5112 mpu9250_interface_debug_print("mpu9250: set accelerometer choice 0x%02X.\n", test);
5113 res = mpu9250_get_accelerometer_choice(&gs_handle, &test_check);
5114 if (res != 0)
5115 {
5116 mpu9250_interface_debug_print("mpu9250: get accelerometer choice failed.\n");
5117 (void)mpu9250_deinit(&gs_handle);
5118
5119 return 0;
5120 }
5121 mpu9250_interface_debug_print("mpu9250: check accelerometer choice %s.\n", test_check == test ? "ok" : "error");
5122
5123 /* mpu9250_set_accelerometer_low_pass_filter/mpu9250_get_accelerometer_low_pass_filter test */
5124 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_low_pass_filter/mpu9250_get_accelerometer_low_pass_filter test.\n");
5125
5126 /* accelerometer low pass filter 0 */
5127 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_0);
5128 if (res != 0)
5129 {
5130 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5131 (void)mpu9250_deinit(&gs_handle);
5132
5133 return 0;
5134 }
5135 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 0.\n");
5136 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5137 if (res != 0)
5138 {
5139 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5140 (void)mpu9250_deinit(&gs_handle);
5141
5142 return 0;
5143 }
5144 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5145 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_0 ? "ok" : "error");
5146
5147 /* accelerometer low pass filter 1 */
5148 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_1);
5149 if (res != 0)
5150 {
5151 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5152 (void)mpu9250_deinit(&gs_handle);
5153
5154 return 0;
5155 }
5156 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 1.\n");
5157 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5158 if (res != 0)
5159 {
5160 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5161 (void)mpu9250_deinit(&gs_handle);
5162
5163 return 0;
5164 }
5165 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5166 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_1 ? "ok" : "error");
5167
5168 /* accelerometer low pass filter 2 */
5169 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_2);
5170 if (res != 0)
5171 {
5172 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5173 (void)mpu9250_deinit(&gs_handle);
5174
5175 return 0;
5176 }
5177 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 2.\n");
5178 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5179 if (res != 0)
5180 {
5181 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5182 (void)mpu9250_deinit(&gs_handle);
5183
5184 return 0;
5185 }
5186 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5187 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_2 ? "ok" : "error");
5188
5189 /* accelerometer low pass filter 3 */
5190 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_3);
5191 if (res != 0)
5192 {
5193 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5194 (void)mpu9250_deinit(&gs_handle);
5195
5196 return 0;
5197 }
5198 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 3.\n");
5199 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5200 if (res != 0)
5201 {
5202 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5203 (void)mpu9250_deinit(&gs_handle);
5204
5205 return 0;
5206 }
5207 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5208 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_3 ? "ok" : "error");
5209
5210 /* accelerometer low pass filter 4 */
5211 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_4);
5212 if (res != 0)
5213 {
5214 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5215 (void)mpu9250_deinit(&gs_handle);
5216
5217 return 0;
5218 }
5219 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 4.\n");
5220 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5221 if (res != 0)
5222 {
5223 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5224 (void)mpu9250_deinit(&gs_handle);
5225
5226 return 0;
5227 }
5228 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5229 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_4 ? "ok" : "error");
5230
5231 /* accelerometer low pass filter 5 */
5232 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_5);
5233 if (res != 0)
5234 {
5235 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5236 (void)mpu9250_deinit(&gs_handle);
5237
5238 return 0;
5239 }
5240 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 5.\n");
5241 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5242 if (res != 0)
5243 {
5244 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5245 (void)mpu9250_deinit(&gs_handle);
5246
5247 return 0;
5248 }
5249 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5250 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_5 ? "ok" : "error");
5251
5252 /* accelerometer low pass filter 6 */
5253 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_6);
5254 if (res != 0)
5255 {
5256 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5257 (void)mpu9250_deinit(&gs_handle);
5258
5259 return 0;
5260 }
5261 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 6.\n");
5262 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5263 if (res != 0)
5264 {
5265 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5266 (void)mpu9250_deinit(&gs_handle);
5267
5268 return 0;
5269 }
5270 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5271 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_6 ? "ok" : "error");
5272
5273 /* accelerometer low pass filter 7 */
5274 res = mpu9250_set_accelerometer_low_pass_filter(&gs_handle, MPU9250_ACCELEROMETER_LOW_PASS_FILTER_7);
5275 if (res != 0)
5276 {
5277 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter failed.\n");
5278 (void)mpu9250_deinit(&gs_handle);
5279
5280 return 0;
5281 }
5282 mpu9250_interface_debug_print("mpu9250: set accelerometer low pass filter 7.\n");
5283 res = mpu9250_get_accelerometer_low_pass_filter(&gs_handle, &accelerometer_filter);
5284 if (res != 0)
5285 {
5286 mpu9250_interface_debug_print("mpu9250: get accelerometer low pass filter failed.\n");
5287 (void)mpu9250_deinit(&gs_handle);
5288
5289 return 0;
5290 }
5291 mpu9250_interface_debug_print("mpu9250: check accelerometer low pass filter %s.\n",
5292 accelerometer_filter == MPU9250_ACCELEROMETER_LOW_PASS_FILTER_7 ? "ok" : "error");
5293
5294 /* mpu9250_set_low_power_accel_output_rate/mpu9250_get_low_power_accel_output_rate test */
5295 mpu9250_interface_debug_print("mpu9250: mpu9250_set_low_power_accel_output_rate/mpu9250_get_low_power_accel_output_rate test.\n");
5296
5297 /* set 0.24Hz */
5298 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P24);
5299 if (res != 0)
5300 {
5301 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5302 (void)mpu9250_deinit(&gs_handle);
5303
5304 return 0;
5305 }
5306 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 0.24Hz.\n");
5307 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5308 if (res != 0)
5309 {
5310 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5311 (void)mpu9250_deinit(&gs_handle);
5312
5313 return 0;
5314 }
5315 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5316 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P24 ? "ok" : "error");
5317
5318 /* set 0.49Hz */
5319 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P49);
5320 if (res != 0)
5321 {
5322 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5323 (void)mpu9250_deinit(&gs_handle);
5324
5325 return 0;
5326 }
5327 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 0.49Hz.\n");
5328 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5329 if (res != 0)
5330 {
5331 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5332 (void)mpu9250_deinit(&gs_handle);
5333
5334 return 0;
5335 }
5336 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5337 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P49 ? "ok" : "error");
5338
5339 /* set 0.98Hz */
5340 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P98);
5341 if (res != 0)
5342 {
5343 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5344 (void)mpu9250_deinit(&gs_handle);
5345
5346 return 0;
5347 }
5348 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 0.98Hz.\n");
5349 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5350 if (res != 0)
5351 {
5352 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5353 (void)mpu9250_deinit(&gs_handle);
5354
5355 return 0;
5356 }
5357 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5358 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P98 ? "ok" : "error");
5359
5360 /* set 1.95Hz */
5361 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_1P95);
5362 if (res != 0)
5363 {
5364 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5365 (void)mpu9250_deinit(&gs_handle);
5366
5367 return 0;
5368 }
5369 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 1.95Hz.\n");
5370 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5371 if (res != 0)
5372 {
5373 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5374 (void)mpu9250_deinit(&gs_handle);
5375
5376 return 0;
5377 }
5378 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5379 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_1P95 ? "ok" : "error");
5380
5381 /* set 3.91Hz */
5382 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_3P91);
5383 if (res != 0)
5384 {
5385 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5386 (void)mpu9250_deinit(&gs_handle);
5387
5388 return 0;
5389 }
5390 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 3.91Hz.\n");
5391 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5392 if (res != 0)
5393 {
5394 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5395 (void)mpu9250_deinit(&gs_handle);
5396
5397 return 0;
5398 }
5399 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5400 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_3P91 ? "ok" : "error");
5401
5402 /* set 7.81Hz */
5403 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_7P81);
5404 if (res != 0)
5405 {
5406 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5407 (void)mpu9250_deinit(&gs_handle);
5408
5409 return 0;
5410 }
5411 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 7.81Hz.\n");
5412 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5413 if (res != 0)
5414 {
5415 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5416 (void)mpu9250_deinit(&gs_handle);
5417
5418 return 0;
5419 }
5420 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5421 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_7P81 ? "ok" : "error");
5422
5423 /* set 15.63Hz */
5424 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_15P63);
5425 if (res != 0)
5426 {
5427 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5428 (void)mpu9250_deinit(&gs_handle);
5429
5430 return 0;
5431 }
5432 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 15.63Hz.\n");
5433 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5434 if (res != 0)
5435 {
5436 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5437 (void)mpu9250_deinit(&gs_handle);
5438
5439 return 0;
5440 }
5441 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5442 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_15P63 ? "ok" : "error");
5443
5444 /* set 31.25Hz */
5445 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_31P25);
5446 if (res != 0)
5447 {
5448 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5449 (void)mpu9250_deinit(&gs_handle);
5450
5451 return 0;
5452 }
5453 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 31.25Hz.\n");
5454 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5455 if (res != 0)
5456 {
5457 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5458 (void)mpu9250_deinit(&gs_handle);
5459
5460 return 0;
5461 }
5462 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5463 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_31P25 ? "ok" : "error");
5464
5465 /* set 62.50Hz */
5466 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50);
5467 if (res != 0)
5468 {
5469 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5470 (void)mpu9250_deinit(&gs_handle);
5471
5472 return 0;
5473 }
5474 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 62.50Hz.\n");
5475 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5476 if (res != 0)
5477 {
5478 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5479 (void)mpu9250_deinit(&gs_handle);
5480
5481 return 0;
5482 }
5483 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5484 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50 ? "ok" : "error");
5485
5486 /* set 125Hz */
5487 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_125);
5488 if (res != 0)
5489 {
5490 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5491 (void)mpu9250_deinit(&gs_handle);
5492
5493 return 0;
5494 }
5495 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 125Hz.\n");
5496 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5497 if (res != 0)
5498 {
5499 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5500 (void)mpu9250_deinit(&gs_handle);
5501
5502 return 0;
5503 }
5504 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5505 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_125 ? "ok" : "error");
5506
5507 /* set 250Hz */
5508 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_250);
5509 if (res != 0)
5510 {
5511 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5512 (void)mpu9250_deinit(&gs_handle);
5513
5514 return 0;
5515 }
5516 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 250Hz.\n");
5517 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5518 if (res != 0)
5519 {
5520 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5521 (void)mpu9250_deinit(&gs_handle);
5522
5523 return 0;
5524 }
5525 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5526 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_250 ? "ok" : "error");
5527
5528 /* set 500Hz */
5529 res = mpu9250_set_low_power_accel_output_rate(&gs_handle, MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_500);
5530 if (res != 0)
5531 {
5532 mpu9250_interface_debug_print("mpu9250: set low power accel output rate failed.\n");
5533 (void)mpu9250_deinit(&gs_handle);
5534
5535 return 0;
5536 }
5537 mpu9250_interface_debug_print("mpu9250: set low power accel output rate 500Hz.\n");
5538 res = mpu9250_get_low_power_accel_output_rate(&gs_handle, &rate);
5539 if (res != 0)
5540 {
5541 mpu9250_interface_debug_print("mpu9250: get low power accel output rate failed.\n");
5542 (void)mpu9250_deinit(&gs_handle);
5543
5544 return 0;
5545 }
5546 mpu9250_interface_debug_print("mpu9250: check low power accel output rate %s.\n",
5547 rate == MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_500 ? "ok" : "error");
5548
5549 /* mpu9250_set_wake_on_motion/mpu9250_get_wake_on_motion test */
5550 mpu9250_interface_debug_print("mpu9250: mpu9250_set_wake_on_motion/mpu9250_get_wake_on_motion test.\n");
5551
5552 /* enable wake on motion */
5553 res = mpu9250_set_wake_on_motion(&gs_handle, MPU9250_BOOL_TRUE);
5554 if (res != 0)
5555 {
5556 mpu9250_interface_debug_print("mpu9250: set wake on motion failed.\n");
5557 (void)mpu9250_deinit(&gs_handle);
5558
5559 return 0;
5560 }
5561 mpu9250_interface_debug_print("mpu9250: enable wake on motion.\n");
5562 res = mpu9250_get_wake_on_motion(&gs_handle, &enable);
5563 if (res != 0)
5564 {
5565 mpu9250_interface_debug_print("mpu9250: get wake on motion failed.\n");
5566 (void)mpu9250_deinit(&gs_handle);
5567
5568 return 0;
5569 }
5570 mpu9250_interface_debug_print("mpu9250: check wake on motion %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
5571
5572 /* disable wake on motion */
5573 res = mpu9250_set_wake_on_motion(&gs_handle, MPU9250_BOOL_FALSE);
5574 if (res != 0)
5575 {
5576 mpu9250_interface_debug_print("mpu9250: set wake on motion failed.\n");
5577 (void)mpu9250_deinit(&gs_handle);
5578
5579 return 0;
5580 }
5581 mpu9250_interface_debug_print("mpu9250: disable wake on motion.\n");
5582 res = mpu9250_get_wake_on_motion(&gs_handle, &enable);
5583 if (res != 0)
5584 {
5585 mpu9250_interface_debug_print("mpu9250: get wake on motion failed.\n");
5586 (void)mpu9250_deinit(&gs_handle);
5587
5588 return 0;
5589 }
5590 mpu9250_interface_debug_print("mpu9250: check wake on motion %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
5591
5592 /* mpu9250_set_accel_compare_with_previous_sample/mpu9250_get_accel_compare_with_previous_sample test */
5593 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accel_compare_with_previous_sample/mpu9250_get_accel_compare_with_previous_sample test.\n");
5594
5595 /* enable accel compare with previous sample */
5596 res = mpu9250_set_accel_compare_with_previous_sample(&gs_handle, MPU9250_BOOL_TRUE);
5597 if (res != 0)
5598 {
5599 mpu9250_interface_debug_print("mpu9250: set accel compare with previous sample failed.\n");
5600 (void)mpu9250_deinit(&gs_handle);
5601
5602 return 0;
5603 }
5604 mpu9250_interface_debug_print("mpu9250: enable accel compare with previous sample.\n");
5605 res = mpu9250_get_accel_compare_with_previous_sample(&gs_handle, &enable);
5606 if (res != 0)
5607 {
5608 mpu9250_interface_debug_print("mpu9250: get accel compare with previous sample failed.\n");
5609 (void)mpu9250_deinit(&gs_handle);
5610
5611 return 0;
5612 }
5613 mpu9250_interface_debug_print("mpu9250: check accel compare with previous sample %s.\n", enable == MPU9250_BOOL_TRUE ? "ok" : "error");
5614
5615 /* disable accel compare with previous sample */
5616 res = mpu9250_set_accel_compare_with_previous_sample(&gs_handle, MPU9250_BOOL_FALSE);
5617 if (res != 0)
5618 {
5619 mpu9250_interface_debug_print("mpu9250: set accel compare with previous sample failed.\n");
5620 (void)mpu9250_deinit(&gs_handle);
5621
5622 return 0;
5623 }
5624 mpu9250_interface_debug_print("mpu9250: disable accel compare with previous sample.\n");
5625 res = mpu9250_get_accel_compare_with_previous_sample(&gs_handle, &enable);
5626 if (res != 0)
5627 {
5628 mpu9250_interface_debug_print("mpu9250: get accel compare with previous sample failed.\n");
5629 (void)mpu9250_deinit(&gs_handle);
5630
5631 return 0;
5632 }
5633 mpu9250_interface_debug_print("mpu9250: check accel compare with previous sample %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
5634
5635 /* mpu9250_set_accelerometer_x_offset/mpu9250_get_accelerometer_x_offset test */
5636 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_x_offset/mpu9250_get_accelerometer_x_offset test.\n");
5637
5638 offset = rand() % 32768;
5639 res = mpu9250_set_accelerometer_x_offset(&gs_handle, offset);
5640 if (res != 0)
5641 {
5642 mpu9250_interface_debug_print("mpu9250: set accelerometer x offset failed.\n");
5643 (void)mpu9250_deinit(&gs_handle);
5644
5645 return 0;
5646 }
5647 mpu9250_interface_debug_print("mpu9250: set accelerometer x offset %d.\n", offset);
5648 res = mpu9250_get_accelerometer_x_offset(&gs_handle, &offset_check);
5649 if (res != 0)
5650 {
5651 mpu9250_interface_debug_print("mpu9250: get accelerometer x offset failed.\n");
5652 (void)mpu9250_deinit(&gs_handle);
5653
5654 return 0;
5655 }
5656 mpu9250_interface_debug_print("mpu9250: check accelerometer x offset %s.\n", offset_check == offset ? "ok" : "error");
5657
5658 /* mpu9250_set_accelerometer_y_offset/mpu9250_get_accelerometer_y_offset test */
5659 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_y_offset/mpu9250_get_accelerometer_y_offset test.\n");
5660
5661 offset = -(rand() % 32768);
5662 res = mpu9250_set_accelerometer_y_offset(&gs_handle, offset);
5663 if (res != 0)
5664 {
5665 mpu9250_interface_debug_print("mpu9250: set accelerometer y offset failed.\n");
5666 (void)mpu9250_deinit(&gs_handle);
5667
5668 return 0;
5669 }
5670 mpu9250_interface_debug_print("mpu9250: set accelerometer y offset %d.\n", offset);
5671 res = mpu9250_get_accelerometer_y_offset(&gs_handle, &offset_check);
5672 if (res != 0)
5673 {
5674 mpu9250_interface_debug_print("mpu9250: get accelerometer y offset failed.\n");
5675 (void)mpu9250_deinit(&gs_handle);
5676
5677 return 0;
5678 }
5679 mpu9250_interface_debug_print("mpu9250: check accelerometer y offset %s.\n", offset_check == offset ? "ok" : "error");
5680
5681 /* mpu9250_set_accelerometer_z_offset/mpu9250_get_accelerometer_z_offset test */
5682 mpu9250_interface_debug_print("mpu9250: mpu9250_set_accelerometer_z_offset/mpu9250_get_accelerometer_z_offset test.\n");
5683
5684 offset = rand() % 32768;
5685 res = mpu9250_set_accelerometer_z_offset(&gs_handle, offset);
5686 if (res != 0)
5687 {
5688 mpu9250_interface_debug_print("mpu9250: set accelerometer z offset failed.\n");
5689 (void)mpu9250_deinit(&gs_handle);
5690
5691 return 0;
5692 }
5693 mpu9250_interface_debug_print("mpu9250: set accelerometer z offset %d.\n", offset);
5694 res = mpu9250_get_accelerometer_z_offset(&gs_handle, &offset_check);
5695 if (res != 0)
5696 {
5697 mpu9250_interface_debug_print("mpu9250: get accelerometer z offset failed.\n");
5698 (void)mpu9250_deinit(&gs_handle);
5699
5700 return 0;
5701 }
5702 mpu9250_interface_debug_print("mpu9250: check accelerometer z offset %s.\n", offset_check == offset ? "ok" : "error");
5703
5704 /* mpu9250_accelerometer_offset_convert_to_register/mpu9250_accelerometer_offset_convert_to_data test */
5705 mpu9250_interface_debug_print("mpu9250: mpu9250_accelerometer_offset_convert_to_register/mpu9250_accelerometer_offset_convert_to_data test.\n");
5706
5707 test_f = (float)(rand() % 1000) / 10.0f;
5708 res = mpu9250_accelerometer_offset_convert_to_register(&gs_handle, test_f, &offset);
5709 if (res != 0)
5710 {
5711 mpu9250_interface_debug_print("mpu9250: accelerometer offset convert to register failed.\n");
5712 (void)mpu9250_deinit(&gs_handle);
5713
5714 return 0;
5715 }
5716 mpu9250_interface_debug_print("mpu9250: accelerometer offset convert to register %0.2f.\n", test_f);
5717 res = mpu9250_accelerometer_offset_convert_to_data(&gs_handle, offset, &test_check_f);
5718 if (res != 0)
5719 {
5720 mpu9250_interface_debug_print("mpu9250: accelerometer offset convert to data failed.\n");
5721 (void)mpu9250_deinit(&gs_handle);
5722
5723 return 0;
5724 }
5725 mpu9250_interface_debug_print("mpu9250: check accelerometer offset %0.2f.\n", test_check_f);
5726
5727 /* mpu9250_set_gyro_x_offset/mpu9250_get_gyro_x_offset test */
5728 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyro_x_offset/mpu9250_get_gyro_x_offset test.\n");
5729
5730 offset = rand() % 32768;
5731 res = mpu9250_set_gyro_x_offset(&gs_handle, offset);
5732 if (res != 0)
5733 {
5734 mpu9250_interface_debug_print("mpu9250: set gyro x offset failed.\n");
5735 (void)mpu9250_deinit(&gs_handle);
5736
5737 return 0;
5738 }
5739 mpu9250_interface_debug_print("mpu9250: set gyro x offset %d.\n", offset);
5740 res = mpu9250_get_gyro_x_offset(&gs_handle, &offset_check);
5741 if (res != 0)
5742 {
5743 mpu9250_interface_debug_print("mpu9250: get gyro x offset failed.\n");
5744 (void)mpu9250_deinit(&gs_handle);
5745
5746 return 0;
5747 }
5748 mpu9250_interface_debug_print("mpu9250: check gyro x offset %s.\n", offset_check == offset ? "ok" : "error");
5749
5750 /* mpu9250_set_gyro_y_offset/mpu9250_get_gyro_y_offset test */
5751 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyro_y_offset/mpu9250_get_gyro_y_offset test.\n");
5752
5753 offset = -(rand() % 32768);
5754 res = mpu9250_set_gyro_y_offset(&gs_handle, offset);
5755 if (res != 0)
5756 {
5757 mpu9250_interface_debug_print("mpu9250: set gyro y offset failed.\n");
5758 (void)mpu9250_deinit(&gs_handle);
5759
5760 return 0;
5761 }
5762 mpu9250_interface_debug_print("mpu9250: set gyro y offset %d.\n", offset);
5763 res = mpu9250_get_gyro_y_offset(&gs_handle, &offset_check);
5764 if (res != 0)
5765 {
5766 mpu9250_interface_debug_print("mpu9250: get gyro y offset failed.\n");
5767 (void)mpu9250_deinit(&gs_handle);
5768
5769 return 0;
5770 }
5771 mpu9250_interface_debug_print("mpu9250: check gyro y offset %s.\n", offset_check == offset ? "ok" : "error");
5772
5773 /* mpu9250_set_gyro_z_offset/mpu9250_get_gyro_z_offset test */
5774 mpu9250_interface_debug_print("mpu9250: mpu9250_set_gyro_z_offset/mpu9250_get_gyro_z_offset test.\n");
5775
5776 offset = rand() % 32768;
5777 res = mpu9250_set_gyro_z_offset(&gs_handle, offset);
5778 if (res != 0)
5779 {
5780 mpu9250_interface_debug_print("mpu9250: set gyro z offset failed.\n");
5781 (void)mpu9250_deinit(&gs_handle);
5782
5783 return 0;
5784 }
5785 mpu9250_interface_debug_print("mpu9250: set gyro z offset %d.\n", offset);
5786 res = mpu9250_get_gyro_z_offset(&gs_handle, &offset_check);
5787 if (res != 0)
5788 {
5789 mpu9250_interface_debug_print("mpu9250: get gyro z offset failed.\n");
5790 (void)mpu9250_deinit(&gs_handle);
5791
5792 return 0;
5793 }
5794 mpu9250_interface_debug_print("mpu9250: check gyro z offset %s.\n", offset_check == offset ? "ok" : "error");
5795
5796 /* mpu9250_gyro_offset_convert_to_register/mpu9250_gyro_offset_convert_to_data test */
5797 mpu9250_interface_debug_print("mpu9250: mpu9250_gyro_offset_convert_to_register/mpu9250_gyro_offset_convert_to_data test.\n");
5798
5799 test_f = (float)(rand() % 1000) / 10.0f;
5800 res = mpu9250_gyro_offset_convert_to_register(&gs_handle, test_f, &offset);
5801 if (res != 0)
5802 {
5803 mpu9250_interface_debug_print("mpu9250: gyro offset convert to register failed.\n");
5804 (void)mpu9250_deinit(&gs_handle);
5805
5806 return 0;
5807 }
5808 mpu9250_interface_debug_print("mpu9250: gyro offset convert to register %0.2f.\n", test_f);
5809 res = mpu9250_gyro_offset_convert_to_data(&gs_handle, offset, &test_check_f);
5810 if (res != 0)
5811 {
5812 mpu9250_interface_debug_print("mpu9250: gyro offset convert to data failed.\n");
5813 (void)mpu9250_deinit(&gs_handle);
5814
5815 return 0;
5816 }
5817 mpu9250_interface_debug_print("mpu9250: check gyro offset %0.2f.\n", test_check_f);
5818
5819 /* if iic interface */
5820 if (interface == MPU9250_INTERFACE_IIC)
5821 {
5822 /* magnetometer test */
5823 mpu9250_interface_debug_print("mpu9250: magnetometer test.\n");
5824
5825 /* mag init */
5826 res = mpu9250_mag_init(&gs_handle);
5827 if (res != 0)
5828 {
5829 mpu9250_interface_debug_print("mpu9250: mag init failed.\n");
5830 (void)mpu9250_deinit(&gs_handle);
5831
5832 return 0;
5833 }
5834
5835 /* mpu9250_mag_get_info test */
5836 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_get_info test.\n");
5837
5838 /* mag get the information */
5839 res = mpu9250_mag_get_info(&gs_handle, &test_check);
5840 if (res != 0)
5841 {
5842 mpu9250_interface_debug_print("mpu9250: mag get info failed.\n");
5843 (void)mpu9250_mag_deinit(&gs_handle);
5844 (void)mpu9250_deinit(&gs_handle);
5845
5846 return 0;
5847 }
5848 mpu9250_interface_debug_print("mpu9250: mag information is 0x%2X.\n", test_check);
5849
5850 /* mpu9250_mag_get_status1 test */
5851 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_get_status1 test.\n");
5852
5853 /* mag get the status1 */
5854 res = mpu9250_mag_get_status1(&gs_handle, &test_check);
5855 if (res != 0)
5856 {
5857 mpu9250_interface_debug_print("mpu9250: mag get status1 failed.\n");
5858 (void)mpu9250_mag_deinit(&gs_handle);
5859 (void)mpu9250_deinit(&gs_handle);
5860
5861 return 0;
5862 }
5863 mpu9250_interface_debug_print("mpu9250: mag status1 is 0x%02X.\n", test_check);
5864
5865 /* mpu9250_mag_get_status2 test */
5866 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_get_status2 test.\n");
5867
5868 /* mag get the status2 */
5869 res = mpu9250_mag_get_status1(&gs_handle, &test_check);
5870 if (res != 0)
5871 {
5872 mpu9250_interface_debug_print("mpu9250: mag get status2 failed.\n");
5873 (void)mpu9250_mag_deinit(&gs_handle);
5874 (void)mpu9250_deinit(&gs_handle);
5875
5876 return 0;
5877 }
5878 mpu9250_interface_debug_print("mpu9250: mag status2 is 0x%02X.\n", test_check);
5879
5880 /* mpu9250_mag_set_mode/mpu9250_mag_get_mode test */
5881 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_set_mode/mpu9250_mag_get_mode test.\n");
5882
5883 /* set the single measurement mode */
5884 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_SINGLE);
5885 if (res != 0)
5886 {
5887 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
5888 (void)mpu9250_mag_deinit(&gs_handle);
5889 (void)mpu9250_deinit(&gs_handle);
5890
5891 return 0;
5892 }
5893 mpu9250_interface_debug_print("mpu9250: set the single measurement mode.\n");
5894 res = mpu9250_mag_get_mode(&gs_handle, &mag_mode);
5895 if (res != 0)
5896 {
5897 mpu9250_interface_debug_print("mpu9250: mag get mode failed.\n");
5898 (void)mpu9250_mag_deinit(&gs_handle);
5899 (void)mpu9250_deinit(&gs_handle);
5900
5901 return 0;
5902 }
5903 mpu9250_interface_debug_print("mpu9250: check mag mode %s.\n", mag_mode == MPU9250_MAGNETOMETER_MODE_SINGLE ? "ok" : "error");
5904
5905 /* set the continuous measurement mode 1 */
5906 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_CONTINUOUS1);
5907 if (res != 0)
5908 {
5909 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
5910 (void)mpu9250_mag_deinit(&gs_handle);
5911 (void)mpu9250_deinit(&gs_handle);
5912
5913 return 0;
5914 }
5915 mpu9250_interface_debug_print("mpu9250: set the continuous measurement mode 1.\n");
5916 res = mpu9250_mag_get_mode(&gs_handle, &mag_mode);
5917 if (res != 0)
5918 {
5919 mpu9250_interface_debug_print("mpu9250: mag get mode failed.\n");
5920 (void)mpu9250_mag_deinit(&gs_handle);
5921 (void)mpu9250_deinit(&gs_handle);
5922
5923 return 0;
5924 }
5925 mpu9250_interface_debug_print("mpu9250: check mag mode %s.\n", mag_mode == MPU9250_MAGNETOMETER_MODE_CONTINUOUS1 ? "ok" : "error");
5926
5927 /* set the continuous measurement mode 2 */
5928 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_CONTINUOUS2);
5929 if (res != 0)
5930 {
5931 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
5932 (void)mpu9250_mag_deinit(&gs_handle);
5933 (void)mpu9250_deinit(&gs_handle);
5934
5935 return 0;
5936 }
5937 mpu9250_interface_debug_print("mpu9250: set the continuous measurement mode 2.\n");
5938 res = mpu9250_mag_get_mode(&gs_handle, &mag_mode);
5939 if (res != 0)
5940 {
5941 mpu9250_interface_debug_print("mpu9250: mag get mode failed.\n");
5942 (void)mpu9250_mag_deinit(&gs_handle);
5943 (void)mpu9250_deinit(&gs_handle);
5944
5945 return 0;
5946 }
5947 mpu9250_interface_debug_print("mpu9250: check mag mode %s.\n", mag_mode == MPU9250_MAGNETOMETER_MODE_CONTINUOUS2 ? "ok" : "error");
5948
5949 /* set the external trigger measurement mode */
5950 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_EXT_TRIGGER);
5951 if (res != 0)
5952 {
5953 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
5954 (void)mpu9250_mag_deinit(&gs_handle);
5955 (void)mpu9250_deinit(&gs_handle);
5956
5957 return 0;
5958 }
5959 mpu9250_interface_debug_print("mpu9250: set the external trigger measurement mode.\n");
5960 res = mpu9250_mag_get_mode(&gs_handle, &mag_mode);
5961 if (res != 0)
5962 {
5963 mpu9250_interface_debug_print("mpu9250: mag get mode failed.\n");
5964 (void)mpu9250_mag_deinit(&gs_handle);
5965 (void)mpu9250_deinit(&gs_handle);
5966
5967 return 0;
5968 }
5969 mpu9250_interface_debug_print("mpu9250: check mag mode %s.\n", mag_mode == MPU9250_MAGNETOMETER_MODE_EXT_TRIGGER ? "ok" : "error");
5970
5971 /* set the self test mode */
5972 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_SELF_TEST);
5973 if (res != 0)
5974 {
5975 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
5976 (void)mpu9250_mag_deinit(&gs_handle);
5977 (void)mpu9250_deinit(&gs_handle);
5978
5979 return 0;
5980 }
5981 mpu9250_interface_debug_print("mpu9250: set the self test mode.\n");
5982 res = mpu9250_mag_get_mode(&gs_handle, &mag_mode);
5983 if (res != 0)
5984 {
5985 mpu9250_interface_debug_print("mpu9250: mag get mode failed.\n");
5986 (void)mpu9250_mag_deinit(&gs_handle);
5987 (void)mpu9250_deinit(&gs_handle);
5988
5989 return 0;
5990 }
5991 mpu9250_interface_debug_print("mpu9250: check mag mode %s.\n", mag_mode == MPU9250_MAGNETOMETER_MODE_SELF_TEST ? "ok" : "error");
5992
5993 /* set the fuse rom access mode */
5994 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_FUSE_ROM);
5995 if (res != 0)
5996 {
5997 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
5998 (void)mpu9250_mag_deinit(&gs_handle);
5999 (void)mpu9250_deinit(&gs_handle);
6000
6001 return 0;
6002 }
6003 mpu9250_interface_debug_print("mpu9250: set the fuse rom access mode.\n");
6004 res = mpu9250_mag_get_mode(&gs_handle, &mag_mode);
6005 if (res != 0)
6006 {
6007 mpu9250_interface_debug_print("mpu9250: mag get mode failed.\n");
6008 (void)mpu9250_mag_deinit(&gs_handle);
6009 (void)mpu9250_deinit(&gs_handle);
6010
6011 return 0;
6012 }
6013 mpu9250_interface_debug_print("mpu9250: check mag mode %s.\n", mag_mode == MPU9250_MAGNETOMETER_MODE_FUSE_ROM ? "ok" : "error");
6014
6015 /* set the power down mode */
6016 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_POWER_DOWN);
6017 if (res != 0)
6018 {
6019 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
6020 (void)mpu9250_mag_deinit(&gs_handle);
6021 (void)mpu9250_deinit(&gs_handle);
6022
6023 return 0;
6024 }
6025 mpu9250_interface_debug_print("mpu9250: set the power down mode.\n");
6026 res = mpu9250_mag_get_mode(&gs_handle, &mag_mode);
6027 if (res != 0)
6028 {
6029 mpu9250_interface_debug_print("mpu9250: mag get mode failed.\n");
6030 (void)mpu9250_mag_deinit(&gs_handle);
6031 (void)mpu9250_deinit(&gs_handle);
6032
6033 return 0;
6034 }
6035 mpu9250_interface_debug_print("mpu9250: check mag mode %s.\n", mag_mode == MPU9250_MAGNETOMETER_MODE_POWER_DOWN ? "ok" : "error");
6036
6037 /* mpu9250_mag_set_bits/mpu9250_mag_get_bits test */
6038 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_set_bits/mpu9250_mag_get_bits test.\n");
6039
6040 /* set 14 bits */
6041 res = mpu9250_mag_set_bits(&gs_handle, MPU9250_MAGNETOMETER_BITS_14);
6042 if (res != 0)
6043 {
6044 mpu9250_interface_debug_print("mpu9250: mag set bits failed.\n");
6045 (void)mpu9250_mag_deinit(&gs_handle);
6046 (void)mpu9250_deinit(&gs_handle);
6047
6048 return 0;
6049 }
6050 mpu9250_interface_debug_print("mpu9250: set the 14 bits mode.\n");
6051 res = mpu9250_mag_get_bits(&gs_handle, &bits);
6052 if (res != 0)
6053 {
6054 mpu9250_interface_debug_print("mpu9250: mag get bits failed.\n");
6055 (void)mpu9250_mag_deinit(&gs_handle);
6056 (void)mpu9250_deinit(&gs_handle);
6057
6058 return 0;
6059 }
6060 mpu9250_interface_debug_print("mpu9250: check mag bits %s.\n", bits == MPU9250_MAGNETOMETER_BITS_14 ? "ok" : "error");
6061
6062 /* set 16 bits */
6063 res = mpu9250_mag_set_bits(&gs_handle, MPU9250_MAGNETOMETER_BITS_16);
6064 if (res != 0)
6065 {
6066 mpu9250_interface_debug_print("mpu9250: mag set bits failed.\n");
6067 (void)mpu9250_mag_deinit(&gs_handle);
6068 (void)mpu9250_deinit(&gs_handle);
6069
6070 return 0;
6071 }
6072 mpu9250_interface_debug_print("mpu9250: set the 16 bits mode.\n");
6073 res = mpu9250_mag_get_bits(&gs_handle, &bits);
6074 if (res != 0)
6075 {
6076 mpu9250_interface_debug_print("mpu9250: mag get bits failed.\n");
6077 (void)mpu9250_mag_deinit(&gs_handle);
6078 (void)mpu9250_deinit(&gs_handle);
6079
6080 return 0;
6081 }
6082 mpu9250_interface_debug_print("mpu9250: check mag bits %s.\n", bits == MPU9250_MAGNETOMETER_BITS_16 ? "ok" : "error");
6083
6084 /* mpu9250_mag_set_reset/mpu9250_mag_get_reset test */
6085 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_set_reset/mpu9250_mag_get_reset test.\n");
6086
6087 /* disable mag reset */
6088 res = mpu9250_mag_set_reset(&gs_handle, MPU9250_BOOL_FALSE);
6089 if (res != 0)
6090 {
6091 mpu9250_interface_debug_print("mpu9250: mag set reset failed.\n");
6092 (void)mpu9250_mag_deinit(&gs_handle);
6093 (void)mpu9250_deinit(&gs_handle);
6094
6095 return 0;
6096 }
6097 mpu9250_interface_debug_print("mpu9250: disable the mag reset.\n");
6098 res = mpu9250_mag_get_reset(&gs_handle, &enable);
6099 if (res != 0)
6100 {
6101 mpu9250_interface_debug_print("mpu9250: mag get reset failed.\n");
6102 (void)mpu9250_mag_deinit(&gs_handle);
6103 (void)mpu9250_deinit(&gs_handle);
6104
6105 return 0;
6106 }
6107 mpu9250_interface_debug_print("mpu9250: check reset %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
6108
6109 /* mpu9250_mag_set_self_test/mpu9250_mag_get_self_test test */
6110 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_set_self_test/mpu9250_mag_get_self_test test.\n");
6111
6112 /* disable mag self test */
6113 res = mpu9250_mag_set_self_test(&gs_handle, MPU9250_BOOL_FALSE);
6114 if (res != 0)
6115 {
6116 mpu9250_interface_debug_print("mpu9250: mag set self test failed.\n");
6117 (void)mpu9250_mag_deinit(&gs_handle);
6118 (void)mpu9250_deinit(&gs_handle);
6119
6120 return 0;
6121 }
6122 mpu9250_interface_debug_print("mpu9250: disable mag self test.\n");
6123 res = mpu9250_mag_get_self_test(&gs_handle, &enable);
6124 if (res != 0)
6125 {
6126 mpu9250_interface_debug_print("mpu9250: mag get self test failed.\n");
6127 (void)mpu9250_mag_deinit(&gs_handle);
6128 (void)mpu9250_deinit(&gs_handle);
6129
6130 return 0;
6131 }
6132 mpu9250_interface_debug_print("mpu9250: check mag self test %s.\n", enable == MPU9250_BOOL_FALSE ? "ok" : "error");
6133
6134 /* mpu9250_mag_get_asa test */
6135 mpu9250_interface_debug_print("mpu9250: mpu9250_mag_get_asa test.\n");
6136
6137 /* set the fuse rom access mode */
6138 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_FUSE_ROM);
6139 if (res != 0)
6140 {
6141 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
6142 (void)mpu9250_mag_deinit(&gs_handle);
6143 (void)mpu9250_deinit(&gs_handle);
6144
6145 return 0;
6146 }
6147 res = mpu9250_mag_get_asa(&gs_handle, data);
6148 if (res != 0)
6149 {
6150 mpu9250_interface_debug_print("mpu9250: mag get asa failed.\n");
6151 (void)mpu9250_mag_deinit(&gs_handle);
6152 (void)mpu9250_deinit(&gs_handle);
6153
6154 return 0;
6155 }
6156 mpu9250_interface_debug_print("mpu9250: mag asax: 0x%02X asay: 0x%02X asaz: 0x%02X.\n", data[0], data[1], data[2]);
6157
6158 /* set the power down mode */
6159 res = mpu9250_mag_set_mode(&gs_handle, MPU9250_MAGNETOMETER_MODE_POWER_DOWN);
6160 if (res != 0)
6161 {
6162 mpu9250_interface_debug_print("mpu9250: mag set mode failed.\n");
6163 (void)mpu9250_mag_deinit(&gs_handle);
6164 (void)mpu9250_deinit(&gs_handle);
6165
6166 return 0;
6167 }
6168
6169 /* deinit */
6170 (void)mpu9250_mag_deinit(&gs_handle);
6171 }
6172
6173 /* finish register test */
6174 mpu9250_interface_debug_print("mpu9250: finish register test.\n");
6175 (void)mpu9250_deinit(&gs_handle);
6176
6177 return 0;
6178 }
driver_mpu9250_register_test.h
driver mpu9250 register test header file
mpu9250_get_addr_pin
uint8_t mpu9250_get_addr_pin(mpu9250_handle_t *handle, mpu9250_address_t *addr_pin)
get the chip address pin
Definition: driver_mpu9250.c:3985
mpu9250_set_accelerometer_z_test
uint8_t mpu9250_set_accelerometer_z_test(mpu9250_handle_t *handle, uint8_t data)
set the accelerometer z test
Definition: driver_mpu9250.c:9341
mpu9250_get_accel_compare_with_previous_sample
uint8_t mpu9250_get_accel_compare_with_previous_sample(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the accel compare with previous sample status
Definition: driver_mpu9250.c:8177
mpu9250_get_interrupt_pin_type
uint8_t mpu9250_get_interrupt_pin_type(mpu9250_handle_t *handle, mpu9250_pin_type_t *type)
get the interrupt pin type
Definition: driver_mpu9250.c:8425
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_get_iic_read_mode
uint8_t mpu9250_get_iic_read_mode(mpu9250_handle_t *handle, mpu9250_iic_read_mode_t *mode)
get the iic read mode
Definition: driver_mpu9250.c:10469
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_accelerometer_z_offset
uint8_t mpu9250_set_accelerometer_z_offset(mpu9250_handle_t *handle, int16_t offset)
set the accelerometer z offset
Definition: driver_mpu9250.c:9561
mpu9250_get_interrupt_read_clear
uint8_t mpu9250_get_interrupt_read_clear(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the interrupt reading clear status
Definition: driver_mpu9250.c:8589
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_get_iic_master
uint8_t mpu9250_get_iic_master(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic master status
Definition: driver_mpu9250.c:5924
mpu9250_get_iic_enable
uint8_t mpu9250_get_iic_enable(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_bool_t *enable)
get the iic status
Definition: driver_mpu9250.c:11533
mpu9250_get_iic4_enable
uint8_t mpu9250_get_iic4_enable(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic4 status
Definition: driver_mpu9250.c:12559
mpu9250_get_fsync_interrupt_level
uint8_t mpu9250_get_fsync_interrupt_level(mpu9250_handle_t *handle, mpu9250_pin_level_t *level)
get the fsync interrupt level
Definition: driver_mpu9250.c:8671
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_get_fifo_mode
uint8_t mpu9250_get_fifo_mode(mpu9250_handle_t *handle, mpu9250_fifo_mode *mode)
get the fifo mode
Definition: driver_mpu9250.c:7294
mpu9250_get_accelerometer_low_pass_filter
uint8_t mpu9250_get_accelerometer_low_pass_filter(mpu9250_handle_t *handle, mpu9250_accelerometer_low_pass_filter_t *filter)
get the accelerometer low pass filter
Definition: driver_mpu9250.c:7931
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_get_gyro_z_offset
uint8_t mpu9250_get_gyro_z_offset(mpu9250_handle_t *handle, int16_t *offset)
get the gyro z offset
Definition: driver_mpu9250.c:9878
mpu9250_get_iic_mode
uint8_t mpu9250_get_iic_mode(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_iic_mode_t *mode)
get the iic mode
Definition: driver_mpu9250.c:10780
mpu9250_get_iic_bypass
uint8_t mpu9250_get_iic_bypass(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic bypass status
Definition: driver_mpu9250.c:8835
mpu9250_get_gyroscope_y_test
uint8_t mpu9250_get_gyroscope_y_test(mpu9250_handle_t *handle, uint8_t *data)
get the gyroscope y test
Definition: driver_mpu9250.c:9096
mpu9250_get_sample_rate_divider
uint8_t mpu9250_get_sample_rate_divider(mpu9250_handle_t *handle, uint8_t *d)
get the sample rate divider
Definition: driver_mpu9250.c:7050
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_accelerometer_y_test
uint8_t mpu9250_set_accelerometer_y_test(mpu9250_handle_t *handle, uint8_t data)
set the accelerometer y test
Definition: driver_mpu9250.c:9271
mpu9250_get_wake_on_motion
uint8_t mpu9250_get_wake_on_motion(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the wake on motion status
Definition: driver_mpu9250.c:8095
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_iic4_data_in
uint8_t mpu9250_set_iic4_data_in(mpu9250_handle_t *handle, uint8_t data)
set the iic4 data in
Definition: driver_mpu9250.c:12919
mpu9250_get_gyro_y_offset
uint8_t mpu9250_get_gyro_y_offset(mpu9250_handle_t *handle, int16_t *offset)
get the gyro y offset
Definition: driver_mpu9250.c:9803
mpu9250_accelerometer_range_t
mpu9250_accelerometer_range_t
mpu9250 accelerometer range enumeration definition
Definition: driver_mpu9250.h:211
mpu9250_get_accelerometer_z_offset
uint8_t mpu9250_get_accelerometer_z_offset(mpu9250_handle_t *handle, int16_t *offset)
get the accelerometer z offset
Definition: driver_mpu9250.c:9599
mpu9250_get_iic_byte_swap
uint8_t mpu9250_get_iic_byte_swap(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_bool_t *enable)
get the iic byte swap status
Definition: driver_mpu9250.c:11727
mpu9250_get_fifo_count
uint8_t mpu9250_get_fifo_count(mpu9250_handle_t *handle, uint16_t *count)
get the fifo counter value
Definition: driver_mpu9250.c:6861
mpu9250_get_iic_master_reset
uint8_t mpu9250_get_iic_master_reset(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic master reset status
Definition: driver_mpu9250.c:6168
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_accelerometer_offset_convert_to_data
uint8_t mpu9250_accelerometer_offset_convert_to_data(mpu9250_handle_t *handle, int16_t reg, float *mg)
convert the register raw data to the accelerometer offset
Definition: driver_mpu9250.c:9663
mpu9250_get_iic4_interrupt
uint8_t mpu9250_get_iic4_interrupt(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic4 interrupt status
Definition: driver_mpu9250.c:12641
mpu9250_fifo_get
uint8_t mpu9250_fifo_get(mpu9250_handle_t *handle, uint8_t *buf, uint16_t len)
fifo read bytes
Definition: driver_mpu9250.c:6899
mpu9250_get_accelerometer_test
uint8_t mpu9250_get_accelerometer_test(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t *enable)
get the accelerometer test
Definition: driver_mpu9250.c:7633
mpu9250_pin_type_t
mpu9250_pin_type_t
mpu9250 pin type enumeration definition
Definition: driver_mpu9250.h:253
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_get_sleep
uint8_t mpu9250_get_sleep(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the sleep status
Definition: driver_mpu9250.c:6658
mpu9250_get_accelerometer_z_test
uint8_t mpu9250_get_accelerometer_z_test(mpu9250_handle_t *handle, uint8_t *data)
get the accelerometer z test
Definition: driver_mpu9250.c:9376
mpu9250_set_signal_path_reset
uint8_t mpu9250_set_signal_path_reset(mpu9250_handle_t *handle, mpu9250_signal_path_reset_t path)
set the signal path reset
Definition: driver_mpu9250.c:6970
mpu9250_get_accelerometer_range
uint8_t mpu9250_get_accelerometer_range(mpu9250_handle_t *handle, mpu9250_accelerometer_range_t *range)
get the accelerometer range
Definition: driver_mpu9250.c:7715
mpu9250_get_ptat
uint8_t mpu9250_get_ptat(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the temperature sensor status
Definition: driver_mpu9250.c:6494
mpu9250_get_iic_multi_master
uint8_t mpu9250_get_iic_multi_master(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic multi master status
Definition: driver_mpu9250.c:10305
mpu9250_get_iic_data_out
uint8_t mpu9250_get_iic_data_out(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t *data)
get the iic data out
Definition: driver_mpu9250.c:11344
mpu9250_set_iic_transferred_len
uint8_t mpu9250_set_iic_transferred_len(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t len)
set the iic transferred length
Definition: driver_mpu9250.c:12197
mpu9250_fifo_reset
uint8_t mpu9250_fifo_reset(mpu9250_handle_t *handle)
reset the fifo
Definition: driver_mpu9250.c:6042
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_accelerometer_offset_convert_to_register
uint8_t mpu9250_accelerometer_offset_convert_to_register(mpu9250_handle_t *handle, float mg, int16_t *reg)
convert the accelerometer offset to the register raw data
Definition: driver_mpu9250.c:9636
mpu9250_get_sensor_reset
uint8_t mpu9250_get_sensor_reset(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the sensor reset status
Definition: driver_mpu9250.c:6249
mpu9250_address_t
mpu9250_address_t
mpu9250 address enumeration definition
Definition: driver_mpu9250.h:72
mpu9250_gyroscope_range_t
mpu9250_gyroscope_range_t
mpu9250 gyroscope range enumeration definition
Definition: driver_mpu9250.h:200
mpu9250_set_iic4_data_out
uint8_t mpu9250_set_iic4_data_out(mpu9250_handle_t *handle, uint8_t data)
set the iic4 data out
Definition: driver_mpu9250.c:12849
mpu9250_set_iic_register
uint8_t mpu9250_set_iic_register(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t reg)
set the iic register
Definition: driver_mpu9250.c:11096
mpu9250_get_accelerometer_choice
uint8_t mpu9250_get_accelerometer_choice(mpu9250_handle_t *handle, uint8_t *choice)
get the accelerometer choice
Definition: driver_mpu9250.c:7849
mpu9250_set_iic_data_out
uint8_t mpu9250_set_iic_data_out(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t data)
set the iic data out
Definition: driver_mpu9250.c:11268
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_get_iic4_transaction_mode
uint8_t mpu9250_get_iic4_transaction_mode(mpu9250_handle_t *handle, mpu9250_iic4_transaction_mode_t *mode)
get the iic4 transaction mode
Definition: driver_mpu9250.c:12723
mpu9250_get_interrupt
uint8_t mpu9250_get_interrupt(mpu9250_handle_t *handle, mpu9250_interrupt_t type, mpu9250_bool_t *enable)
get the interrupt status
Definition: driver_mpu9250.c:8919
mpu9250_set_accelerometer_y_offset
uint8_t mpu9250_set_accelerometer_y_offset(mpu9250_handle_t *handle, int16_t offset)
set the accelerometer y offset
Definition: driver_mpu9250.c:9486
mpu9250_motion_threshold_convert_to_data
uint8_t mpu9250_motion_threshold_convert_to_data(mpu9250_handle_t *handle, uint8_t reg, float *mg)
convert the register raw data to the motion threshold
Definition: driver_mpu9250.c:10066
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_get_standby_mode
uint8_t mpu9250_get_standby_mode(mpu9250_handle_t *handle, mpu9250_source_t source, mpu9250_bool_t *enable)
get the source mode
Definition: driver_mpu9250.c:6824
mpu9250_get_clock_source
uint8_t mpu9250_get_clock_source(mpu9250_handle_t *handle, mpu9250_clock_source_t *clock_source)
get the chip clock source
Definition: driver_mpu9250.c:6412
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_gyroscope_x_test
uint8_t mpu9250_set_gyroscope_x_test(mpu9250_handle_t *handle, uint8_t data)
set the gyroscope x test
Definition: driver_mpu9250.c:8991
mpu9250_get_iic4_data_out
uint8_t mpu9250_get_iic4_data_out(mpu9250_handle_t *handle, uint8_t *data)
get the iic4 data out
Definition: driver_mpu9250.c:12884
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_get_extern_sync
uint8_t mpu9250_get_extern_sync(mpu9250_handle_t *handle, mpu9250_extern_sync_t *sync)
get the extern sync type
Definition: driver_mpu9250.c:7130
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_iic_transaction_mode_t
mpu9250_iic_transaction_mode_t
mpu9250 iic transaction mode enumeration definition
Definition: driver_mpu9250.h:327
mpu9250_set_gyroscope_y_test
uint8_t mpu9250_set_gyroscope_y_test(mpu9250_handle_t *handle, uint8_t data)
set the gyroscope y test
Definition: driver_mpu9250.c:9061
mpu9250_get_gyro_standby
uint8_t mpu9250_get_gyro_standby(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the gyro standby status
Definition: driver_mpu9250.c:6740
mpu9250_set_iic_mode
uint8_t mpu9250_set_iic_mode(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_iic_mode_t mode)
set the iic mode
Definition: driver_mpu9250.c:10648
mpu9250_get_gyroscope_x_test
uint8_t mpu9250_get_gyroscope_x_test(mpu9250_handle_t *handle, uint8_t *data)
get the gyroscope x test
Definition: driver_mpu9250.c:9026
mpu9250_get_fsync_interrupt
uint8_t mpu9250_get_fsync_interrupt(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the fsync interrupt status
Definition: driver_mpu9250.c:8753
mpu9250_extern_sync_t
mpu9250_extern_sync_t
mpu9250 extern sync enumeration definition
Definition: driver_mpu9250.h:123
mpu9250_gyro_offset_convert_to_data
uint8_t mpu9250_gyro_offset_convert_to_data(mpu9250_handle_t *handle, int16_t reg, float *dps)
convert the register raw data to the gyro offset
Definition: driver_mpu9250.c:9942
mpu9250_sensor_reset
uint8_t mpu9250_sensor_reset(mpu9250_handle_t *handle)
reset all sensors
Definition: driver_mpu9250.c:6204
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_get_iic_transaction_mode
uint8_t mpu9250_get_iic_transaction_mode(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_iic_transaction_mode_t *mode)
get the iic transaction mode
Definition: driver_mpu9250.c:11921
mpu9250_interface_t
mpu9250_interface_t
mpu9250 interface enumeration definition
Definition: driver_mpu9250.h:63
mpu9250_bool_t
mpu9250_bool_t
mpu9250 bool enumeration definition
Definition: driver_mpu9250.h:81
mpu9250_set_iic_transaction_mode
uint8_t mpu9250_set_iic_transaction_mode(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_iic_transaction_mode_t mode)
set the iic transaction mode
Definition: driver_mpu9250.c:11808
mpu9250_get_accelerometer_y_test
uint8_t mpu9250_get_accelerometer_y_test(mpu9250_handle_t *handle, uint8_t *data)
get the accelerometer y test
Definition: driver_mpu9250.c:9306
mpu9250_set_gyro_y_offset
uint8_t mpu9250_set_gyro_y_offset(mpu9250_handle_t *handle, int16_t offset)
set the gyro y offset
Definition: driver_mpu9250.c:9765
mpu9250_get_gyroscope_z_test
uint8_t mpu9250_get_gyroscope_z_test(mpu9250_handle_t *handle, uint8_t *data)
get the gyroscope z test
Definition: driver_mpu9250.c:9166
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_get_accelerometer_x_test
uint8_t mpu9250_get_accelerometer_x_test(mpu9250_handle_t *handle, uint8_t *data)
get the accelerometer x test
Definition: driver_mpu9250.c:9236
mpu9250_set_motion_threshold
uint8_t mpu9250_set_motion_threshold(mpu9250_handle_t *handle, uint8_t threshold)
set the motion_threshold
Definition: driver_mpu9250.c:9969
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_get_low_pass_filter
uint8_t mpu9250_get_low_pass_filter(mpu9250_handle_t *handle, mpu9250_low_pass_filter_t *filter)
get the low pass filter
Definition: driver_mpu9250.c:7212
mpu9250_get_interrupt_status
uint8_t mpu9250_get_interrupt_status(mpu9250_handle_t *handle, uint8_t *status)
get the interrupt status
Definition: driver_mpu9250.c:8956
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_set_iic_fifo_enable
uint8_t mpu9250_set_iic_fifo_enable(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_bool_t enable)
enable or disable the iic fifo
Definition: driver_mpu9250.c:10508
mpu9250_deinit
uint8_t mpu9250_deinit(mpu9250_handle_t *handle)
close the chip
Definition: driver_mpu9250.c:4168
mpu9250_get_accelerometer_y_offset
uint8_t mpu9250_get_accelerometer_y_offset(mpu9250_handle_t *handle, int16_t *offset)
get the accelerometer y offset
Definition: driver_mpu9250.c:9524
mpu9250_get_fifo_enable
uint8_t mpu9250_get_fifo_enable(mpu9250_handle_t *handle, mpu9250_fifo_t fifo, mpu9250_bool_t *enable)
get the fifo function status
Definition: driver_mpu9250.c:8261
mpu9250_set_fifo_1024kb
uint8_t mpu9250_set_fifo_1024kb(mpu9250_handle_t *handle)
set fifo 1024kb
Definition: driver_mpu9250.c:7751
mpu9250_get_gyroscope_range
uint8_t mpu9250_get_gyroscope_range(mpu9250_handle_t *handle, mpu9250_gyroscope_range_t *range)
get the gyroscope range
Definition: driver_mpu9250.c:7460
mpu9250_get_interrupt_level
uint8_t mpu9250_get_interrupt_level(mpu9250_handle_t *handle, mpu9250_pin_level_t *level)
get the interrupt level
Definition: driver_mpu9250.c:8343
mpu9250_motion_threshold_convert_to_register
uint8_t mpu9250_motion_threshold_convert_to_register(mpu9250_handle_t *handle, float mg, uint8_t *reg)
convert the motion threshold to the register raw data
Definition: driver_mpu9250.c:10039
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_get_gyroscope_test
uint8_t mpu9250_get_gyroscope_test(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t *enable)
get the gyroscope test
Definition: driver_mpu9250.c:7378
mpu9250_device_reset
uint8_t mpu9250_device_reset(mpu9250_handle_t *handle)
reset the chip
Definition: driver_mpu9250.c:6285
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_get_cycle_wake_up
uint8_t mpu9250_get_cycle_wake_up(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the cycle wake up mode status
Definition: driver_mpu9250.c:6576
mpu9250_low_pass_filter_t
mpu9250_low_pass_filter_t
mpu9250 low pass filter enumeration definition
Definition: driver_mpu9250.h:138
mpu9250_get_iic_group_order
uint8_t mpu9250_get_iic_group_order(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_iic_group_order_t *order)
get the iic group order
Definition: driver_mpu9250.c:12115
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_get_disable_iic_slave
uint8_t mpu9250_get_disable_iic_slave(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic slave status
Definition: driver_mpu9250.c:6006
mpu9250_get_iic_delay_enable
uint8_t mpu9250_get_iic_delay_enable(mpu9250_handle_t *handle, mpu9250_iic_delay_t delay, mpu9250_bool_t *enable)
get the iic delay status
Definition: driver_mpu9250.c:12477
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_get_iic_transferred_len
uint8_t mpu9250_get_iic_transferred_len(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t *len)
get the iic transferred length
Definition: driver_mpu9250.c:12316
mpu9250_get_gyro_x_offset
uint8_t mpu9250_get_gyro_x_offset(mpu9250_handle_t *handle, int16_t *offset)
get the gyro x offset
Definition: driver_mpu9250.c:9728
mpu9250_set_iic_address
uint8_t mpu9250_set_iic_address(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t addr_7bit)
set the iic address
Definition: driver_mpu9250.c:10872
mpu9250_fifo_mode
mpu9250_fifo_mode
mpu9250 fifo mode enumeration definition
Definition: driver_mpu9250.h:234
mpu9250_low_power_accel_output_rate_t
mpu9250_low_power_accel_output_rate_t
mpu9250 low power accel output rate enumeration definition
Definition: driver_mpu9250.h:171
mpu9250_get_iic_status
uint8_t mpu9250_get_iic_status(mpu9250_handle_t *handle, uint8_t *status)
get the iic status
Definition: driver_mpu9250.c:12395
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_fifo_set
uint8_t mpu9250_fifo_set(mpu9250_handle_t *handle, uint8_t *buf, uint16_t len)
fifo write bytes
Definition: driver_mpu9250.c:6935
mpu9250_get_iic_fifo_enable
uint8_t mpu9250_get_iic_fifo_enable(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_bool_t *enable)
get the iic fifo status
Definition: driver_mpu9250.c:10586
mpu9250_set_gyro_x_offset
uint8_t mpu9250_set_gyro_x_offset(mpu9250_handle_t *handle, int16_t offset)
set the gyro x offset
Definition: driver_mpu9250.c:9690
mpu9250_set_accelerometer_x_offset
uint8_t mpu9250_set_accelerometer_x_offset(mpu9250_handle_t *handle, int16_t offset)
set the accelerometer x offset
Definition: driver_mpu9250.c:9411
mpu9250_iic_read_mode_t
mpu9250_iic_read_mode_t
mpu9250 iic read mode enumeration definition
Definition: driver_mpu9250.h:309
mpu9250_set_accelerometer_x_test
uint8_t mpu9250_set_accelerometer_x_test(mpu9250_handle_t *handle, uint8_t data)
set the accelerometer x test
Definition: driver_mpu9250.c:9201
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_get_fifo_reset
uint8_t mpu9250_get_fifo_reset(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the fifo reset status
Definition: driver_mpu9250.c:6087
mpu9250_init
uint8_t mpu9250_init(mpu9250_handle_t *handle)
initialize the chip
Definition: driver_mpu9250.c:4009
mpu9250_set_iic_enable
uint8_t mpu9250_set_iic_enable(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_bool_t enable)
enable or disable the iic
Definition: driver_mpu9250.c:11420
mpu9250_get_iic_delay
uint8_t mpu9250_get_iic_delay(mpu9250_handle_t *handle, uint8_t *delay)
get the iic delay
Definition: driver_mpu9250.c:12812
mpu9250_iic4_transaction_mode_t
mpu9250_iic4_transaction_mode_t
mpu9250 iic4 transaction mode enumeration definition
Definition: driver_mpu9250.h:336
mpu9250_set_iic_delay
uint8_t mpu9250_set_iic_delay(mpu9250_handle_t *handle, uint8_t delay)
set the iic delay
Definition: driver_mpu9250.c:12761
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_iic_clock_t
mpu9250_iic_clock_t
mpu9250 iic clock enumeration definition
Definition: driver_mpu9250.h:286
mpu9250_set_iic4_interrupt
uint8_t mpu9250_set_iic4_interrupt(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic4 interrupt
Definition: driver_mpu9250.c:12596
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_iic_group_order_t
mpu9250_iic_group_order_t
mpu9250 iic group order enumeration definition
Definition: driver_mpu9250.h:345
mpu9250_iic_master_reset
uint8_t mpu9250_iic_master_reset(mpu9250_handle_t *handle)
reset the iic master controller
Definition: driver_mpu9250.c:6123
mpu9250_get_device_reset
uint8_t mpu9250_get_device_reset(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the device reset status
Definition: driver_mpu9250.c:6330
mpu9250_get_accelerometer_x_offset
uint8_t mpu9250_get_accelerometer_x_offset(mpu9250_handle_t *handle, int16_t *offset)
get the accelerometer x offset
Definition: driver_mpu9250.c:9449
mpu9250_set_iic_byte_swap
uint8_t mpu9250_set_iic_byte_swap(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_bool_t enable)
enable or disable the iic byte swap
Definition: driver_mpu9250.c:11614
mpu9250_set_gyro_z_offset
uint8_t mpu9250_set_gyro_z_offset(mpu9250_handle_t *handle, int16_t offset)
set the gyro z offset
Definition: driver_mpu9250.c:9840
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_get_fifo
uint8_t mpu9250_get_fifo(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the fifo status
Definition: driver_mpu9250.c:5808
mpu9250_set_iic4_transaction_mode
uint8_t mpu9250_set_iic4_transaction_mode(mpu9250_handle_t *handle, mpu9250_iic4_transaction_mode_t mode)
set the iic4 transaction mode
Definition: driver_mpu9250.c:12678
mpu9250_get_interrupt_latch
uint8_t mpu9250_get_interrupt_latch(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the interrupt latch status
Definition: driver_mpu9250.c:8507
mpu9250_get_gyroscope_choice
uint8_t mpu9250_get_gyroscope_choice(mpu9250_handle_t *handle, uint8_t *choice)
get the gyroscope choice
Definition: driver_mpu9250.c:7549
mpu9250_set_gyroscope_z_test
uint8_t mpu9250_set_gyroscope_z_test(mpu9250_handle_t *handle, uint8_t data)
set the gyroscope z test
Definition: driver_mpu9250.c:9131
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_get_iic_register
uint8_t mpu9250_get_iic_register(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t *reg)
get the iic register
Definition: driver_mpu9250.c:11182
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_gyro_offset_convert_to_register
uint8_t mpu9250_gyro_offset_convert_to_register(mpu9250_handle_t *handle, float dps, int16_t *reg)
convert the gyro offset to the register raw data
Definition: driver_mpu9250.c:9915
mpu9250_get_iic_wait_for_external_sensor
uint8_t mpu9250_get_iic_wait_for_external_sensor(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
get the iic wait for external sensor status
Definition: driver_mpu9250.c:10387
mpu9250_iic_mode_t
mpu9250_iic_mode_t
mpu9250 iic mode enumeration definition
Definition: driver_mpu9250.h:318
mpu9250_get_iic_clock
uint8_t mpu9250_get_iic_clock(mpu9250_handle_t *handle, mpu9250_iic_clock_t *clk)
get the iic clock
Definition: driver_mpu9250.c:10223
mpu9250_accelerometer_low_pass_filter_t
mpu9250_accelerometer_low_pass_filter_t
mpu9250 accelerometer low pass filter enumeration definition
Definition: driver_mpu9250.h:155
mpu9250_set_iic_group_order
uint8_t mpu9250_set_iic_group_order(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, mpu9250_iic_group_order_t order)
set the iic group order
Definition: driver_mpu9250.c:12002
mpu9250_get_motion_threshold
uint8_t mpu9250_get_motion_threshold(mpu9250_handle_t *handle, uint8_t *threshold)
get the motion_threshold
Definition: driver_mpu9250.c:10004
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_get_iic_address
uint8_t mpu9250_get_iic_address(mpu9250_handle_t *handle, mpu9250_iic_slave_t slave, uint8_t *addr_7bit)
get the iic address
Definition: driver_mpu9250.c:11004
mpu9250_get_low_power_accel_output_rate
uint8_t mpu9250_get_low_power_accel_output_rate(mpu9250_handle_t *handle, mpu9250_low_power_accel_output_rate_t *rate)
get the low power accel output rate
Definition: driver_mpu9250.c:8013
mpu9250_set_iic4_enable
uint8_t mpu9250_set_iic4_enable(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic4
Definition: driver_mpu9250.c:12514
mpu9250_pin_level_t
mpu9250_pin_level_t
mpu9250 pin level enumeration definition
Definition: driver_mpu9250.h:244
mpu9250_clock_source_t
mpu9250_clock_source_t
mpu9250 clock source enumeration definition
Definition: driver_mpu9250.h:103
MPU9250_ACCELEROMETER_RANGE_4G
@ MPU9250_ACCELEROMETER_RANGE_4G
Definition: driver_mpu9250.h:213
MPU9250_ACCELEROMETER_RANGE_2G
@ MPU9250_ACCELEROMETER_RANGE_2G
Definition: driver_mpu9250.h:212
MPU9250_ACCELEROMETER_RANGE_16G
@ MPU9250_ACCELEROMETER_RANGE_16G
Definition: driver_mpu9250.h:215
MPU9250_ACCELEROMETER_RANGE_8G
@ MPU9250_ACCELEROMETER_RANGE_8G
Definition: driver_mpu9250.h:214
MPU9250_PIN_TYPE_PUSH_PULL
@ MPU9250_PIN_TYPE_PUSH_PULL
Definition: driver_mpu9250.h:254
MPU9250_PIN_TYPE_OPEN_DRAIN
@ MPU9250_PIN_TYPE_OPEN_DRAIN
Definition: driver_mpu9250.h:255
MPU9250_SIGNAL_PATH_RESET_TEMP
@ MPU9250_SIGNAL_PATH_RESET_TEMP
Definition: driver_mpu9250.h:114
MPU9250_SIGNAL_PATH_RESET_ACCEL
@ MPU9250_SIGNAL_PATH_RESET_ACCEL
Definition: driver_mpu9250.h:115
MPU9250_SIGNAL_PATH_RESET_GYRO
@ MPU9250_SIGNAL_PATH_RESET_GYRO
Definition: driver_mpu9250.h:116
MPU9250_IIC_DELAY_ES_SHADOW
@ MPU9250_IIC_DELAY_ES_SHADOW
Definition: driver_mpu9250.h:372
MPU9250_IIC_DELAY_SLAVE_2
@ MPU9250_IIC_DELAY_SLAVE_2
Definition: driver_mpu9250.h:376
MPU9250_IIC_DELAY_SLAVE_0
@ MPU9250_IIC_DELAY_SLAVE_0
Definition: driver_mpu9250.h:378
MPU9250_IIC_DELAY_SLAVE_1
@ MPU9250_IIC_DELAY_SLAVE_1
Definition: driver_mpu9250.h:377
MPU9250_IIC_DELAY_SLAVE_3
@ MPU9250_IIC_DELAY_SLAVE_3
Definition: driver_mpu9250.h:375
MPU9250_IIC_DELAY_SLAVE_4
@ MPU9250_IIC_DELAY_SLAVE_4
Definition: driver_mpu9250.h:374
MPU9250_ADDRESS_AD0_LOW
@ MPU9250_ADDRESS_AD0_LOW
Definition: driver_mpu9250.h:73
MPU9250_ADDRESS_AD0_HIGH
@ MPU9250_ADDRESS_AD0_HIGH
Definition: driver_mpu9250.h:74
MPU9250_GYROSCOPE_RANGE_2000DPS
@ MPU9250_GYROSCOPE_RANGE_2000DPS
Definition: driver_mpu9250.h:204
MPU9250_GYROSCOPE_RANGE_250DPS
@ MPU9250_GYROSCOPE_RANGE_250DPS
Definition: driver_mpu9250.h:201
MPU9250_GYROSCOPE_RANGE_500DPS
@ MPU9250_GYROSCOPE_RANGE_500DPS
Definition: driver_mpu9250.h:202
MPU9250_GYROSCOPE_RANGE_1000DPS
@ MPU9250_GYROSCOPE_RANGE_1000DPS
Definition: driver_mpu9250.h:203
MPU9250_IIC_TRANSACTION_MODE_REG_DATA
@ MPU9250_IIC_TRANSACTION_MODE_REG_DATA
Definition: driver_mpu9250.h:329
MPU9250_IIC_TRANSACTION_MODE_DATA
@ MPU9250_IIC_TRANSACTION_MODE_DATA
Definition: driver_mpu9250.h:328
MPU9250_IIC_SLAVE_3
@ MPU9250_IIC_SLAVE_3
Definition: driver_mpu9250.h:278
MPU9250_IIC_SLAVE_2
@ MPU9250_IIC_SLAVE_2
Definition: driver_mpu9250.h:277
MPU9250_IIC_SLAVE_4
@ MPU9250_IIC_SLAVE_4
Definition: driver_mpu9250.h:279
MPU9250_IIC_SLAVE_0
@ MPU9250_IIC_SLAVE_0
Definition: driver_mpu9250.h:275
MPU9250_IIC_SLAVE_1
@ MPU9250_IIC_SLAVE_1
Definition: driver_mpu9250.h:276
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_GYRO_YOUT_L
@ MPU9250_EXTERN_SYNC_GYRO_YOUT_L
Definition: driver_mpu9250.h:127
MPU9250_EXTERN_SYNC_ACCEL_XOUT_L
@ MPU9250_EXTERN_SYNC_ACCEL_XOUT_L
Definition: driver_mpu9250.h:129
MPU9250_EXTERN_SYNC_TEMP_OUT_L
@ MPU9250_EXTERN_SYNC_TEMP_OUT_L
Definition: driver_mpu9250.h:125
MPU9250_EXTERN_SYNC_ACCEL_ZOUT_L
@ MPU9250_EXTERN_SYNC_ACCEL_ZOUT_L
Definition: driver_mpu9250.h:131
MPU9250_EXTERN_SYNC_GYRO_ZOUT_L
@ MPU9250_EXTERN_SYNC_GYRO_ZOUT_L
Definition: driver_mpu9250.h:128
MPU9250_EXTERN_SYNC_ACCEL_YOUT_L
@ MPU9250_EXTERN_SYNC_ACCEL_YOUT_L
Definition: driver_mpu9250.h:130
MPU9250_EXTERN_SYNC_INPUT_DISABLED
@ MPU9250_EXTERN_SYNC_INPUT_DISABLED
Definition: driver_mpu9250.h:124
MPU9250_EXTERN_SYNC_GYRO_XOUT_L
@ MPU9250_EXTERN_SYNC_GYRO_XOUT_L
Definition: driver_mpu9250.h:126
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_LOW_PASS_FILTER_4
@ MPU9250_LOW_PASS_FILTER_4
Definition: driver_mpu9250.h:145
MPU9250_LOW_PASS_FILTER_5
@ MPU9250_LOW_PASS_FILTER_5
Definition: driver_mpu9250.h:146
MPU9250_LOW_PASS_FILTER_2
@ MPU9250_LOW_PASS_FILTER_2
Definition: driver_mpu9250.h:143
MPU9250_LOW_PASS_FILTER_6
@ MPU9250_LOW_PASS_FILTER_6
Definition: driver_mpu9250.h:147
MPU9250_LOW_PASS_FILTER_1
@ MPU9250_LOW_PASS_FILTER_1
Definition: driver_mpu9250.h:142
MPU9250_LOW_PASS_FILTER_0
@ MPU9250_LOW_PASS_FILTER_0
Definition: driver_mpu9250.h:141
MPU9250_FIFO_MODE_NORMAL
@ MPU9250_FIFO_MODE_NORMAL
Definition: driver_mpu9250.h:237
MPU9250_FIFO_MODE_STREAM
@ MPU9250_FIFO_MODE_STREAM
Definition: driver_mpu9250.h:235
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P98
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P98
Definition: driver_mpu9250.h:174
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_31P25
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_31P25
Definition: driver_mpu9250.h:179
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_125
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_125
Definition: driver_mpu9250.h:181
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_3P91
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_3P91
Definition: driver_mpu9250.h:176
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_7P81
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_7P81
Definition: driver_mpu9250.h:177
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_1P95
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_1P95
Definition: driver_mpu9250.h:175
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_250
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_250
Definition: driver_mpu9250.h:182
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P24
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P24
Definition: driver_mpu9250.h:172
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P49
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_0P49
Definition: driver_mpu9250.h:173
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_500
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_500
Definition: driver_mpu9250.h:183
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50
Definition: driver_mpu9250.h:180
MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_15P63
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_15P63
Definition: driver_mpu9250.h:178
MPU9250_IIC_READ_MODE_RESTART
@ MPU9250_IIC_READ_MODE_RESTART
Definition: driver_mpu9250.h:310
MPU9250_IIC_READ_MODE_STOP_AND_START
@ MPU9250_IIC_READ_MODE_STOP_AND_START
Definition: driver_mpu9250.h:311
MPU9250_IIC4_TRANSACTION_MODE_DATA
@ MPU9250_IIC4_TRANSACTION_MODE_DATA
Definition: driver_mpu9250.h:337
MPU9250_IIC4_TRANSACTION_MODE_REG
@ MPU9250_IIC4_TRANSACTION_MODE_REG
Definition: driver_mpu9250.h:338
MPU9250_IIC_CLOCK_471_KHZ
@ MPU9250_IIC_CLOCK_471_KHZ
Definition: driver_mpu9250.h:297
MPU9250_IIC_CLOCK_267_KHZ
@ MPU9250_IIC_CLOCK_267_KHZ
Definition: driver_mpu9250.h:294
MPU9250_IIC_CLOCK_348_KHZ
@ MPU9250_IIC_CLOCK_348_KHZ
Definition: driver_mpu9250.h:287
MPU9250_IIC_CLOCK_333_KHZ
@ MPU9250_IIC_CLOCK_333_KHZ
Definition: driver_mpu9250.h:288
MPU9250_IIC_CLOCK_296_KHZ
@ MPU9250_IIC_CLOCK_296_KHZ
Definition: driver_mpu9250.h:291
MPU9250_IIC_CLOCK_276_KHZ
@ MPU9250_IIC_CLOCK_276_KHZ
Definition: driver_mpu9250.h:293
MPU9250_IIC_CLOCK_444_KHZ
@ MPU9250_IIC_CLOCK_444_KHZ
Definition: driver_mpu9250.h:298
MPU9250_IIC_CLOCK_364_KHZ
@ MPU9250_IIC_CLOCK_364_KHZ
Definition: driver_mpu9250.h:302
MPU9250_IIC_CLOCK_421_KHZ
@ MPU9250_IIC_CLOCK_421_KHZ
Definition: driver_mpu9250.h:299
MPU9250_IIC_CLOCK_286_KHZ
@ MPU9250_IIC_CLOCK_286_KHZ
Definition: driver_mpu9250.h:292
MPU9250_IIC_CLOCK_500_KHZ
@ MPU9250_IIC_CLOCK_500_KHZ
Definition: driver_mpu9250.h:296
MPU9250_IIC_CLOCK_320_KHZ
@ MPU9250_IIC_CLOCK_320_KHZ
Definition: driver_mpu9250.h:289
MPU9250_IIC_CLOCK_308_KHZ
@ MPU9250_IIC_CLOCK_308_KHZ
Definition: driver_mpu9250.h:290
MPU9250_IIC_CLOCK_258_KHZ
@ MPU9250_IIC_CLOCK_258_KHZ
Definition: driver_mpu9250.h:295
MPU9250_IIC_CLOCK_381_KHZ
@ MPU9250_IIC_CLOCK_381_KHZ
Definition: driver_mpu9250.h:301
MPU9250_IIC_CLOCK_400_KHZ
@ MPU9250_IIC_CLOCK_400_KHZ
Definition: driver_mpu9250.h:300
MPU9250_IIC_GROUP_ORDER_EVEN
@ MPU9250_IIC_GROUP_ORDER_EVEN
Definition: driver_mpu9250.h:346
MPU9250_IIC_GROUP_ORDER_ODD
@ MPU9250_IIC_GROUP_ORDER_ODD
Definition: driver_mpu9250.h:348
MPU9250_IIC_MODE_READ
@ MPU9250_IIC_MODE_READ
Definition: driver_mpu9250.h:320
MPU9250_IIC_MODE_WRITE
@ MPU9250_IIC_MODE_WRITE
Definition: driver_mpu9250.h:319
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_6
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_6
Definition: driver_mpu9250.h:163
MPU9250_ACCELEROMETER_LOW_PASS_FILTER_1
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_1
Definition: driver_mpu9250.h:158
MPU9250_ACCELEROMETER_LOW_PASS_FILTER_3
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_3
Definition: driver_mpu9250.h:160
MPU9250_ACCELEROMETER_LOW_PASS_FILTER_4
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_4
Definition: driver_mpu9250.h:161
MPU9250_ACCELEROMETER_LOW_PASS_FILTER_2
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_2
Definition: driver_mpu9250.h:159
MPU9250_ACCELEROMETER_LOW_PASS_FILTER_5
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_5
Definition: driver_mpu9250.h:162
MPU9250_ACCELEROMETER_LOW_PASS_FILTER_0
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_0
Definition: driver_mpu9250.h:157
MPU9250_ACCELEROMETER_LOW_PASS_FILTER_7
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_7
Definition: driver_mpu9250.h:164
MPU9250_PIN_LEVEL_HIGH
@ MPU9250_PIN_LEVEL_HIGH
Definition: driver_mpu9250.h:245
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_CLOCK_SOURCE_STOP_CLOCK
@ MPU9250_CLOCK_SOURCE_STOP_CLOCK
Definition: driver_mpu9250.h:106
MPU9250_CLOCK_SOURCE_INTERNAL_20MHZ
@ MPU9250_CLOCK_SOURCE_INTERNAL_20MHZ
Definition: driver_mpu9250.h:104
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_get_status1
uint8_t mpu9250_mag_get_status1(mpu9250_handle_t *handle, uint8_t *status)
magnetometer get the status1
Definition: driver_mpu9250.c:5102
mpu9250_magnetometer_bits_t
mpu9250_magnetometer_bits_t
mpu9250 magnetometer bits enumeration definition
Definition: driver_mpu9250.h:426
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_get_mode
uint8_t mpu9250_mag_get_mode(mpu9250_handle_t *handle, mpu9250_magnetometer_mode_t *mode)
magnetometer get the mode
Definition: driver_mpu9250.c:5238
mpu9250_mag_get_self_test
uint8_t mpu9250_mag_get_self_test(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
magnetometer get the self test status
Definition: driver_mpu9250.c:5526
mpu9250_mag_get_bits
uint8_t mpu9250_mag_get_bits(mpu9250_handle_t *handle, mpu9250_magnetometer_bits_t *bits)
magnetometer get the bits
Definition: driver_mpu9250.c:5334
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_magnetometer_mode_t
mpu9250_magnetometer_mode_t
mpu9250 magnetometer mode enumeration definition
Definition: driver_mpu9250.h:412
mpu9250_mag_set_reset
uint8_t mpu9250_mag_set_reset(mpu9250_handle_t *handle, mpu9250_bool_t enable)
magnetometer enable or disable reset
Definition: driver_mpu9250.c:5378
mpu9250_mag_get_info
uint8_t mpu9250_mag_get_info(mpu9250_handle_t *handle, uint8_t *info)
magnetometer get the information
Definition: driver_mpu9250.c:5060
mpu9250_mag_get_asa
uint8_t mpu9250_mag_get_asa(mpu9250_handle_t *handle, uint8_t asa[3])
magnetometer get the asa data
Definition: driver_mpu9250.c:5613
mpu9250_mag_get_reset
uint8_t mpu9250_mag_get_reset(mpu9250_handle_t *handle, mpu9250_bool_t *enable)
magnetometer get the reset status
Definition: driver_mpu9250.c:5430
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_self_test
uint8_t mpu9250_mag_set_self_test(mpu9250_handle_t *handle, mpu9250_bool_t enable)
magnetometer enable or disable self test
Definition: driver_mpu9250.c:5474
MPU9250_MAGNETOMETER_BITS_16
@ MPU9250_MAGNETOMETER_BITS_16
Definition: driver_mpu9250.h:428
MPU9250_MAGNETOMETER_BITS_14
@ MPU9250_MAGNETOMETER_BITS_14
Definition: driver_mpu9250.h:427
MPU9250_MAGNETOMETER_MODE_CONTINUOUS1
@ MPU9250_MAGNETOMETER_MODE_CONTINUOUS1
Definition: driver_mpu9250.h:415
MPU9250_MAGNETOMETER_MODE_SELF_TEST
@ MPU9250_MAGNETOMETER_MODE_SELF_TEST
Definition: driver_mpu9250.h:418
MPU9250_MAGNETOMETER_MODE_EXT_TRIGGER
@ MPU9250_MAGNETOMETER_MODE_EXT_TRIGGER
Definition: driver_mpu9250.h:417
MPU9250_MAGNETOMETER_MODE_SINGLE
@ MPU9250_MAGNETOMETER_MODE_SINGLE
Definition: driver_mpu9250.h:414
MPU9250_MAGNETOMETER_MODE_POWER_DOWN
@ MPU9250_MAGNETOMETER_MODE_POWER_DOWN
Definition: driver_mpu9250.h:413
MPU9250_MAGNETOMETER_MODE_FUSE_ROM
@ MPU9250_MAGNETOMETER_MODE_FUSE_ROM
Definition: driver_mpu9250.h:419
MPU9250_MAGNETOMETER_MODE_CONTINUOUS2
@ MPU9250_MAGNETOMETER_MODE_CONTINUOUS2
Definition: driver_mpu9250.h:416
mpu9250_register_test
uint8_t mpu9250_register_test(mpu9250_interface_t interface, mpu9250_address_t addr)
register test
Definition: driver_mpu9250_register_test.c:51
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