aboutsummaryrefslogtreecommitdiff
path: root/include/linux/yas.h
blob: 2add90e92ccebec2450444edf8f4be29dae9967e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
/**
 * Header file of the core driver API @file yas.h
 *
 * Copyright (c) 2013-2014 Yamaha Corporation
 *
 * This software is provided 'as-is', without any express or implied
 * warranty.  In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 *    claim that you wrote the original software. If you use this software
 *    in a product, an acknowledgment in the product documentation would be
 *    appreciated but is not required.
 * 2. Altered source versions must be plainly marked as such, and must not be
 *    misrepresented as being the original software.
 * 3. This notice may not be removed or altered from any source distribution.
 */

#ifndef __YAS_H__
#define __YAS_H__

#include "yas_cfg.h"

#define YAS_VERSION	"10.2.0c"	/*!< MS-x Driver Version */

/* ----------------------------------------------------------------------------
 *                             Typedef definition
 *--------------------------------------------------------------------------- */

#if defined(__KERNEL__)
#include <linux/types.h>
#else
#include <stdint.h>
/*typedef signed char	int8_t;*/
/*typedef unsigned char	uint8_t;*/
/*typedef signed short	int16_t;*/
/*typedef unsigned short	uint16_t;*/
/*typedef signed int	int32_t;*/
/*typedef unsigned int	uint32_t;*/
#endif

/* ----------------------------------------------------------------------------
 *                              Macro definition
 *--------------------------------------------------------------------------- */

#define YAS_DEBUG			(0) /*!< Debug print (0:disabled,
					      1:enabled) */

#define YAS_NO_ERROR			(0) /*!< Succeed */
#define YAS_ERROR_ARG			(-1) /*!< Invalid argument */
#define YAS_ERROR_INITIALIZE		(-2) /*!< Invalid initialization status
					      */
#define YAS_ERROR_BUSY			(-3) /*!< Sensor is busy */
#define YAS_ERROR_DEVICE_COMMUNICATION	(-4) /*!< Device communication error */
#define YAS_ERROR_CHIP_ID		(-5) /*!< Invalid chip id */
#define YAS_ERROR_CALREG		(-6) /*!< Invalid CAL register */
#define YAS_ERROR_OVERFLOW		(-7) /*!< Overflow occured */
#define YAS_ERROR_UNDERFLOW		(-8) /*!< Underflow occured */
#define YAS_ERROR_DIRCALC		(-9) /*!< Direction calcuration error */
#define YAS_ERROR_ERROR			(-128) /*!< other error */

#ifndef NULL
#ifdef __cplusplus
#define NULL				(0) /*!< NULL */
#else
#define NULL				((void *)(0)) /*!< NULL */
#endif
#endif
#ifndef NELEMS
#define NELEMS(a)	((int)(sizeof(a)/sizeof(a[0]))) /*!< Number of array
							  elements */
#endif
#ifndef ABS
#define ABS(a)		((a) > 0 ? (a) : -(a)) /*!< Absolute value */
#endif
#ifndef M_PI
#define M_PI		(3.14159265358979323846) /*!< Math PI */
#endif

#define YAS_MATRIX_NORM		(10000) /*!< Matrix normalize unit */
/* YAS_MATRIX_NORM_RECIP_BIT = SFIXED_RECIP_Q31(YAS_MATRIX_NORM,
 * &YAS_MATRIX_NORM_RECIP) */
#define YAS_MATRIX_NORM_RECIP		(0x68DB8BAC)
#define YAS_MATRIX_NORM_RECIP_BIT	(18)
#define YAS_QUATERNION_NORM	(10000) /*!< Quaternion normalize unit */

#if YAS_DEBUG
#ifdef __KERNEL__
#include <linux/kernel.h>
#define YLOGD(args) (printk args)	/*!< Debug log (DEBUG) */
#define YLOGI(args) (printk args)	/*!< Debug log (INFO) */
#define YLOGE(args) (printk args)	/*!< Debug log (ERROR) */
#define YLOGW(args) (printk args)	/*!< Debug log (WARNING) */
#elif defined __ANDROID__
#include <cutils/log.h>
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "yas"
#define YLOGD(args) (ALOGD args)	/*!< Debug log (DEBUG) */
#define YLOGI(args) (ALOGI args)	/*!< Debug log (INFO) */
#define YLOGE(args) (ALOGE args)	/*!< Debug log (ERROR) */
#define YLOGW(args) (ALOGW args)	/*!< Debug log (WARNING) */
#else /* __ANDROID__ */
#include <stdio.h>
#define YLOGD(args) (printf args)	/*!< Debug log (DEBUG) */
#define YLOGI(args) (printf args)	/*!< Debug log (INFO) */
#define YLOGE(args) (printf args)	/*!< Debug log (ERROR) */
#define YLOGW(args) (printf args)	/*!< Debug log (WARNING) */
#endif /* __ANDROID__ */
#else /* DEBUG */
#define YLOGD(args)	/*!< Debug log (DEBUG) */
#define YLOGI(args)	/*!< Debug log (INFO) */
#define YLOGW(args)	/*!< Debug log (ERROR) */
#define YLOGE(args)	/*!< Debug log (WARNING) */
#endif /* DEBUG */

#define YAS_TYPE_ACC_NONE		(0x00000001) /*!< No Acceleration */
#define YAS_TYPE_MAG_NONE		(0x00000002) /*!< No Magnetometer */
#define YAS_TYPE_GYRO_NONE		(0x00000004) /*!< No Gyroscope */
#define YAS_TYPE_A_ACC			(0x00000008) /*!< 3-axis Acceleration */
#define YAS_TYPE_M_MAG			(0x00000010) /*!< 3-axis Magnetometer */
#define YAS_TYPE_G_GYRO			(0x00000020) /*!< 3-axis Gyroscope */
#define YAS_TYPE_AM_ACC			(0x00100000) /*!< 6-axis (Acc+Mag)
						       Acceleration */
#define YAS_TYPE_AM_MAG			(0x00200000) /*!< 6-axis (Acc+Mag)
						       Magnetometer */
#define YAS_TYPE_AG_ACC			(0x01000000) /*!< 6-axis (Acc+Gyro)
						       Acceleration */
#define YAS_TYPE_AG_GYRO		(0x02000000) /*!< 6-axis (Acc+Gyro)
						       Gyroscope */
#define YAS_TYPE_AMG_ACC		(0x10000000) /*!< 9-axis (Acc+Gyro+Mag)
						       Acceleration */
#define YAS_TYPE_AMG_MAG		(0x20000000) /*!< 9-axis (Acc+Gyro+Mag)
						       Magnetometer */
#define YAS_TYPE_AMG_GYRO		(0x40000000) /*!< 9-axis (Acc+Gyro+Mag)
						       Gyroscope */

#if YAS_ACC_DRIVER == YAS_ACC_DRIVER_NONE
#define YAS_TYPE_ACC YAS_TYPE_ACC_NONE
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_ADXL345
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_ADXL346
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA150
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA222
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA222E
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA250
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA250E
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA254
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA255
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMI055
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMI058
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_DMARD08
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXSD9
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTE9
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTF9
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTI9
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTJ2
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXUD9
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DL
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DLH
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DLM
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS3DH
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LSM330DLC
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_MMA8452Q
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_MMA8453Q
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_U2DH
#define YAS_TYPE_ACC YAS_TYPE_A_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_YAS535
#define YAS_TYPE_ACC YAS_TYPE_AM_ACC
#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_YAS53x
#define YAS_TYPE_ACC YAS_TYPE_AMG_ACC
#endif

#if YAS_MAG_DRIVER == YAS_MAG_DRIVER_NONE
#define YAS_TYPE_MAG YAS_TYPE_MAG_NONE
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS529 /* MS-3C */
#define YAS_TYPE_MAG YAS_TYPE_M_MAG
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS530 /* MS-3E */
#define YAS_TYPE_MAG YAS_TYPE_M_MAG
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS532 /* MS-3R */
#define YAS_TYPE_MAG YAS_TYPE_M_MAG
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS533 /* MS-3F */
#define YAS_TYPE_MAG YAS_TYPE_M_MAG
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS535 /* MS-6C */
#define YAS_TYPE_MAG YAS_TYPE_AM_MAG
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS536 /* MS-3W */
#define YAS_TYPE_MAG YAS_TYPE_M_MAG
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS537 /* MS-3T */
#define YAS_TYPE_MAG YAS_TYPE_M_MAG
#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS53x
#define YAS_TYPE_MAG YAS_TYPE_AMG_MAG
#endif

#if YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_NONE
#define YAS_TYPE_GYRO YAS_TYPE_GYRO_NONE
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_BMG160
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_BMI055
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_BMI058
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_EWTZMU
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_ITG3200
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_ITG3500
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_L3G3200D
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_L3G4200D
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_LSM330DLC
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_MPU3050
#define YAS_TYPE_GYRO YAS_TYPE_G_GYRO
#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_YAS53x
#define YAS_TYPE_GYRO YAS_TYPE_AMG_GYRO
#endif

/* ----------------------------------------------------------------------------
 *                   Geomagnetic Calibration Configuration
 *--------------------------------------------------------------------------- */

/*! Geomagnetic calibration mode: spherical only */
#define YAS_MAG_CALIB_MODE_SPHERE		(0)
/*! Geomagnetic calibration mode: ellipsoidal only */
#define YAS_MAG_CALIB_MODE_ELLIPSOID		(1)
/*! Geomagnetic calibration mode: spherical with gyroscope */
#define YAS_MAG_CALIB_MODE_SPHERE_WITH_GYRO	(2)
/*! Geomagnetic calibration mode: ellisoldal with gyroscope */
#define YAS_MAG_CALIB_MODE_ELLIPSOID_WITH_GYRO	(3)
/*! Geomagnetic calibration mode: gyroscope only */
#define YAS_MAG_CALIB_MODE_WITH_GYRO		(4)

/* ----------------------------------------------------------------------------
 *                      Extension Command Definition
 *--------------------------------------------------------------------------- */
/*! YAS532 extension command: self test */
#define YAS532_SELF_TEST		(0x00000001)
/*! YAS532 extension command: self test noise */
#define YAS532_SELF_TEST_NOISE		(0x00000002)
/*! YAS532 extension command: obtains the hardware offset */
#define YAS532_GET_HW_OFFSET		(0x00000003)
/*! YAS532 extension command: sets the hardware offset */
#define YAS532_SET_HW_OFFSET		(0x00000004)
/*! YAS532 extension command: obtains last raw data (x, y1, y2, t) */
#define YAS532_GET_LAST_RAWDATA		(0x00000006)

/*! YAS535 extension command: obtains last raw data (xy1y2[3] t xyz[3]) */
#define YAS535_GET_LAST_RAWDATA		(0x00000001)
/*! YAS535 extension command: self test for magnetometer */
#define YAS535_MAG_SELF_TEST		(0x00000002)
/*! YAS535 extension command: self test noise for magnetometer */
#define YAS535_MAG_SELF_TEST_NOISE	(0x00000003)
/*! YAS535 extension command: obtains the hardware offset */
#define YAS535_MAG_GET_HW_OFFSET	(0x00000004)
/*! YAS535 extension command: sets the hardware offset */
#define YAS535_MAG_SET_HW_OFFSET	(0x00000005)
/*! YAS535 extension command: obtains the average samples for magnetometer */
#define YAS535_MAG_GET_AVERAGE_SAMPLE	(0x00000006)
/*! YAS535 extension command: sets the average samples for magnetometer */
#define YAS535_MAG_SET_AVERAGE_SAMPLE	(0x00000007)
/*! YAS535 extension command: self test for accelerometer */
#define YAS535_ACC_SELF_TEST		(0x00010000)
/*! YAS535 extension command: obtains the average samples for accelerometer */
#define YAS535_ACC_GET_AVERAGE_SAMPLE	(0x00020000)
/*! YAS535 extension command: sets the average samples for accelerometer */
#define YAS535_ACC_SET_AVERAGE_SAMPLE	(0x00040000)

/*! YAS536 extension command: self test */
#define YAS536_SELF_TEST		(0x00000001)
/*! YAS536 extension command: obtains the hardware offset */
#define YAS536_GET_HW_OFFSET		(0x00000002)
/*! YAS536 extension command: obtains the average filter length */
#define YAS536_GET_AVERAGE_LEN		(0x00000004)
/*! YAS536 extension command: sets the average filter length */
#define YAS536_SET_AVERAGE_LEN		(0x00000005)
/*! YAS536 extension command: obtains last raw data (x, y1, y2, t) */
#define YAS536_GET_LAST_RAWDATA		(0x00000006)

/*! YAS537 extension command: self test */
#define YAS537_SELF_TEST		(0x00000001)
/*! YAS537 extension command: self test noise */
#define YAS537_SELF_TEST_NOISE		(0x00000002)
/*! YAS537 extension command: obtains last raw data (x, y1, y2, t) */
#define YAS537_GET_LAST_RAWDATA		(0x00000003)
/*! YAS537 extension command: obtains the average samples */
#define YAS537_GET_AVERAGE_SAMPLE	(0x00000004)
/*! YAS537 extension command: sets the average samples */
#define YAS537_SET_AVERAGE_SAMPLE	(0x00000005)
/*! YAS537 extension command: obtains the hardware offset */
#define YAS537_GET_HW_OFFSET		(0x00000006)

/* ----------------------------------------------------------------------------
 *                            Structure definition
 *--------------------------------------------------------------------------- */

/**
 * @struct yas_vector
 * @brief Stores the sensor data
 */
struct yas_vector {
	int32_t v[3]; /*!< vector data */
};

/**
 * @struct yas_quaternion
 * @brief Stores the quaternion
 */
struct yas_quaternion {
	int32_t q[4]; /*!< quaternion */
	int32_t heading_error; /*!< heading error in mdegree,
				 -1 if unavailable */
};

/**
 * @struct yas_matrix
 * @brief Stores the matrix data
 */
struct yas_matrix {
	int16_t m[9]; /*!< matrix data */
};

/**
 * @struct yas_data
 * @brief Stores the sensor data
 */
struct yas_data {
	int32_t type; /*!< Sensor type */
	struct yas_vector xyz; /*!< X, Y, Z measurement data of the sensor */
	uint32_t timestamp; /*!< Measurement time */
	uint8_t accuracy; /*!< Measurement data accuracy */
};

/**
 * @struct yas_driver_callback
 * @brief User-written callback functions specific to each implementation, such
 * as communication controls with the device
 */
struct yas_driver_callback {
	/**
	 * Open the device
	 * @param[in] type Sensor type
	 * @retval 0 Success
	 * @retval Negative Failure
	 */
	int (*device_open)(int32_t type);
	/**
	 * Close the device
	 * @param[in] type Sensor type
	 * @retval 0 Success
	 * @retval Negative Failure
	 */
	int (*device_close)(int32_t type);
	/**
	 * Send data to the device
	 * @param[in] type Sensor type
	 * @param[in] addr Register address
	 * @param[in] buf The pointer to the data buffer to be sent
	 * @param[in] len The length of the data buffer
	 * @retval 0 Success
	 * @retval Negative Failure
	 */
	int (*device_write)(int32_t type, uint8_t addr, const uint8_t *buf,
			int len);
	/**
	 * Receive data from the device
	 * @param[in] type Sensor type
	 * @param[in] addr Register address
	 * @param[out] buf The pointer to the data buffer to be received
	 * @param[in] len The length of the data buffer
	 * @retval 0 Success
	 * @retval Negative Failure
	 */
	int (*device_read)(int32_t type, uint8_t addr, uint8_t *buf, int len);
	/**
	 * Sleep in micro-seconds
	 * @param[in] usec Sleep time in micro-seconds
	 */
	void (*usleep)(int usec);
	/**
	 * Obtains the current time in milli-seconds
	 * @return The current time in milli-seconds
	 */
	uint32_t (*current_time)(void);
};

/**
 * @struct yas_acc_driver
 * @brief Acceleration sensor driver
 */
struct yas_acc_driver {
	/**
	 * Initializes the sensor, starts communication with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the communications with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Obtains measurment period in milli-seconds
	 * @retval Non-Negatiev Measurement period in milli-seconds
	 * @retval Negative Failure
	 */
	int (*get_delay)(void);
	/**
	 * Sets measurment period in milli-seconds
	 * @param[in] delay Measurement period in milli-seconds
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_delay)(int delay);
	/**
	 * Reports the sensor status (Enabled or Disabled)
	 * @retval 0 Disabled
	 * @retval 1 Enabled
	 * @retval Negative Failure
	 */
	int (*get_enable)(void);
	/**
	 * Enables or disables sensors
	 * @param[in] enable The status of the sensor (0: Disable, 1: Enable)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_enable)(int enable);
	/**
	 * Obtains the sensor position
	 * @retval 0-7 The position of the sensor
	 * @retval Negative Failure
	 */
	int (*get_position)(void);
	/**
	 * Sets the sensor position
	 * @param[in] position The position of the sensor (0-7)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_position)(int position);
	/**
	 * Measures the sensor
	 * @param[out] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval Non-Negative The number of the measured sensor data
	 * @retval Negative Failure
	 */
	int (*measure)(struct yas_data *raw, int num);
	/**
	 * Extension command execution specific to the part number
	 * @param[in] cmd Extension command id
	 * @param[out] result Extension command result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*ext)(int32_t cmd, void *result);
	struct yas_driver_callback callback; /*!< Callback functions */
};

/**
 * @struct yas_mag_driver
 * @brief Magnetic sensor driver
 */
struct yas_mag_driver {
	/**
	 * Initializes the sensor, starts communication with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the communications with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Obtains measurment period in milli-seconds
	 * @retval Non-Negatiev Measurement period in milli-seconds
	 * @retval Negative Failure
	 */
	int (*get_delay)(void);
	/**
	 * Sets measurment period in milli-seconds
	 * @param[in] delay Measurement period in milli-seconds
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_delay)(int delay);
	/**
	 * Reports the sensor status (Enabled or Disabled)
	 * @retval 0 Disabled
	 * @retval 1 Enabled
	 * @retval Negative Failure
	 */
	int (*get_enable)(void);
	/**
	 * Enables or disables sensors
	 * @param[in] enable The status of the sensor (0: Disable, 1: Enable)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_enable)(int enable);
	/**
	 * Obtains the sensor position
	 * @retval 0-7 The position of the sensor
	 * @retval Negative Failure
	 */
	int (*get_position)(void);
	/**
	 * Sets the sensor position
	 * @param[in] position The position of the sensor (0-7)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_position)(int position);
	/**
	 * Measures the sensor
	 * @param[out] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval Non-Negative The number of the measured sensor data
	 * @retval Negative Failure
	 */
	int (*measure)(struct yas_data *raw, int num);
	/**
	 * Extension command execution specific to the part number
	 * @param[in] cmd Extension command id
	 * @param[out] result Extension command result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*ext)(int32_t cmd, void *result);
	struct yas_driver_callback callback; /*!< Callback functions */
};

/**
 * @struct yas_gyro_driver
 * @brief Gyroscope sensor driver
 */
struct yas_gyro_driver {
	/**
	 * Initializes the sensor, starts communication with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the communications with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Obtains measurment period in milli-seconds
	 * @retval Non-Negatiev Measurement period in milli-seconds
	 * @retval Negative Failure
	 */
	int (*get_delay)(void);
	/**
	 * Sets measurment period in milli-seconds
	 * @param[in] delay Measurement period in milli-seconds
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_delay)(int delay);
	/**
	 * Reports the sensor status (Enabled or Disabled)
	 * @retval 0 Disabled
	 * @retval 1 Enabled
	 * @retval Negative Failure
	 */
	int (*get_enable)(void);
	/**
	 * Enables or disables sensors
	 * @param[in] enable The status of the sensor (0: Disable, 1: Enable)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_enable)(int enable);
	/**
	 * Obtains the sensor position
	 * @retval 0-7 The position of the sensor
	 * @retval Negative Failure
	 */
	int (*get_position)(void);
	/**
	 * Sets the sensor position
	 * @param[in] position The position of the sensor (0-7)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_position)(int position);
	/**
	 * Measures the sensor
	 * @param[out] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval Non-Negative The number of the measured sensor data
	 * @retval Negative Failure
	 */
	int (*measure)(struct yas_data *raw, int num);
	/**
	 * Extension command execution specific to the part number
	 * @param[in] cmd Extension command id
	 * @param[out] result Extension command result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*ext)(int32_t cmd, void *result);
	struct yas_driver_callback callback; /*!< Callback functions */
};

/**
 * @struct yas_acc_mag_driver
 * @brief Acceleration and geomagnetix sensor driver (6-axis).
 */
struct yas_acc_mag_driver {
	/**
	 * Initializes the sensor, starts communication with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the communications with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Obtains measurment period in milli-seconds
	 * @param[in] type Sensor type
	 * @retval Non-Negatiev Measurement period in milli-seconds
	 * @retval Negative Failure
	 */
	int (*get_delay)(int32_t type);
	/**
	 * Sets measurment period in milli-seconds
	 * @param[in] type Sensor type
	 * @param[in] delay Measurement period in milli-seconds
	 * @retval Non-Negative The bit or of the sensor type successfully
	 * delay changed.
	 * @retval Negative Failure
	 */
	int (*set_delay)(int32_t type, int delay);
	/**
	 * Reports the sensor status (Enabled or Disabled)
	 * @param[in] type Sensor type
	 * @retval 0 Disabled
	 * @retval 1 Enabled
	 * @retval Negative Failure
	 */
	int (*get_enable)(int32_t type);
	/**
	 * Enables or disables sensors
	 * @param[in] type Sensor type
	 * @param[in] enable The status of the sensor (0: Disable, 1: Enable)
	 * @retval Non-Negative The bit or of the sensor type successfully
	 * enabled/disabled.
	 * @retval Negative Failure
	 */
	int (*set_enable)(int32_t type, int enable);
	/**
	 * Obtains the sensor position
	 * @retval 0-7 The position of the sensor
	 * @retval Negative Failure
	 */
	int (*get_position)(void);
	/**
	 * Sets the sensor position
	 * @param[in] position The position of the sensor (0-7)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_position)(int position);
	/**
	 * Measures the sensor
	 * @param[in] type Sensor type
	 * @param[out] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval Non-Negative The number of the measured sensor data
	 * @retval Negative Failure
	 */
	int (*measure)(int32_t type, struct yas_data *raw, int num);
	/**
	 * Extension command execution specific to the part number
	 * @param[in] cmd Extension command id
	 * @param[out] result Extension command result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*ext)(int32_t cmd, void *result);
	struct yas_driver_callback callback; /*!< Callback functions */
};

/**
 * @struct yas_acc_gyro_driver
 * @brief Acceleration and gyroscope sensor driver (6-axis).
 */
struct yas_acc_gyro_driver {
	/**
	 * Initializes the sensor, starts communication with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the communications with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Obtains measurment period in milli-seconds
	 * @param[in] type Sensor type
	 * @retval Non-Negatiev Measurement period in milli-seconds
	 * @retval Negative Failure
	 */
	int (*get_delay)(int32_t type);
	/**
	 * Sets measurment period in milli-seconds
	 * @param[in] type Sensor type
	 * @param[in] delay Measurement period in milli-seconds
	 * @retval Non-Negative The bit or of the sensor type successfully
	 * delay changed.
	 * @retval Negative Failure
	 */
	int (*set_delay)(int32_t type, int delay);
	/**
	 * Reports the sensor status (Enabled or Disabled)
	 * @param[in] type Sensor type
	 * @retval 0 Disabled
	 * @retval 1 Enabled
	 * @retval Negative Failure
	 */
	int (*get_enable)(int32_t type);
	/**
	 * Enables or disables sensors
	 * @param[in] type Sensor type
	 * @param[in] enable The status of the sensor (0: Disable, 1: Enable)
	 * @retval Non-Negative The bit or of the sensor type successfully
	 * enabled/disabled.
	 * @retval Negative Failure
	 */
	int (*set_enable)(int32_t type, int enable);
	/**
	 * Obtains the sensor position
	 * @retval 0-7 The position of the sensor
	 * @retval Negative Failure
	 */
	int (*get_position)(void);
	/**
	 * Sets the sensor position
	 * @param[in] position The position of the sensor (0-7)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_position)(int position);
	/**
	 * Measures the sensor
	 * @param[in] type Sensor type
	 * @param[out] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval Non-Negative The number of the measured sensor data
	 * @retval Negative Failure
	 */
	int (*measure)(int32_t type, struct yas_data *raw, int num);
	/**
	 * Extension command execution specific to the part number
	 * @param[in] cmd Extension command id
	 * @param[out] result Extension command result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*ext)(int32_t cmd, void *result);
	struct yas_driver_callback callback; /*!< Callback functions */
};

/**
 * @struct yas_acc_mag_gyro_driver
 * @brief Acceleration, geomagnetic and gyroscope sensor driver (9-axis).
 */
struct yas_acc_mag_gyro_driver {
	/**
	 * Initializes the sensor, starts communication with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the communications with the device
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Obtains measurment period in milli-seconds
	 * @param[in] type Sensor type
	 * @retval Non-Negatiev Measurement period in milli-seconds
	 * @retval Negative Failure
	 */
	int (*get_delay)(int32_t type);
	/**
	 * Sets measurment period in milli-seconds
	 * @param[in] type Sensor type
	 * @param[in] delay Measurement period in milli-seconds
	 * @retval Non-Negative The bit or of the sensor type successfully
	 * delay changed.
	 * @retval Negative Failure
	 */
	int (*set_delay)(int32_t type, int delay);
	/**
	 * Reports the sensor status (Enabled or Disabled)
	 * @param[in] type Sensor type
	 * @retval 0 Disabled
	 * @retval 1 Enabled
	 * @retval Negative Failure
	 */
	int (*get_enable)(int32_t type);
	/**
	 * Enables or disables sensors
	 * @param[in] type Sensor type
	 * @param[in] enable The status of the sensor (0: Disable, 1: Enable)
	 * @retval Non-Negative The bit or of the sensor type successfully
	 * enabled/disabled.
	 * @retval Negative Failure
	 */
	int (*set_enable)(int32_t type, int enable);
	/**
	 * Obtains the sensor position
	 * @retval 0-7 The position of the sensor
	 * @retval Negative Failure
	 */
	int (*get_position)(void);
	/**
	 * Sets the sensor position
	 * @param[in] position The position of the sensor (0-7)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_position)(int position);
	/**
	 * Measures the sensor
	 * @param[in] type Sensor type
	 * @param[out] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval Non-Negative The number of the measured sensor data
	 * @retval Negative Failure
	 */
	int (*measure)(int32_t type, struct yas_data *raw, int num);
	/**
	 * Extension command execution specific to the part number
	 * @param[in] cmd Extension command id
	 * @param[out] result Extension command result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*ext)(int32_t cmd, void *result);
	struct yas_driver_callback callback; /*!< Callback functions */
};

#if YAS_MAG_FILTER_ENABLE
/**
 * @struct yas_mag_filter_config
 * @brief Magnetic filter configuration
 */
struct yas_mag_filter_config {
	uint8_t len; /*!< Filter length */
	uint16_t noise[3]; /*!< Filter noise X, Y, Z in [nT] */
	uint16_t threshold; /*!< Filter threshold in [nT] */
};

/**
 * @struct yas_mag_filter
 * @brief Magnetic filter
 */
struct yas_mag_filter {
	/**
	 * Initializes the filter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the filter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the filter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Filters the sensor data
	 * @param[in] input Measured sensor data
	 * @param[out] output Filtered sensor data
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_vector *input, struct yas_vector *output);
	/**
	 * Obtains filter configuration
	 * @param[out] config Sensor filter configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_mag_filter_config *config);
	/**
	 * Sets filter configuration
	 * @param[in] config Sensor filter configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_mag_filter_config *config);
};
#endif

#if YAS_MAG_CALIB_ENABLE
/**
 * @struct yas_mag_calib_config
 * @brief Magnetic calibration configuration
 */
struct yas_mag_calib_config {
	uint8_t mode; /*!< Calibration mode : #YAS_MAG_CALIB_MODE_SPHERE,
		    #YAS_MAG_CALIB_MODE_ELLIPSOID,
		    #YAS_MAG_CALIB_MODE_SPHERE_WITH_GYRO,
		    #YAS_MAG_CALIB_MODE_ELLIPSOID_WITH_GYRO */
	uint16_t spread[3]; /*!< Spread threshold for accuracy 1-3 */
	uint16_t variation[3]; /*!< Variation threshold for accuracy 1-3 */
#if !YAS_MAG_CALIB_MINI_ENABLE && !YAS_MAG_CALIB_FLOAT_ENABLE
	uint16_t trad_variation[3]; /*!< Traditional variation for accuracy 1-3
				     */
	uint16_t cwg_threshold[12]; /*!< Threshold for calibration with gyro.
				     Order is {eval_th_for_narrow,
				      diff_angle_th_for_narrow,
				      eval_th_for_wide, eval_th_for_wide }
				      for accuracy 1, 2, and 3. */
#endif
};

/**
 * @struct yas_mag_calib_result
 * @brief Magnetic calibration result
 */
struct yas_mag_calib_result {
	struct yas_vector offset; /*!< Calibration offset [nT] */
	uint16_t spread; /*!< Spread value */
	uint16_t variation; /*!< Variation value */
	uint16_t radius; /*!< Magnetic radius [nT] */
	uint8_t axis; /*!< Update axis */
	uint8_t accuracy; /*!< Accuracy [0-3] */
	uint8_t level; /*!< The number of sample */
#if !YAS_MAG_CALIB_MINI_ENABLE && !YAS_MAG_CALIB_FLOAT_ENABLE
	uint16_t trad_variation; /*!< Traditional variation value */
	uint16_t cwg_spread;
	uint16_t cwg_variation;
	int success_mode; /*!< Success mode. 1:cwm, 2:cwg. */
#endif
#if YAS_MAG_CALIB_ELLIPSOID_ENABLE
	struct yas_matrix dynamic_matrix;
#endif
};

/**
 * @struct yas_mag_calib
 * @brief Magnetic calibration
 */
struct yas_mag_calib {
	/**
	 * Initializes the calibration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the calibration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the calibration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Updates the calibration
	 * @param[in] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval 0 Calibration offset and accuracy are NOT changed
	 * @retval 1 Calibration offset or accuracy is changed
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_data *raw, int num);
	/**
	 * Obtains the calibration offset
	 * @param[in] type Sensor type
	 * @param[out] offset Calibration offset
	 * @param[out] accuracy Calibration offset accuracy
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_offset)(int type, struct yas_vector *offset,
			uint8_t *accuracy);
	/**
	 * Sets the calibration offset
	 * @param[in] type Sensor type
	 * @param[in] offset Calibration offset
	 * @param[in] accuracy Calibration offset accuracy
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_offset)(int type, struct yas_vector *offset,
			uint8_t accuracy);
	/**
	 * Obtains the calibration configuration
	 * @param[out] config Calibration configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_mag_calib_config *config);
	/**
	 * Sets the calibration configuration
	 * @param[in] config Calibration configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_mag_calib_config *config);
#if YAS_MAG_CALIB_ELLIPSOID_ENABLE
	/**
	 * Obtains the dynamic ellipsoid correction matrix
	 * @param[out] m dynamic ellipsoid correction matrix
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_dynamic_matrix)(struct yas_matrix *m);
	/**
	 * Sets the dynamic ellipsoid correction matrix
	 * @param[in] m Dynamic ellipsoid correction matrix
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_dynamic_matrix)(struct yas_matrix *m);
#endif
	/**
	 * Obtains the detail of the last calibration result
	 * @param[out] r Last calibration result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_result)(struct yas_mag_calib_result *r);
};
#endif

#if YAS_GYRO_CALIB_ENABLE
/**
 * @struct yas_gyro_calib_config
 * @brief Gyroscope calibration configuration
 */
struct yas_gyro_calib_config {
	uint16_t mag_noise; /*!< Magnetic sensor noise in standard deviation
			     [nT] */
	uint16_t gyro_noise; /*!< Gyroscope sensor noise in [dps per root HZ] */
};

/**
 * @struct yas_gyro_calib_result
 * @brief Gyroscope calibration result
 */
struct yas_gyro_calib_result {
	struct yas_vector offset; /*!< Calibration offset [mdps] */
	uint8_t accuracy; /*!< Accuracy [0-3] */
};

/**
 * @struct yas_gyro_calib
 * @brief Gyroscope calibration
 */
struct yas_gyro_calib {
	/**
	 * Initializes the calibration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the calibration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the calibration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Updates the calibration
	 * @param[in] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval 0 Calibration offset or accuracy is NOT changed
	 * @retval 1 Calibration offset or accuracy is changed
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_data *raw, int num);
	/**
	 * Obtains the calibration offset
	 * @param[in] type Sensor type
	 * @param[out] offset Calibration offset
	 * @param[out] accuracy Calibration offset accuracy
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_offset)(int type, struct yas_vector *offset,
			uint8_t *accuracy);
	/**
	 * Sets the calibration offset
	 * @param[in] type Sensor type
	 * @param[in] offset Calibration offset
	 * @param[in] accuracy Calibration offset accuracy
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_offset)(int type, struct yas_vector *offset,
			uint8_t accuracy);
	/**
	 * Obtains the calibration configuration
	 * @param[out] config Calibration configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_gyro_calib_config *config);
	/**
	 * Sets the calibration configuration
	 * @param[in] config Calibration configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_gyro_calib_config *config);
	/**
	 * Obtains the detail of the last calibration result
	 * @param[out] r Last calibration result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_result)(struct yas_gyro_calib_result *r);
};
#endif

#if YAS_MAG_AVERAGE_FILTER_ENABLE
/**
 * @struct yas_mag_avg_config
 * @brief Magnetic average filter configuration
 */
struct yas_mag_avg_config {
	int tap_min; /*!< Minimum average filter length (0:32, 1:64, 2:128,
			  3:256) */
	int tap_hard; /*!< Average filter length currently set to the sensor
			(0:32, 1:64, 2:128, 3:256) */
	int filter_len; /*!< Average filter length */
	uint32_t dfine; /*!< Measured standard deviation threshold [nT] */
	uint32_t dthresh; /*!< Median standard deviation threshold [nT] */
};

/**
 * @struct yas_mag_avg_result
 * @brief Magnetic average filter result
 */
struct yas_mag_avg_result {
	int32_t tap_new; /*!< New average filter taps
			    (0:32, 1:64, 2:128, 3:256) */
	int32_t dm;	/*!< Median standard deviation */
};

/**
 * @struct yas_mag_avg
 * @brief Magnetic average filter
 */
struct yas_mag_avg {
	/**
	 * Initializes the magnetic average filter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the magnetic average filter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the magnetic average filter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Updates the filter
	 * @param[in] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @param[out] r Average filter result
	 * @retval 0 Average filter taps is NOT changed
	 * @retval 1 Average filter taps is changed
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_data *raw, int num);
	/**
	 * Obtains the average filter tap
	 * @param[out] curtap Current average filter tap (0:32, 1:64, 2:128,
	 * 3:256)
	 * @param[out] newtap Average filter tap to be set (0:32, 1:64, 2:128,
	 * 3:256)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_tap)(int *curtap, int *newtap);
	/**
	 * Sets the average filter tap
	 * @param[in] tap The average filter tap (0:32, 1:64, 2:128, 3:256)
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_tap)(int tap);
	/**
	 * Obtains the average filter configuration
	 * @param[out] config Average filter configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_mag_avg_config *config);
	/**
	 * Sets the average filter configuration
	 * @param[in] config Average filter configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_mag_avg_config *config);
	/**
	 * Obtains the detail of filter result
	 * @param[out] r Filter result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_result)(struct yas_mag_avg_result *r);
};
#endif

#if YAS_GAMEVEC_ENABLE
/**
 * @struct yas_gamevec_config
 * @brief Gamevec config
 */
struct yas_gamevec_config {
	int32_t weight;
	int32_t hpf_sq_out_threshold;
	int16_t sustain;
};
#endif

#if YAS_FUSION_ENABLE
/**
 * @struct yas_fusion_config
 * @brief Sensor fusion configuration
 */
struct yas_fusion_config {
	uint8_t mag_fusion_enable; /*!< 6 axis fusion enable or disable */
	uint8_t gyro_fusion_enable; /*!< 9 axis fusion enable or disable */
#if YAS_GAMEVEC_ENABLE
	struct yas_gamevec_config gamevec_config;
#endif
};

/**
 * @struct yas_fusion_result
 * @brief Sensor fusion result
 */
struct yas_fusion_result {
#if YAS_ORIENTATION_ENABLE
	struct yas_vector orientation_mag; /*!< orientation angle (acc and mag)
					  [mdegree].  Azimuth, Pitch, Roll */
#endif
	struct yas_quaternion quaternion_mag; /*!< quaternion (acc and mag)
						[normalized in
						YAS_QUATERNION_NORM] */
#if YAS_GAMEVEC_ENABLE
	struct yas_quaternion quaternion_gyro; /*!< quaternion (gyro)
						 [normalized in
						 YAS_QUATERNION_NORM] */
#endif
#if YAS_FUSION_WITH_GYRO_ENABLE
#if YAS_ORIENTATION_ENABLE
	struct yas_vector orientation_fusion; /*!< orientation angle (acc, mag
						and gyro) [mdegree].  Azimuth,
						Pitch, Roll */
#endif
	struct yas_quaternion quaternion_fusion; /*!< quaternion (acc, mag and
						   gyro) [normalized in
						   YAS_QUATERNION_NORM] */
	struct yas_vector gravity; /*!< Gravity [um/s^2] */
	struct yas_vector linear_acceleration; /*!< Linear acceleration
						 [um/s^2] */
#endif
};

/**
 * @struct yas_fusion
 * @brief Sensor fusion
 */
struct yas_fusion {
	/**
	 * Initializes the sensor fusion
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the sensor fusion
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the sensor fusion
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Notifies the square of offset change.
	 * @param[in] square of offset change in [nT].
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*notify_offset_change)(int32_t square_offset_change);
	/**
	 * Updates the sensor fusion
	 * @param[in] raw Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_data *raw, int num);
	/**
	 * Obtains the sensor fusion configuration
	 * @param[out] config Sensor fusion configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_fusion_config *config);
	/**
	 * Sets the sensor fusion configuration
	 * @param[in] config Sensor fusion configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_fusion_config *config);
	/**
	 * Obtains the detail of the last fusion result
	 * @param[out] r Last fusion result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_result)(struct yas_fusion_result *r);
};
#endif

#if YAS_STEPCOUNTER_ENABLE
/**
 * @struct yas_stepcounter_config
 * @brief Stepcounter configuration
 */
struct yas_stepcounter_config {
	int8_t interval; /*!< Step counter calculate interval (ms)
					0 to 20 */
	int8_t noisecancel; /*!< Noise cancel setting
					0: off
					1: on */
};

/**
 * @struct yas_stepcounter_result
 * @brief Stepcounter result
 */
struct yas_stepcounter_result {
	int32_t walk_and_run_count[2];
	int32_t walk_and_run_time[2];
	int32_t totalcount; /*!< Total (walk and run) count */
	int32_t totaltime; /*!<  Total (walk and run) time */
};

/**
 * @struct yas_stepcounter
 * @brief Step counter function
 */
struct yas_stepcounter {
	/**
	 * Initializes the stepcounter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the stepcounter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the stepcounter
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Updates the stepcounter
	 * @param[in] Measured sensor data (accelerometer)
	 * @param[in] num The number of the measured sensor data
	 * @retval 0 Walk count and run count are NOT changed
	 * @retval 1 Walk count or run count is changed
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_data *ydata, int num);
	/**
	 * Obtains the stepcounter configuration
	 * @param[out] config stepcounter configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_stepcounter_config *config);
	/**
	 * Sets the stepcounter configuration
	 * @param[in] config stepcounter configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_stepcounter_config *config);
	/**
	 * Obtains the detail of the last stepcounter result
	 * @param[out] Last stepcounter result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_result)(struct yas_stepcounter_result *r);
};
#endif

#if YAS_SIGNIFICANT_MOTION_ENABLE
/**
 * @struct yas_sfm_config
 * @brief Significant motion configuration
 */
struct yas_sfm_config {
	int dummy;
};

/**
 * @struct yas_sfm_result
 * @brief Significant Motion result
 */
struct yas_sfm_result {
	int edge_state;
	int edge_type;
	int acc_count;
	int var_count;
	int err_count;
};

/**
 * @struct yas_sfm
 * @brief Significant motion function
 */
struct yas_sfm {
	/**
	 * Initializes the significant motion
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the significant motion
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the significant motion
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Updates the significant motion
	 * @param[in] Measured sensor data (accelerometer)
	 * @param[in] num The number of the measured sensor data
	 * @retval 0 Walk count and run count are NOT changed
	 * @retval 1 Walk count or run count is changed
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_data *ydata, int num);
	/**
	 * Obtains the significant motion configuration
	 * @param[out] config significant motion configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_sfm_config *config);
	/**
	 * Sets the significant motion configuration
	 * @param[in] config significant motion configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_sfm_config *config);
	/**
	 * Obtains the detail of the last significant motion result
	 * @param[out] Last significant motion result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_result)(struct yas_sfm_result *r);
};
#endif

#if YAS_SOFTWARE_GYROSCOPE_ENABLE
/**
 * @struct yas_swgyro_config
 * @brief Software gyroscope configuration
 */
struct yas_swgyro_config {
	int dummy; /*!< dummy */
};

/**
 * @struct yas_swgyro_result
 * @brief Software gyroscope result
 */
struct yas_swgyro_result {
	struct yas_vector swgyro; /*!< Software gyroscope value in mdps */
};

/**
 * @struct yas_swgyro
 * @brief Software gyroscope
 */
struct yas_swgyro {
	/**
	 * Initializes the software gyroscope
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*init)(void);
	/**
	 * Terminates the software gyroscope
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*term)(void);
	/**
	 * Resets the software gyroscope
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*reset)(void);
	/**
	 * Updates the software gyroscope
	 * @param[in] calibrated Measured sensor data
	 * @param[in] num The number of the measured sensor data
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*update)(struct yas_data *calibrated, int num);
	/**
	 * Obtains software gyroscope configuration
	 * @param[out] config Software gyroscope configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_config)(struct yas_swgyro_config *config);
	/**
	 * Sets software gyroscope configuration
	 * @param[in] config Software gyroscope configuration
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*set_config)(struct yas_swgyro_config *config);
	/**
	 * Obtains the detail of the last software gyroscope result
	 * @param[out] r Last software gyroscope result
	 * @retval #YAS_NO_ERROR Success
	 * @retval Negative Failure
	 */
	int (*get_result)(struct yas_swgyro_result *r);
};
#endif

#if YAS_LOG_ENABLE

/**
 * @struct yas_log
 * @brief User-written callback functions for log control
 */
struct yas_log {
	/**
	 * Open the log
	 * @retval 0 Success
	 * @retval Negative Failure
	 */
	int (*log_open)(void);
	/**
	 * Close the log
	 * @retval 0 Success
	 * @retval Negative Failure
	 */
	int (*log_close)(void);
	/**
	 * Write the log
	 * @param[in] buf Log string
	 * @param[in] len Log string length
	 * @retval 0 Success
	 * @retval Negative Failure
	 */
	int (*log_write)(const char *buf, int len);
};
#endif

#if YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS532
struct yas532_self_test_result {
	int32_t id;
	int8_t xy1y2[3];
	int32_t dir;
	int32_t sx, sy;
	int32_t xyz[3];
};
#endif

#if YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS537
struct yas537_self_test_result {
	int32_t id;
	int32_t sx, sy;
	int32_t dir;
	int32_t xyz[3];
};
#endif

#if YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS535
struct yas535_acc_self_test_result {
	int dummy; /* TBD */
};
struct yas535_mag_self_test_result {
	int32_t id;
	int8_t xy1y2[3];
	int32_t dir;
	int32_t sx, sy;
	int32_t xyz[3];
};
#endif

/* ----------------------------------------------------------------------------
 *                         Global function definition
 *--------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Initializes the acceleration sensor driver module.  Call thie function by
 * specifying a callback function.
 * @param[in,out] f Pointer to yas_acc_driver struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_acc_driver_init(struct yas_acc_driver *f);

/**
 * Initializes the magnetic sensor driver module.  Call thie function by
 * specifying a callback function.
 * @param[in,out] f Pointer to yas_mag_driver struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_mag_driver_init(struct yas_mag_driver *f);

/**
 * Initializes the gyroscope sensor driver module.  Call thie function by
 * specifying a callback function.
 * @param[in,out] f Pointer to yas_gyro_driver struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_gyro_driver_init(struct yas_gyro_driver *f);

/**
 * Initializes the acceleration and gyroscope sensor (6-axis) driver module.
 * Call thie function by specifying a callback function.
 * @param[in,out] f Pointer to yas_acc_gyro_driver struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_acc_gyro_driver_init(struct yas_acc_gyro_driver *f);

/**
 * Initializes the acceleration and magnetic sensor (6-axis) driver module.
 * Call thie function by specifying a callback function.
 * @param[in,out] f Pointer to yas_acc_mag_driver struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_acc_mag_driver_init(struct yas_acc_mag_driver *f);

/**
 * Initializes the acceleration, magnetic and gyroscope sensor (9-axis) driver
 * module.  Call thie function by specifying a callback function.
 * @param[in,out] f Pointer to yas_acc_mag_gyro_driver struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_acc_mag_gyro_driver_init(struct yas_acc_mag_gyro_driver *f);

#if YAS_MAG_CALIB_ENABLE
/**
 * Initializes the magnetic calibration module.
 * @param[in,out] f Pointer to yas_mag_calib struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_mag_calib_init(struct yas_mag_calib *f);
#endif

#if YAS_GYRO_CALIB_ENABLE
/**
 * Initializes the gyroscope calibration module.
 * @param[in,out] f Pointer to yas_gyro_calib struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_gyro_calib_init(struct yas_gyro_calib *f);
#endif

#if YAS_MAG_FILTER_ENABLE
/**
 * Initializes the magnetic filter module.
 * @param[in,out] f Pointer to yas_mag_filter struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_mag_filter_init(struct yas_mag_filter *f);
#endif

#if YAS_MAG_AVERAGE_FILTER_ENABLE
/**
 * Initializes the magnetic average filter module.
 * @param[in,out] f Pointer to yas_mag_avg struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_mag_avg_init(struct yas_mag_avg *f);
#endif

#if YAS_FUSION_ENABLE
/**
 * Initializes the sensor fusion module.
 * @param[in,out] f Pointer to yas_fusion struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_fusion_init(struct yas_fusion *f);
#endif

#if YAS_STEPCOUNTER_ENABLE
/**
 * Initializes the stepcounter module.
 * @param[in,out] f Pointer to yas_stepcounter struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_stepcounter_init(struct yas_stepcounter *f);
#endif

#if YAS_SIGNIFICANT_MOTION_ENABLE
/**
 * Initializes the significant motion module.
 * @param[in,out] f Pointer to yas_sfm struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_sfm_init(struct yas_sfm *f);
#endif

#if YAS_SOFTWARE_GYROSCOPE_ENABLE
/**
 * Initializes the software gyroscope module
 * @param[in,out] f Pointer to yas_swgyro struct
 * @retval #YAS_NO_ERROR Success
 * @retval Negative Number Error
 */
int yas_swgyro_init(struct yas_swgyro *f);
#endif

#ifdef __cplusplus
}
#endif

#endif /* __YAS_H__ */