ref: 9196c18d376d4f18c686bcfec8550f9c8659d5ea
src/drivers/Bma421_C/bma4.h
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 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 |
/** * Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved. * * BSD-3-Clause * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @file bma4.h * @date 2020-05-08 * @version V2.14.13 * */ /* * @file bma4.h * @brief Source file for the BMA4 Sensor API */ /*! * @defgroup bma4xy BMA4XY */ /** * \ingroup bma4xy * \defgroup bma4 BMA4 * @brief Sensor driver for BMA4 sensor */ #ifndef BMA4_H__ #define BMA4_H__ /*********************************************************************/ /* header files */ #include "bma4_defs.h" #ifdef AKM9916 #include "aux_akm9916.h" #endif #ifdef BMM150 #include "aux_bmm150.h" #endif /*********************************************************************/ /* (extern) variable declarations */ /*********************************************************************/ /* function prototype declarations */ /** * \ingroup bma4 * \defgroup bma4ApiInit Initialization * @brief Initialize the sensor and device structure */ /*! * \ingroup bma4ApiInit * \page bma4_api_bma4_init bma4_init * \code * int8_t bma4_init(struct bma4_dev *dev); * \endcode * @details This API is the entry point. * Call this API before using all other APIs. * This API reads the chip-id of the sensor which is the first step to * verify the sensor and also it configures the read mechanism of SPI and * I2C interface. * * @param[in,out] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * * @note * While changing the parameter of the bma4 * consider the following point: * Changing the reference value of the parameter * will changes the local copy or local reference * make sure your changes will not * affect the reference value of the parameter * (Better case don't change the reference value of the parameter) */ int8_t bma4_init(struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiConfig ConfigFile * @brief Write binary configuration in the sensor */ /*! * \ingroup bma4ApiConfig * \page bma4_api_bma4_write_config_file bma4_write_config_file * \code * int8_t bma4_write_config_file(struct bma4_dev *dev); * \endcode * @details This API is used to write the binary configuration in the sensor * * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_write_config_file(struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiRegisters Registers * @brief Perform read / write operation to registers of the sensor */ /*! * \ingroup bma4ApiRegisters * \page bma4_api_bma4_write_regs bma4_write_regs * \code * int8_t bma4_write_regs(uint8_t addr, uint8_t *data, uint8_t len, struct bma4_dev *dev); * \endcode * @details This API checks whether the write operation requested is for * feature config or register write and accordingly writes the data in the * sensor. * * @note user has to disable the advance power save mode in the sensor when * using this API in burst write mode. * bma4_set_advance_power_save(BMA4_DISABLE, dev); * * @param[in] addr : Register address. * @param[in] data : Write data buffer * @param[in] len : No of bytes to write * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_write_regs(uint8_t addr, const uint8_t *data, uint32_t len, struct bma4_dev *dev); /*! * \ingroup bma4ApiRegisters * \page bma4_api_bma4_read_regs bma4_read_regs * \code * int8_t bma4_write_regs(uint8_t addr, uint8_t *data, uint8_t len, struct bma4_dev *dev); * \endcode * @details This API checks whether the read operation requested is for * feature or register read and accordingly reads the data from the sensor. * * @param[in] addr : Register address. * @param[in] data : Read data buffer. * @param[in] len : No of bytes to read. * @param[in] dev : Structure instance of bma4_dev * * @note For most of the registers auto address increment applies, with the * exception of a few special registers, which trap the address. For e.g., * Register address - 0x26, 0x5E. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_read_regs(uint8_t addr, uint8_t *data, uint32_t len, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiErrorStatus Error Status * @brief Read error status of the sensor */ /*! * \ingroup bma4ApiErrorStatus * \page bma4_api_bma4_get_error_status bma4_get_error_status * \code * int8_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev);; * \endcode * @details This API reads the error status from the sensor. * * Below table mention the types of error which can occur in the sensor * *@verbatim ************************************************************************* * Error | Description *************************|*********************************************** * | Fatal Error, chip is not in operational * fatal | state (Boot-, power-system). * | This flag will be reset only by * | power-on-reset or soft reset. *************************|*********************************************** * cmd | Command execution failed. *************************|*********************************************** * | Value Name Description * error_code | 000 no_error no error * | 001 acc_err error in * | ACC_CONF *************************|*********************************************** * | Error in FIFO detected: Input data was * fifo | discarded in stream mode. This flag * | will be reset when read. *************************|*********************************************** * mag | Error in I2C-Master detected. * | This flag will be reset when read. ************************************************************************* *@endverbatim * * @param[in,out] err_reg : Pointer to structure variable which stores the * error status read from the sensor. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiStatus Status * @brief Read sensor status */ /*! * \ingroup bma4ApiStatus * \page bma4_api_bma4_get_status bma4_get_status * \code * int8_t bma4_get_status(uint8_t *status, struct bma4_dev *dev); * \endcode * @details This API reads the sensor status from the dev sensor. * * Below table lists the sensor status flags * * @verbatim * Status | Description * ----------------------------|---------------------------------------- * BMA4_MAG_MAN_OP_ONGOING | Manual Mag. interface operation ongoing * BMA4_CMD_RDY | Command decoder is ready. * BMA4_MAG_DATA_RDY | Data ready for Mag. * BMA4_ACC_DATA_RDY | Data ready for Accel. *@endverbatim * * @param[in] status : Variable used to store the sensor status flags * which is read from the sensor. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_status(uint8_t *status, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccelxyz Accel XYZ Data * @brief Read accel xyz data from the sensor */ /*! * \ingroup bma4ApiAccelxyz * \page bma4_api_bma4_read_accel_xyz bma4_read_accel_xyz * \code * int8_t bma4_read_accel_xyz(struct bma4_accel *accel, struct bma4_dev *dev); * \endcode * @details This API reads the Accel data for x,y and z axis from the sensor. * The data units is in LSB format. * * @param[in] accel : Variable used to store the Accel data which is read * from the sensor. * @param[in] dev : Structure instance of bma4_dev. * * @note For setting the Accel configuration use the below function * bma4_set_accel_config * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_read_accel_xyz(struct bma4_accel *accel, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiSensorTime Sensor Time * @brief Read sensor time of the sensor */ /*! * \ingroup bma4ApiSensorTime * \page bma4_api_bma4_get_sensor_time bma4_get_sensor_time * \code * int8_t bma4_get_sensor_time(uint32_t *sensor_time, struct bma4_dev *dev); * \endcode * @details This API reads the sensor time of Sensor time gets updated * with every update of data register or FIFO. * * @param[in] sensor_time : Pointer variable which stores sensor time * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_sensor_time(uint32_t *sensor_time, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiTemperature Temperature * @brief Read chip temperature of the sensor */ /*! * \ingroup bma4ApiTemperature * \page bma4_api_bma4_get_temperature bma4_get_temperature * \code * int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *dev); * \endcode * @details This API reads the chip temperature of sensor. * @note If Accel and Mag are disabled, the temperature value will be set * to invalid. * * @param[out] temp : Pointer variable which stores the temperature value. * @param[in] temp_unit : indicates the unit of temperature * * @verbatim * temp_unit | description * ------------|------------------- * BMA4_DEG | degrees Celsius * BMA4_FAHREN | degrees fahrenheit * BMA4_KELVIN | degrees kelvin *@endverbatim * * @param[in] dev : Structure instance of bma4_dev. * * @note Using a scaling factor of 1000, to obtain integer values, which * at the user end, are used to get accurate temperature value. * BMA4_SCALE_FARHAN = 1.8 * 1000, BMA4_SCALE_KELVIN = 273.15 * 1000 * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccel Accel Configuration * @brief Read / Write configurations of accel sensor */ /*! * \ingroup bma4ApiAccel * \page bma4_api_bma4_get_accel_config bma4_get_accel_config * \code * int8_t bma4_get_accel_config(struct bma4_accel_config *accel, struct bma4_dev *dev); * \endcode * @details This API reads the Output data rate, Bandwidth, perf_mode * and Range of accel. * * @param[in,out] accel : Address of user passed structure which is used * to store the Accel configurations read from the sensor. * * @note Enums and corresponding values for structure parameters like * Odr, Bandwidth and Range are mentioned in the below tables. * *@verbatim * Value | Odr * -----------|------------------------------------ * 1 | BMA4_OUTPUT_DATA_RATE_0_78HZ * 2 | BMA4_OUTPUT_DATA_RATE_1_56HZ * 3 | BMA4_OUTPUT_DATA_RATE_3_12HZ * 4 | BMA4_OUTPUT_DATA_RATE_6_25HZ * 5 | BMA4_OUTPUT_DATA_RATE_12_5HZ * 6 | BMA4_OUTPUT_DATA_RATE_25HZ * 7 | BMA4_OUTPUT_DATA_RATE_50HZ * 8 | BMA4_OUTPUT_DATA_RATE_100HZ * 9 | BMA4_OUTPUT_DATA_RATE_200HZ * 10 | BMA4_OUTPUT_DATA_RATE_400HZ * 11 | BMA4_OUTPUT_DATA_RATE_800HZ * 12 | BMA4_OUTPUT_DATA_RATE_1600HZ *@endverbatim * *@verbatim * Value | accel_bw * ------|-------------------------- * 0 | BMA4_ACCEL_OSR4_AVG1 * 1 | BMA4_ACCEL_OSR2_AVG2 * 2 | BMA4_ACCEL_NORMAL_AVG4 * 3 | BMA4_ACCEL_CIC_AVG8 * 4 | BMA4_ACCEL_RES_AVG16 * 5 | BMA4_ACCEL_RES_AVG32 * 6 | BMA4_ACCEL_RES_AVG64 * 7 | BMA4_ACCEL_RES_AVG128 *@endverbatim * *@verbatim * Value | g_range * --------|--------------------- * 0x00 | BMA4_ACCEL_RANGE_2G * 0x01 | BMA4_ACCEL_RANGE_4G * 0x02 | BMA4_ACCEL_RANGE_8G * 0x03 | BMA4_ACCEL_RANGE_16G *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_accel_config(struct bma4_accel_config *accel, struct bma4_dev *dev); /*! * \ingroup bma4ApiAccel * \page bma4_api_bma4_set_accel_config bma4_set_accel_config * \code * int8_t bma4_set_accel_config(struct bma4_accel_config *accel, struct bma4_dev *dev); * \endcode * @details This API sets the output_data_rate, bandwidth, perf_mode * and range of Accel. * * @param[in] accel : Pointer to structure variable which specifies the * Accel configurations. * * @note Enums and corresponding values for structure parameters like * Odr, Bandwidth and Range are mentioned in the below tables. * * @verbatim * Value | ODR * --------|----------------------------------------- * 1 | BMA4_OUTPUT_DATA_RATE_0_78HZ * 2 | BMA4_OUTPUT_DATA_RATE_1_56HZ * 3 | BMA4_OUTPUT_DATA_RATE_3_12HZ * 4 | BMA4_OUTPUT_DATA_RATE_6_25HZ * 5 | BMA4_OUTPUT_DATA_RATE_12_5HZ * 6 | BMA4_OUTPUT_DATA_RATE_25HZ * 7 | BMA4_OUTPUT_DATA_RATE_50HZ * 8 | BMA4_OUTPUT_DATA_RATE_100HZ * 9 | BMA4_OUTPUT_DATA_RATE_200HZ * 10 | BMA4_OUTPUT_DATA_RATE_400HZ * 11 | BMA4_OUTPUT_DATA_RATE_800HZ * 12 | BMA4_OUTPUT_DATA_RATE_1600HZ * *@endverbatim * *@verbatim * Value | accel_bw * ------|-------------------------- * 0 | BMA4_ACCEL_OSR4_AVG1 * 1 | BMA4_ACCEL_OSR2_AVG2 * 2 | BMA4_ACCEL_NORMAL_AVG4 * 3 | BMA4_ACCEL_CIC_AVG8 * 4 | BMA4_ACCEL_RES_AVG16 * 5 | BMA4_ACCEL_RES_AVG32 * 6 | BMA4_ACCEL_RES_AVG64 * 7 | BMA4_ACCEL_RES_AVG128 *@endverbatim * *@verbatim * Value | g_range * --------|--------------------- * 0x00 | BMA4_ACCEL_RANGE_2G * 0x01 | BMA4_ACCEL_RANGE_4G * 0x02 | BMA4_ACCEL_RANGE_8G * 0x03 | BMA4_ACCEL_RANGE_16G *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_set_accel_config(const struct bma4_accel_config *accel, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAdvancedPowerMode Advanced Power Mode * @brief Read / Write advance power mode of accel sensor */ /*! * \ingroup bma4ApiAdvancedPowerMode * \page bma4_api_bma4_set_advance_power_save bma4_set_advance_power_save * \code * int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev *dev); * \endcode * @details This API sets the advance power save mode in the sensor. * * @note If advanced power save is enabled and the Accel and/or * magnetometer operate in duty cycling mode, the length of the unlatched * DRDY interrupt pulse is longer than 1/3.2 kHz (312.5 us). * * @param[in] adv_pwr_save : The value of advance power save mode * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev *dev); /*! * \ingroup bma4ApiAdvancedPowerMode * \page bma4_api_bma4_get_advance_power_save bma4_get_advance_power_save * \code * int8_t bma4_get_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev *dev); * \endcode * @details This API reads the status of advance power save mode * from the sensor. * * @note If the advanced power save is enabled and the Accel and/or * magnetometer operate in duty cycling mode, the length of the unlatched * DRDY interrupt pulse is longer than 1/3.2 kHz (312.5 us). * * @param[out] adv_pwr_save : The value of advance power save mode * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_advance_power_save(uint8_t *adv_pwr_save, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiFIFOSelfWakeUp FIFO Self Wake up * @brief Read / Write FIFO self wake up functionality in the sensor */ /*! * \ingroup bma4ApiFIFOSelfWakeUp * \page bma4_api_bma4_set_fifo_self_wakeup bma4_set_fifo_self_wakeup * \code * int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev); * \endcode * @details This API sets the FIFO self wake up functionality in the sensor. * * @note Functionality related to FIFO self wake up depends upon the * advance power save mode. for more info. refer data sheet. * * @param[in] fifo_self_wakeup : Variable used to enable or disable * FIFO self wake up functionality. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev); /*! * \ingroup bma4ApiFIFOSelfWakeUp * \page bma4_api_bma4_get_fifo_self_wakeup bma4_get_fifo_self_wakeup * \code * int8_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wakeup, struct bma4_dev *dev); * \endcode * @details This API gets the status of FIFO self wake up functionality from * the sensor. * * @note Functionality related to FIFO self wake up depends upon the * advance power save mode. for more info. refer data sheet. * * @param[out] fifo_self_wake_up : Pointer variable used to store the * fifo self wake up status. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wake_up, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccelEnable Accel Enable * @brief Enables / Disables accelerometer in the sensor */ /*! * \ingroup bma4ApiAccelEnable * \page bma4_api_bma4_set_accel_enable bma4_set_accel_enable * \code * int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev *dev); * \endcode * @details This API enables or disables the Accel in the sensor. * * @note Before reading Accel data, user should call this API. * * @param[in] accel_en : Variable used to enable or disable the Accel. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev *dev); /*! * \ingroup bma4ApiAccelEnable * \page bma4_api_bma4_get_accel_enable bma4_get_accel_enable * \code * int8_t bma4_get_accel_enable(uint8_t *accel_en, struct bma4_dev *dev); * \endcode * @details This API checks whether Accel is enabled or not in the sensor. * * @param[out] accel_en : Pointer variable used to store the Accel enable * status * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_accel_enable(uint8_t *accel_en, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagEnable Magnetometer Enable * @brief Enables / Disables Auxiliary Magnetometer in the sensor */ /*! * \ingroup bma4ApiMagEnable * \page bma4_api_bma4_set_mag_enable bma4_set_mag_enable * \code * int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev *dev); * \endcode * @details This API is used to enable or disable auxiliary Mag * in the sensor. * * @note Before reading Mag data, user should call this API. * * @param[in] mag_en : Variable used to enable or disable the Mag. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev *dev); /*! * \ingroup bma4ApiMagEnable * \page bma4_api_bma4_get_mag_enable bma4_get_mag_enable * \code * int8_t bma4_get_mag_enable(uint8_t *mag_en, struct bma4_dev *dev); * \endcode * @details This API is used to check whether the auxiliary Mag is enabled * or not in the sensor. * * @param[out] mag_en : Pointer variable used to store the enable status of * Mag in the sensor. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_mag_enable(uint8_t *mag_en, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiSpiInterface SPI interface * @brief Read / Write SPI interface mode set for primary interface */ /*! * \ingroup bma4AiSpiInterface * \page bma4_api_bma4_set_spi_interface bma4_set_spi_interface * \code * int8_t bma4_set_spi_interface(uint8_t *spi, struct bma4_dev *dev); * \endcode * @details This API reads the SPI interface mode which is set for primary * interface. * * @param[out] spi : Pointer variable which stores the SPI mode selection * * @verbatim * Value | Description * --------|------------------ * 0 | SPI 4-wire mode * 1 | SPI 3-wire mode * *@endverbatim * * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev); /*! * \ingroup bma4ApiSpiInterface * \page bma4_api_bma4_get_spi_interface bma4_get_spi_interface * \code * int8_t bma4_get_spi_interface(uint8_t spi, struct bma4_dev *dev); * \endcode * @details This API configures the SPI interface Mode for primary interface * * @param[in] spi : The value of SPI mode selection * *@verbatim * Value | Description * --------|------------------ * 0 | SPI 4-wire mode * 1 | SPI 3-wire mode * *@endverbatim * * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiCommandReg Command Register * @brief Write available sensor specific commands to the sensor */ /*! * \ingroup bma4ApiCommandReg * \page bma4_api_bma4_set_command_register bma4_set_command_register * \code * int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev *dev); * \endcode * @details This API writes the available sensor specific commands * to the sensor. * * @param[in] command_reg : The command to write to the command register * *@verbatim * value | Description * --------|------------------------------------------------------ * 0xB6 | Triggers a soft reset * 0xB0 | Clears all data in the FIFO, does not change * | FIFO_CONFIG and FIFO_DOWNS registers * 0xF0 | Reset acceleration data path *@endverbatim * * * @param[in] dev : Structure instance of bma4_dev. * * @note Register will always read as 0x00 * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiI2CAddr i2C Device Address * @brief Write I2C device address of auxiliary sensor */ /*! * \ingroup bma4ApiI2CAddr * \page bma4_api_bma4_set_i2c_device_addr bma4_set_i2c_device_addr * \code * int8_t bma4_set_i2c_device_addr(struct bma4_dev *dev); * \endcode * @details This API sets the I2C device address of auxiliary sensor * * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_i2c_device_addr(struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagManualEnable Mag Manual Enable * @brief Read / Write register access on magnetometer manually */ /*! * \ingroup bma4ApiMagManualEnable * \page bma4_api_bma4_set_mag_manual_enable bma4_set_mag_manual_enable * \code * int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev); * \endcode * @details This API sets the register access on MAG_IF[2], MAG_IF[3], * MAG_IF[4] in the sensor. This implies that the DATA registers are * not updated with Mag values automatically. * * @param[in] mag_manual : Variable used to specify the Mag manual * enable status. * *@verbatim * value | mag manual * ---------|-------------------- * 0x01 | BMA4_ENABLE * 0x00 | BMA4_DISABLE *@endverbatim * * @param[out] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev); /*! * \ingroup bma4ApiMagManualEnable * \page bma4_api_bma4_get_mag_manual_enable bma4_get_mag_manual_enable * \code * int8_t bma4_get_mag_manual_enable(uint8_t *mag_manual, struct bma4_dev *dev); * \endcode * @details This API checks whether the Mag access is done manually or * automatically in the sensor. * If the Mag access is done through manual mode then Mag data registers * in sensor are not updated automatically. * * @param[out] mag_manual : Mag manual enable value * *@verbatim * value | mag_manual * --------|------------------- * 0x01 | BMA4_ENABLE * 0x00 | BMA4_DISABLE *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_mag_manual_enable(uint8_t *mag_manual, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagIFMode Mag Interface Mode * @brief Set I2C interface configuration mode for auxiliary magnetometer */ /*! * \ingroup bma4ApiMagIFMode * \page bma4_api_bma4_set_aux_if_mode bma4_set_aux_if_mode * \code * int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev *dev); * \endcode * @details This API sets the I2C interface configuration(if) mode * for auxiliary Mag. * * @param[in] if_mode : The value of interface configuration mode * *@verbatim * Value | Description * ------------|------------------------------------------- * 0 | p_auto_s_off Auxiliary interface:off * 1 | p_auto_s_mag Auxiliary interface:on *@endverbatim * * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagRead Mag Read * @brief Set / Get address of register of Aux Mag sensor to read data */ /*! * \ingroup bma4ApiMagRead * \page bma4_api_bma4_get_mag_read_addr bma4_get_mag_read_addr * \code * int8_t bma4_get_mag_read_addr(uint8_t *mag_read_addr, struct bma4_dev *dev); * \endcode * @details This API gets the address of the register of Aux Mag sensor * where the data to be read. * * @param[out] mag_read_addr : Pointer variable used to store the * mag read address. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_mag_read_addr(uint8_t *mag_read_addr, struct bma4_dev *dev); /*! * \ingroup bma4ApiMagRead * \page bma4_api_bma4_set_mag_read_addr bma4_set_mag_read_addr * \code * int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev); * \endcode * @details This API sets the address of the register of Aux Mag sensor * where the data to be read. * * @param[in] mag_read_addr: Value of Mag. read address in order to read * the data from the auxiliary Mag. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagWrite Mag Write * @brief Set / Get address of register of Aux Mag sensor to write data */ /*! * \ingroup bma4ApiMagWrite * \page bma4_api_bma4_get_mag_write_addr bma4_get_mag_write_addr * \code * int8_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev); * \endcode * @details This API gets the Aux Mag write address from the sensor. * Mag write address is where the Mag data will be written. * * @param[out] mag_write_addr: Pointer used to store the Mag write address * which is read from the sensor. * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev); /*! * \ingroup bma4ApiMagWrite * \page bma4_api_bma4_set_mag_write_addr bma4_set_mag_write_addr * \code * int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev *dev); * \endcode * @details This API sets the Aux Mag write address in the sensor. * Mag write address is where the Mag data will be written. * * @param[in] mag_write_addr: Write address of Mag where the data will * be written. * @param[out] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagData Mag Data * @brief Read / Write data from the Mag sensor */ /*! * \ingroup bma4ApiMagData * \page bma4_api_bma4_get_mag_write_data bma4_get_mag_write_data * \code * int8_t bma4_get_mag_write_data(uint8_t *mag_write_data, struct bma4_dev *dev); * \endcode * @details This API reads the data from the sensor which is written to the * Mag. * * @param[out] mag_write_data: Pointer variable which stores the * data which is written in Mag through sensor. * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_mag_write_data(uint8_t *mag_write_data, struct bma4_dev *dev); /*! * \ingroup bma4ApiMagData * \page bma4_api_bma4_set_mag_write_data bma4_set_mag_write_data * \code * int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev *dev); * \endcode * @details This API sets the data in the sensor which in turn will * be written to Mag. * * @param[in] mag_write_data: variable which specify the data which is to * be written in Mag. * @param[out] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiReadMagXYZR Mag xyzr Data * @brief Read xyzr axes data from auxiliary Mag sensor */ /*! * \ingroup bma4ApiReadMagXYZR * \page bma4_api_bma4_read_mag_xyzr bma4_read_mag_xyzr * \code * int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr *mag, struct bma4_dev *dev); * \endcode * @details This API reads the x,y,z and r axis data from the auxiliary * Mag BMM150/AKM9916 sensor. * * @param[out] mag : Pointer variable to store the auxiliary Mag x,y,z * and r axis data read from the sensor. * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr *mag, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagBurst Mag Burst * @brief Set / Get burst data length of auxiliary Mag Sensor */ /*! * \ingroup bma4ApiMagBurst * \page bma4_api_bma4_set_mag_burst bma4_set_mag_burst * \code * int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev); * \endcode * @details This API sets the burst data length (1,2,6,8 byte) of auxiliary * Mag sensor. * * @param[in] mag_burst : Variable used to specify the Mag burst read length * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev); /*! * \ingroup bma4ApiMagBurst * \page bma4_api_bma4_get_mag_burst bma4_get_mag_burst * \code * int8_t bma4_get_mag_burst(uint8_t *mag_burst, struct bma4_dev *dev); * \endcode * @details This API reads the burst data length of Mag set in the sensor. * * @param[out] mag_burst : Pointer variable used to store the burst length * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_mag_burst(uint8_t *mag_burst, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiReadFIFO Read FIFO Data * @brief Read FIFO data of accel and/or Mag sensor */ /*! * \ingroup bma4ApiReadFIFO * \page bma4_api_bma4_read_fifo_data bma4_read_fifo_data * \code * int8_t bma4_read_fifo_data(struct bma4_fifo_frame *fifo, struct bma4_dev *dev); * \endcode * @details This API reads the FIFO data of Accel and/or Mag sensor * * @param dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_read_fifo_data(struct bma4_fifo_frame *fifo, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiFIFOWM FIFO Watermark level * @brief Read / Write FIFO watermark level in the sensor */ /*! * \ingroup bma4ApiFIFOWM * \page bma4_api_bma4_get_fifo_wm bma4_get_fifo_wm * \code * int8_t bma4_get_fifo_wm(uint16_t *fifo_wm, struct bma4_dev *dev); * \endcode * @details This API reads the FIFO water mark level which is set * in the sensor. * * @note The FIFO watermark is issued when the FIFO fill level is * equal or above the watermark level. * * @param[out] fifo_wm : Pointer variable to store FIFO water mark level * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_fifo_wm(uint16_t *fifo_wm, struct bma4_dev *dev); /*! * \ingroup bma4ApiFIFOWM * \page bma4_api_bma4_set_fifo_wm bma4_set_fifo_wm * \code * int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev *dev); * \endcode * @details This API sets the FIFO watermark level in the sensor. * * @note The FIFO watermark is issued when the FIFO fill level is * equal or above the watermark level. * * @param[in] fifo_wm : Variable used to set the FIFO water mark level * @param[out] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccelFIFOFilterData Accel FIFO Filter data * @brief Set / Get Filtered or unfiltered mode of Accel FIFO data */ /*! * \ingroup bma4ApiAccelFIFOFilterData * \page bma4_api_bma4_get_accel_fifo_filter_data bma4_get_accel_fifo_filter_data * \code * int8_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_dev *dev); * \endcode * @details This API checks whether the Accel FIFO data is set for filtered * or unfiltered mode. * * @param[out] accel_fifo_filter : Variable used to check whether the Accel * data is filtered or unfiltered. * *@verbatim * Value | accel_fifo_filter * ---------|------------------------- * 0x00 | Unfiltered data * 0x01 | Filtered data *@endverbatim * * @param[in] dev : structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_dev *dev); /*! * \ingroup bma4ApiAccelFIFOFilterData * \page bma4_api_bma4_set_accel_fifo_filter_data bma4_set_accel_fifo_filter_data * \code * int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_dev *dev); * \endcode * @details This API sets the condition of Accel FIFO data either to * filtered or unfiltered mode. * * @param[in] accel_fifo_filter : Variable used to set the filtered or * unfiltered condition of Accel FIFO data. * *@verbatim * value | accel_fifo_filter_data * -----------|------------------------- * 0x00 | Unfiltered data * 0x01 | Filtered data *@endverbatim * * @param[out] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccelFIFODown Accel FIFO Down Sampling * @brief Read / Write Down sampling rates configured for Accel FIFO Data */ /*! * \ingroup bma4ApiAccelFIFOFilterData * \page bma4_api_bma4_get_fifo_down_accel bma4_get_fifo_down_accel * \code * int8_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev); * \endcode * @details This API reads the down sampling rates which is configured * for Accel FIFO data. * * @param[out] fifo_down : Variable used to specify the Accel FIFO * down-sampling rates * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev); /*! * \ingroup bma4ApiAccelFIFOFilterData * \page bma4_api_bma4_set_fifo_down_accel bma4_set_fifo_down_accel * \code * int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev *dev); * \endcode * @details This API sets the down-sampling rates for Accel FIFO. * * @param[in] fifo_down : Variable used to specify the Accel FIFO * down-sampling rates. * @param[in] dev : structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiFIFOLength FIFO Length * @brief Read length of FIFO data available in the sensor (unit of bytes) */ /*! * \ingroup bma4ApiAccelFIFOFilterData * \page bma4_api_bma4_get_fifo_length bma4_get_fifo_length * \code * int8_t bma4_get_fifo_length(uint16_t *fifo_length, struct bma4_dev *dev); * \endcode * @details This API reads the length of FIFO data available in the sensor * in the units of bytes. * * @note This byte counter is updated each time a complete frame was read * or written * * @param[in] fifo_length : Pointer variable used to store the value of * fifo byte counter * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_get_fifo_length(uint16_t *fifo_length, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagCompensate Compensate Mag data * @brief Aligns and Compensates Mag Data of BMM150 / AKM9916 */ /*! * \ingroup bma4ApiAccelFIFOFilterData * \page bma4_api_bma4_second_if_mag_compensate_xyz bma4_second_if_mag_compensate_xyz * \code * int8_t bma4_second_if_mag_compensate_xyz(struct bma4_mag_fifo_data mag_fifo_data, * uint8_t mag_second_if, * const struct bma4_mag *compensated_mag_data); * * \endcode * @details This API aligns and compensates the Mag data of BMM150/AKM9916 * sensor. * * @param[in] mag_fifo_data: Structure object which stores the Mag x,yand z * axis FIFO data which is to be aligned and/or compensated. * @param[in] mag_second_if: Variable used to select the Mag sensor. * *@verbatim * Value | mag_second_if * --------|---------------------- * 1 | BMA4_SEC_IF_BMM150 * 2 | BMA4_SEC_IF_AKM09916 *@endverbatim * * @param[out] compensated_mag_data: Pointer variable used to store the * compensated Mag xyz axis data * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_second_if_mag_compensate_xyz(struct bma4_mag_fifo_data mag_fifo_data, uint8_t mag_second_if, const struct bma4_mag *compensated_mag_data); /** * \ingroup bma4 * \defgroup bma4ApiMagXYZ Mag XYZ * @brief Read x, y and z axes data from either BMM150 or AKM9916 sensor */ /*! * \ingroup bma4ApiMagXYZ * \page bma4_api_bma4_read_mag_xyz bma4_read_mag_xyz * \code * int8_t bma4_read_mag_xyz(const struct bma4_mag *mag, uint8_t sensor_select, const struct bma4_dev *dev); * \endcode * @details This API reads Mag. x,y and z axis data from either BMM150 or * AKM9916 sensor * * @param[out] mag : Structure pointer used to store the Mag x,y, and z axis * data read from the sensor. * * @param[in] sensor_select : Variable used to select the Mag sensor * *@verbatim * Value | Sensor * ---------|---------------------- * 0 | BMA4_SEC_IF_NULL * 1 | BMA4_SEC_IF_BMM150 * 2 | BMA4_SEC_IF_AKM09916 *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_read_mag_xyz(const struct bma4_mag *mag, uint8_t sensor_select, const struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiIFMode I2C interface configuration * @brief Set / Get auxiliary I2C interface configuration set in the sensor */ /*! * \ingroup bma4ApiIFMode * \page bma4_api_bma4_get_if_mode bma4_get_if_mode * \code * int8_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev); * \endcode * @details This API reads the auxiliary I2C interface configuration which * is set in the sensor. * * @param[out] if_mode : Pointer variable used to store the auxiliary * interface configuration. * *@verbatim * Value | Description * ----- |---------------------------------- * 0x00 | auxiliary interface:off * 0x01 | auxiliary interface:on *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev); /*! * \ingroup bma4ApiIFMode * \page bma4_api_bma4_set_if_mode bma4_set_if_mode * \code * int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev *dev); * \endcode * @details This API sets the auxiliary interface configuration in the sensor. * * @param[in] if_mode : Variable used to select the auxiliary interface * configuration. * *@verbatim * Value | Description * ----- |-------------------------- * 0x00 | auxiliary interface:off * 0x01 | auxiliary interface:on *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccelDataRdy Accel Data Ready * @brief Get accel data ready status from the sensor */ /*! * \ingroup bma4ApiAccelDataRdy * \page bma4_api_bma4_get_accel_data_rdy bma4_get_accel_data_rdy * \code * int8_t bma4_get_accel_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); * \endcode * @details This API reads the data ready status of Accel from the sensor. * @note The status get reset when Accel data register is read. * * @param[out] data_rdy : Pointer variable to store the data ready status * @param[in] dev : structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_accel_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiMagDataRdy Mag Data Ready * @brief Get Mag data ready status from the sensor */ /*! * \ingroup bma4ApiMagDataRdy * \page bma4_api_bma4_get_mag_data_rdy bma4_get_mag_data_rdy * \code * int8_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); * \endcode * @details This API reads the data ready status of Mag from the sensor. * The status get reset when Mag data register is read. * * @param[out] data_rdy : Pointer variable to store the data ready status * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiASICStatus ASIC status * @brief Read ASIC status from the sensor */ /*! * \ingroup bma4ApiASICStatus * \page bma4_api_bma4_get_asic_status bma4_get_asic_status * \code * int8_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_dev *dev); * \endcode * @details This API reads the ASIC status from the sensor. * The status information is mentioned in the below table. * *@verbatim ******************************************************************************* * Status | Description **************************|**************************************************** * sleep | ASIC is in sleep/halt state. * irq_ovrn | Dedicated interrupt is set again before previous * | interrupt was acknowledged. * wc_event | Watchcell event detected (ASIC stopped). * stream_transfer_active | stream transfer has started. ******************************************************************************* *@endverbatim * * @param[out] asic_status : Structure pointer used to store the ASIC * status read from the sensor. * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiOffsetComp Accel Offset Compensation * @brief Set / Get Accel Offset Compensation */ /*! * \ingroup bma4ApiOffsetComp * \page bma4_api_bma4_set_offset_comp bma4_set_offset_comp * \code * int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev *dev); * \endcode * @details This API enables the offset compensation for filtered and * unfiltered Accel data. * * @param[in] offset_en : Variable used to enable or disable offset * compensation * *@verbatim * offset_en | Description * ------------|---------------------- * 0 | BMA4_DISABLE * 1 | BMA4_ENABLE *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev *dev); /*! * \ingroup bma4ApiOffsetComp * \page bma4_api_bma4_get_offset_comp bma4_get_offset_comp * \code * int8_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev); * \endcode * @details This API gets the status of Accel offset compensation * * @param[out] offset_en : Pointer variable used to store the Accel offset * enable or disable status. * *@verbatim * offset_en | Description * ----------|-------------- * 0 | BMA4_DISABLE * 1 | BMA4_ENABLE *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiExtractAccel Accel Extract and Parse Frames * @brief Parse and Extract Accel frames from FIFO data read */ /*! * \ingroup bma4ApiExtractAccel * \page bma4_api_bma4_extract_accel bma4_extract_accel * \code * int8_t bma4_extract_accel(struct bma4_accel *accel_data, * uint16_t *accel_length, * struct bma4_fifo_frame *fifo, * const struct bma4_dev *dev); * \endcode * @details This API parses and extracts the accelerometer frames from * FIFO data read by the "bma4_read_fifo_data" API and stores it in the * "accel_data" structure instance. * * @note The bma4_extract_accel API should be called only after reading * the FIFO data by calling the bma4_read_fifo_data() API * * @param[in,out] accel_data : Structure instance of bma4_accel where * the accelerometer data in FIFO is stored. * @param[in,out] accel_length : Number of accelerometer frames * (x,y,z axes data) * @param[in,out] dev : Structure instance of bma4_dev. * * @note accel_length has the number of accelerometer frames * (1 accel frame = 6 bytes) which the user needs to extract and store is * provided as input parameter by the user and the Number of valid * accelerometer frames extracted and stored is updated in * "accel_length" at the end of execution of this API. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_extract_accel(struct bma4_accel *accel_data, uint16_t *accel_length, struct bma4_fifo_frame *fifo, const struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiExtractMag Mag Extract and Parse Frames * @brief Parse and Extract Accel frames from FIFO data read */ /*! * \ingroup bma4ApiExtractMag * \page bma4_api_bma4_extract_mag bma4_extract_mag * \code * int8_t bma4_extract_mag(const struct bma4_mag *mag_data, * uint16_t *mag_length, * struct bma4_fifo_frame *fifo, * const struct bma4_dev *dev); * \endcode * @details This API parses and extracts the magnetometer frames from * FIFO data read by the "bma4_read_fifo_data" API and stores it in the * "mag_data" structure instance parameter of this API * * @note The bma4_extract_mag API should be called only after reading * the FIFO data by calling the bma4_read_fifo_data() API * * @param[in,out] mag_data : Structure instance of bma4_mag_xyzr where * the magnetometer data in FIFO is stored. * @param[in,out] mag_length : Number of magnetometer frames (x,y,z,r data) * @param[in,out] dev : Structure instance of bma4_dev. * * @note mag_length has the number of magnetometer frames(x,y,z,r data) * (1 mag frame = 8 bytes) which the user needs to extract and store,It is * provided as input parameter by the user and the number of valid * magnetometer frames extracted and stored is updated in * "mag_length" at the end of execution of this API. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_extract_mag(const struct bma4_mag *mag_data, uint16_t *mag_length, struct bma4_fifo_frame *fifo, const struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccelSelftest Accel Self test * @brief Self test for accel */ /*! * \ingroup bma4ApiAccelSelftest * \page bma4_api_bma4_perform_accel_selftest bma4_perform_accel_selftest * \code * int8_t bma4_perform_accel_selftest(int8_t *result, struct bma4_dev *dev); * \endcode * @details This API checks whether the self test functionality of the sensor * is working or not * * @param[in] result : Pointer variable used to store the result of self test * operation * *@verbatim * result | Description * ---------|-------------------- * 0x00 | BMA4_SELFTEST_PASS * 0x01 | BMA4_SELFTEST_FAIL *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_perform_accel_selftest(int8_t *result, struct bma4_dev *dev); /*! * \ingroup bma4ApiAccelSelftest * \page bma4_api_bma4_selftest_config bma4_selftest_config * \code * int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev *dev); * \endcode * @details This API performs the steps needed for Self test operation * before reading the Accel Self test data. * * @param[in] sign: Variable used to specify the self test sign * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiInterrupt Interrupt Functions * @brief Interrupt mapping and set/get interrupt mode */ /*! * \ingroup bma4ApiInterrupt * \page bma4_api_bma4_map_interrupt bma4_map_interrupt * \code * int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev *dev); * \endcode * @details API sets the interrupt to either interrupt1 or * interrupt2 pin in the sensor. * * @param[in] int_line: Variable used to select interrupt pin1 or pin2 * *@verbatim * int_line | interrupt selection * ---------|------------------- * 0 | BMA4_INTR1_MAP * 1 | BMA4_INTR2_MAP *@endverbatim * * @param[in] int_map: Variable used to select a particular interrupt * in the sensor * * @param[in] enable : Variable used to enable or disable the interrupt * *@verbatim * Value | Behaviour * ---------|------------------- * 0x01 | BMA4_ENABLE * 0x00 | BMA4_DISABLE *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev *dev); /*! * \ingroup bma4ApiInterrupt * \page bma4_api_bma4_set_interrupt_mode bma4_set_interrupt_mode * \code * int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev); * \endcode * @details This API sets the interrupt mode in the sensor. * * @param[in] mode: Variable used to specify the interrupt mode which * is to be set in the sensor. * *@verbatim * Mode | Value * ----------------------- |--------- * BMA4_NON_LATCH_MODE | 0 * BMA4_LATCH_MODE | 1 *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev); /*! * \ingroup bma4ApiInterrupt * \page bma4_api_bma4_get_interrupt_mode bma4_get_interrupt_mode * \code * int8_t bma4_get_interrupt_mode(uint8_t *mode, struct bma4_dev *dev); * \endcode * @details This API gets the interrupt mode which is set in the sensor. * * @param[out] mode: Pointer variable used to store the interrupt mode set in * in the sensor. * *@verbatim * Mode | Value * ---------------------|--------------- * BMA4_NON_LATCH_MODE | 0 * BMA4_LATCH_MODE | 1 *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_get_interrupt_mode(uint8_t *mode, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAuxMagConfig Auxiliary Mag Config * @brief Set / Get Auxiliary Mag(BMM150 or AKM9916) output data rate and offset */ /*! * \ingroup bma4ApiAuxMagConfig * \page bma4_api_bma4_set_aux_mag_config bma4_set_aux_mag_config * \code * int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev); * \endcode * @details This API sets the auxiliary Mag(BMM150 or AKM9916) output data * rate and offset. * * @param[in] aux_mag : Pointer to structure variable used to specify * the auxiliary Mag configuration. * *@verbatim *------------------------------------------------------------------------------ * Odr | Value *----------------------------------------|--------------------------------- * BMA4_OUTPUT_DATA_RATE_0_78HZ | 0x01 * BMA4_OUTPUT_DATA_RATE_1_56HZ | 0x02 * BMA4_OUTPUT_DATA_RATE_3_12HZ | 0x03 * BMA4_OUTPUT_DATA_RATE_6_25HZ | 0x04 * BMA4_OUTPUT_DATA_RATE_12_5HZ | 0x05 * BMA4_OUTPUT_DATA_RATE_25HZ | 0x06 * BMA4_OUTPUT_DATA_RATE_50HZ | 0x07 * BMA4_OUTPUT_DATA_RATE_100HZ | 0x08 * BMA4_OUTPUT_DATA_RATE_200HZ | 0x09 * BMA4_OUTPUT_DATA_RATE_400HZ | 0x0A * BMA4_OUTPUT_DATA_RATE_800HZ | 0x0B * BMA4_OUTPUT_DATA_RATE_1600HZ | 0x0C *------------------------------------------------------------------------------ * Offset | Value *--------------------------------------------|--------------------------------- * BMA4_MAG_OFFSET_MAX | 0x00 *--------------------------------------------|--------------------------------- *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev); /*! * \ingroup bma4ApiAuxMagConfig * \page bma4_api_bma4_get_aux_mag_config bma4_get_aux_mag_config * \code * int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev); * \endcode * @details This API reads the auxiliary Mag(BMM150 or AKM9916) output data * rate and offset. * @note : Valid output data rates are mentioned in the below table * * @param[out] aux_mag : Pointer to structure variable used to store the * auxiliary Mag configuration read from the sensor * *@verbatim *------------------------------------------------------------------------ * Odr | Value *----------------------------------------|------------------------------- * BMA4_OUTPUT_DATA_RATE_0_78HZ | 0x01 * BMA4_OUTPUT_DATA_RATE_1_56HZ | 0x02 * BMA4_OUTPUT_DATA_RATE_3_12HZ | 0x03 * BMA4_OUTPUT_DATA_RATE_6_25HZ | 0x04 * BMA4_OUTPUT_DATA_RATE_12_5HZ | 0x05 * BMA4_OUTPUT_DATA_RATE_25HZ | 0x06 * BMA4_OUTPUT_DATA_RATE_50HZ | 0x07 * BMA4_OUTPUT_DATA_RATE_100HZ | 0x08 * BMA4_OUTPUT_DATA_RATE_200HZ | 0x09 * BMA4_OUTPUT_DATA_RATE_400HZ | 0x0A * BMA4_OUTPUT_DATA_RATE_800HZ | 0x0B * BMA4_OUTPUT_DATA_RATE_1600HZ | 0x0C *------------------------------------------------------------------------- * Offset | Value *----------------------------------------|-------------------------------- * BMA4_MAG_OFFSET_MAX | 0x00 *------------------------------------------------------------------------- *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiFIFOConfig FIFO Configuration * @brief Set / Get FIFO Configuration in the sensor */ /*! * \ingroup bma4ApiFIFOConfig * \page bma4_api_bma4_set_fifo_config bma4_set_fifo_config * \code * int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev *dev); * \endcode * @details This API sets the FIFO configuration in the sensor. * * @param[in] config : Enum variable used to specify the FIFO * configurations which are to be enabled or disabled in the sensor. * * @note : User can set either one or more or all FIFO configurations * by ORing the below mentioned enums. * *@verbatim * config | Value * ------------------------|--------------------------- * BMA4_FIFO_STOP_ON_FULL | 0x01 * BMA4_FIFO_TIME | 0x02 * BMA4_FIFO_TAG_INTR2 | 0x04 * BMA4_FIFO_TAG_INTR1 | 0x08 * BMA4_FIFO_HEADER | 0x10 * BMA4_FIFO_MAG | 0x20 * BMA4_FIFO_ACCEL | 0x40 * BMA4_FIFO_ALL | 0x7F *@endverbatim * * @param[in] enable : Parameter used to enable or disable the above * FIFO configuration * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev *dev); /*! * \ingroup bma4ApiFIFOConfig * \page bma4_api_bma4_get_fifo_config bma4_get_fifo_config * \code * int8_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev); * \endcode * @details This API reads the FIFO configuration from the sensor. * * @param[in] fifo_config : Enum variable used to get the below fifo * configuration from the sensor. * * @note After calling this function user should do the AND operation with * the enum value populated by this function to know which FIFO * configuration is enabled. * *@verbatim * fifo_config | Value * -------------------------|-------------------------- * BMA4_FIFO_STOP_ON_FULL | 0x01 * BMA4_FIFO_TIME | 0x02 * BMA4_FIFO_TAG_INTR2 | 0x04 * BMA4_FIFO_TAG_INTR1 | 0x08 * BMA4_FIFO_HEADER | 0x10 * BMA4_FIFO_MAG | 0x20 * BMA4_FIFO_ACCEL | 0x40 * BMA4_FIFO_ALL | 0x7F *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiIntConfig Interrupt Pin Config * @brief Set / Get Electrical behavior of interrupt pin1 or pin2 of the sensor */ /*! * \ingroup bma4ApiIntConfig * \page bma4_api_bma4_set_int_pin_config bma4_set_int_pin_config * \code * int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config *int_pin_config, * uint8_t int_line, * struct bma4_dev *dev); * * \endcode * @details This function sets the electrical behaviour of interrupt pin1 or * pin2 in the sensor. * * @param[in] int_pin_config : Pointer to structure variable which specifies * the configuration data of either interrupt pin1 or 2. * *@verbatim * ************************************************************************ * Structure field members | Macros * ********************************|*************************************** * edge_ctrl | BMA4_LEVEL_TRIGGER(0) * | BMA4_EDGE_TRIGGER(1) * ********************************|*************************************** * lvl | BMA4_ACTIVE_LOW(0) * | BMA4_ACTIVE_HIGH(1) * ********************************|*************************************** * od | BMA4_PUSH_PULL(0) * | BMA4_OPEN_DRAIN(1) * ********************************|*************************************** * output_en | BMA4_OUTPUT_DISABLE(0) * | BMA4_OUTPUT_ENABLE(1) * ********************************|*************************************** * input_en | BMA4_INPUT_DISABLE(0) * | BMA4_INPUT_ENABLE(1) * ************************************************************************ *@endverbatim * * @param[in] int_line : Variable used to select the interrupt pin1 or * pin2 for interrupt configuration. * *@verbatim * int_line | Value * ----------------|---------------------- * BMA4_INTR1_MAP | 0 * BMA4_INTR2_MAP | 1 *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail */ int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config *int_pin_config, uint8_t int_line, struct bma4_dev *dev); /*! * \ingroup bma4ApiIntConfig * \page bma4_api_bma4_get_int_pin_config bma4_get_int_pin_config * \code * int8_t bma4_get_int_pin_config(struct bma4_int_pin_config *int_pin_config, uint8_t int_line, struct bma4_dev *dev); * \endcode * @details This API reads the electrical behavior of interrupt pin1 or pin2 * from the sensor. * * @param[out] int_pin_config : Pointer to structure variable which stores the * configuration data of either interrupt pin1 or pin2 read from the sensor * *@verbatim * ************************************************************************ * Structure field members | Macros * ************************|*********************************************** * edge_ctrl | BMA4_LEVEL_TRIGGER(0) * | BMA4_EDGE_TRIGGER(1) * ************************|*********************************************** * lvl | BMA4_ACTIVE_LOW(0) * | BMA4_ACTIVE_HIGH(1) * ************************|*********************************************** * od | BMA4_PUSH_PULL(0) * | BMA4_OPEN_DRAIN(1) * ************************|*********************************************** * output_en | BMA4_OUTPUT_DISABLE(0) * | BMA4_OUTPUT_ENABLE(1) * ************************|*********************************************** * input_en | BMA4_INPUT_DISABLE(0) * | BMA4_INPUT_ENABLE(1) * ************************************************************************ *@endverbatim * * @param[in] int_line : Variable used to select the interrupt pin1 or * pin2 for interrupt configuration. * *@verbatim * int_line | Value * -------------------|--------------- * BMA4_INTR1_MAP | 0 * BMA4_INTR2_MAP | 1 *@endverbatim * * @param[in] dev : Structure instance of bma4_dev * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_get_int_pin_config(struct bma4_int_pin_config *int_pin_config, uint8_t int_line, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiIntStatus Interrupt Status * @brief Read Feature interrupt and/or Hardware interrupt status from the sensor */ /*! * \ingroup bma4ApiIntStatus * \page bma4_api_bma4_read_int_status bma4_read_int_status * \code * int8_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev); * \endcode * @details This API reads the Feature and Hardware interrupt status from the sensor. * * @param[out] int_status : Variable used to get the interrupt status. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev); /*! * \ingroup bma4ApiIntStatus * \page bma4_api_bma4_read_int_status_0 bma4_read_int_status_0 * \code * int8_t bma4_read_int_status_0(uint8_t *int_status_0, struct bma4_dev *dev); * \endcode * @details This API reads the Feature interrupt status from the sensor. * * @param[out] int_status_0 : Variable used to get the interrupt status. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_read_int_status_0(uint8_t *int_status_0, struct bma4_dev *dev); /*! * \ingroup bma4ApiIntStatus * \page bma4_api_bma4_read_int_status_1 bma4_read_int_status_1 * \code * int8_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev); * \endcode * @details This API reads the Hardware interrupt status from the sensor. * * @param[out] int_status_1 : Variable used to get the interrupt status. * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAux Auxiliary interface * @brief Initialize and read/write data to auxiliary interface */ /*! * \ingroup bma4ApiAux * \page bma4_api_bma4_aux_interface_init bma4_aux_interface_init * \code * int8_t bma4_aux_interface_init(struct bma4_dev *dev); * \endcode * @details This API initializes the auxiliary interface to access * auxiliary sensor * * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_aux_interface_init(struct bma4_dev *dev); /*! * \ingroup bma4ApiAux * \page bma4_api_bma4_aux_read bma4_aux_read * \code * int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, struct bma4_dev *dev); * \endcode * @details This API reads the data from the auxiliary sensor * * @param[in] dev : Structure instance of bma4_dev. * @param[in] len : User specified data length * @param[out] aux_data : Pointer variable to store data read * @param[in] aux_reg_addr : Variable to pass address from where * data is to be read * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, struct bma4_dev *dev); /*! * \ingroup bma4ApiAux * \page bma4_api_bma4_aux_write bma4_aux_write * \code * int8_t bma4_aux_write(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, struct bma4_dev *dev); * \endcode * @details This API writes the data into the auxiliary sensor * * @param[in] dev : Structure instance of bma4_dev. * @param[in] len : User specified data length * @param[out] aux_data : Pointer variable to store data read * @param[in] aux_reg_addr : Variable to pass address from where * data is to be written * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_aux_write(uint8_t aux_reg_addr, const uint8_t *aux_data, uint16_t len, struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiSoftReset Soft Reset * @brief Perform Soft Reset of the sensor */ /*! * \ingroup bma4ApiSoftReset * \page bma4_api_bma4_soft_reset bma4_soft_reset * \code * int8_t bma4_soft_reset(struct bma4_dev *dev); * \endcode * @details This API commands to do soft reset * * @param[in] dev : Structure instance of bma4_dev. * * @return Result of API execution status * @retval 0 -> Success * @retval < 0 -> Fail * */ int8_t bma4_soft_reset(struct bma4_dev *dev); /** * \ingroup bma4 * \defgroup bma4ApiAccelFoc Accel FOC * @brief Performs Fast Offset Compensation for accel */ /*! * \ingroup bma4ApiAccelFoc * \page bma4_api_bma4_perform_accel_foc bma4_perform_accel_foc * \code * int8_t bma4_perform_accel_foc(const struct bma4_accel_foc_g_value *accel_g_value, struct bma4_dev *dev); * \endcode * @details This API performs Fast Offset Compensation for Accel. * @param[in] accel_g_value : Array which stores the Accel g units * for x,y and z-axis. * *@verbatim * accel_g_value | Description * --------------------------|--------------------------------------- * accel_g_value[0] | x-axis g units * accel_g_value[1] | y-axis g units * accel_g_value[2] | z-axis g units *@endverbatim * * @param[in] dev : Structure instance of dev. * * @return Result of API execution status. * @retval 0 -> Success * @retval Any non zero value -> Fail * */ int8_t bma4_perform_accel_foc(const struct bma4_accel_foc_g_value *accel_g_value, struct bma4_dev *dev); #endif /* End of __BMA4_H__ */ |