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
/* automatically generated by rust-bindgen */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage, Align>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
storage: Storage,
align: [Align; 0],
}
impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
#[inline]
pub fn new(storage: Storage) -> Self {
Self {
storage,
align: [],
}
}
#[inline]
pub fn get_bit(&self, index: usize) -> bool {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = self.storage.as_ref()[byte_index];
let bit_index =
if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
byte & mask == mask
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = &mut self.storage.as_mut()[byte_index];
let bit_index =
if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
if val {
*byte |= mask;
} else {
*byte &= !mask;
}
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
let mut val = 0;
for i in 0..(bit_width as usize) {
if self.get_bit(i + bit_offset) {
let index =
if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index =
if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
self.set_bit(index + bit_offset, val_bit_is_set);
}
}
}
pub const HAL_kInvalidHandle : u32 = 0 ; pub const HAL_kMaxJoystickAxes : u32 = 12 ; pub const HAL_kMaxJoystickPOVs : u32 = 12 ; pub const HAL_kMaxJoysticks : u32 = 6 ; pub type HAL_Handle = i32 ; pub type HAL_PortHandle = HAL_Handle ; pub type HAL_AnalogInputHandle = HAL_Handle ; pub type HAL_AnalogOutputHandle = HAL_Handle ; pub type HAL_AnalogTriggerHandle = HAL_Handle ; pub type HAL_CompressorHandle = HAL_Handle ; pub type HAL_CounterHandle = HAL_Handle ; pub type HAL_DigitalHandle = HAL_Handle ; pub type HAL_DigitalPWMHandle = HAL_Handle ; pub type HAL_EncoderHandle = HAL_Handle ; pub type HAL_FPGAEncoderHandle = HAL_Handle ; pub type HAL_GyroHandle = HAL_Handle ; pub type HAL_InterruptHandle = HAL_Handle ; pub type HAL_NotifierHandle = HAL_Handle ; pub type HAL_RelayHandle = HAL_Handle ; pub type HAL_SolenoidHandle = HAL_Handle ; pub type HAL_CANHandle = HAL_Handle ; pub type HAL_PDPHandle = HAL_CANHandle ; pub type HAL_Bool = i32 ; pub mod HAL_AccelerometerRange {
/// The acceptable accelerometer ranges.
pub type Type = i32 ; pub const HAL_AccelerometerRange_k2G : Type = 0 ; pub const HAL_AccelerometerRange_k4G : Type = 1 ; pub const HAL_AccelerometerRange_k8G : Type = 2 ; } extern "C" {
/// Sets the accelerometer to active or standby mode.
///
/// It must be in standby mode to change any configuration.
///
/// @param active true to set to active, false for standby
pub fn HAL_SetAccelerometerActive ( active : HAL_Bool ) ; } extern "C" {
/// Sets the range of values that can be measured (either 2, 4, or 8 g-forces).
///
/// The accelerometer should be in standby mode when this is called.
///
/// @param range the accelerometer range
pub fn HAL_SetAccelerometerRange ( range : HAL_AccelerometerRange::Type ) ; } extern "C" {
/// Gets the x-axis acceleration.
///
/// This is a floating point value in units of 1 g-force.
///
/// @return the X acceleration
pub fn HAL_GetAccelerometerX ( ) -> f64 ; } extern "C" {
/// Gets the y-axis acceleration.
///
/// This is a floating point value in units of 1 g-force.
///
/// @return the Y acceleration
pub fn HAL_GetAccelerometerY ( ) -> f64 ; } extern "C" {
/// Gets the z-axis acceleration.
///
/// This is a floating point value in units of 1 g-force.
///
/// @return the Z acceleration
pub fn HAL_GetAccelerometerZ ( ) -> f64 ; } extern "C" {
/// Is the channel attached to an accumulator.
///
/// @param analogPortHandle Handle to the analog port.
/// @return The analog channel is attached to an accumulator.
pub fn HAL_IsAccumulatorChannel ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Initialize the accumulator.
///
/// @param analogPortHandle Handle to the analog port.
pub fn HAL_InitAccumulator ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) ; } extern "C" {
/// Resets the accumulator to the initial value.
///
/// @param analogPortHandle Handle to the analog port.
pub fn HAL_ResetAccumulator ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) ; } extern "C" {
/// Set the center value of the accumulator.
///
/// The center value is subtracted from each A/D value before it is added to the
/// accumulator. This is used for the center value of devices like gyros and
/// accelerometers to make integration work and to take the device offset into
/// account when integrating.
///
/// This center value is based on the output of the oversampled and averaged
/// source from channel 1. Because of this, any non-zero oversample bits will
/// affect the size of the value for this field.
///
/// @param analogPortHandle Handle to the analog port.
/// @param center The center value of the accumulator.
pub fn HAL_SetAccumulatorCenter ( analogPortHandle : HAL_AnalogInputHandle , center : i32 , status : * mut i32 ) ; } extern "C" {
/// Set the accumulator's deadband.
///
/// @param analogPortHandle Handle to the analog port.
/// @param deadband The deadband of the accumulator.
pub fn HAL_SetAccumulatorDeadband ( analogPortHandle : HAL_AnalogInputHandle , deadband : i32 , status : * mut i32 ) ; } extern "C" {
/// Read the accumulated value.
///
/// Read the value that has been accumulating on channel 1.
/// The accumulator is attached after the oversample and average engine.
///
/// @param analogPortHandle Handle to the analog port.
/// @return The 64-bit value accumulated since the last Reset().
pub fn HAL_GetAccumulatorValue ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i64 ; } extern "C" {
/// Read the number of accumulated values.
///
/// Read the count of the accumulated values since the accumulator was last
/// Reset().
///
/// @param analogPortHandle Handle to the analog port.
/// @return The number of times samples from the channel were accumulated.
pub fn HAL_GetAccumulatorCount ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i64 ; } extern "C" {
/// Read the accumulated value and the number of accumulated values atomically.
///
/// This function reads the value and count from the FPGA atomically.
/// This can be used for averaging.
///
/// @param analogPortHandle Handle to the analog port.
/// @param value Pointer to the 64-bit accumulated output.
/// @param count Pointer to the number of accumulation cycles.
pub fn HAL_GetAccumulatorOutput ( analogPortHandle : HAL_AnalogInputHandle , value : * mut i64 , count : * mut i64 , status : * mut i32 ) ; } extern "C" {
/// Initializes an analog gyro.
///
/// @param handle handle to the analog port
/// @return the initialized gyro handle
pub fn HAL_InitializeAnalogGyro ( handle : HAL_AnalogInputHandle , status : * mut i32 ) -> HAL_GyroHandle ; } extern "C" {
/// Sets up an analog gyro with the proper offsets and settings for the KOP
/// analog gyro.
///
/// @param handle the gyro handle
pub fn HAL_SetupAnalogGyro ( handle : HAL_GyroHandle , status : * mut i32 ) ; } extern "C" {
/// Frees an analog gyro.
///
/// @param handle the gyro handle
pub fn HAL_FreeAnalogGyro ( handle : HAL_GyroHandle ) ; } extern "C" {
/// Sets the analog gyro parameters to the specified values.
///
/// This is meant to be used if you want to reuse the values from a previous
/// calibration.
///
/// @param handle the gyro handle
/// @param voltsPerDegreePerSecond the gyro volts scaling
/// @param offset the gyro offset
/// @param center the gyro center
pub fn HAL_SetAnalogGyroParameters ( handle : HAL_GyroHandle , voltsPerDegreePerSecond : f64 , offset : f64 , center : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the analog gyro volts per degrees per second scaling.
///
/// @param handle the gyro handle
/// @param voltsPerDegreePerSecond the gyro volts scaling
pub fn HAL_SetAnalogGyroVoltsPerDegreePerSecond ( handle : HAL_GyroHandle , voltsPerDegreePerSecond : f64 , status : * mut i32 ) ; } extern "C" {
/// Resets the analog gyro value to 0.
///
/// @param handle the gyro handle
pub fn HAL_ResetAnalogGyro ( handle : HAL_GyroHandle , status : * mut i32 ) ; } extern "C" {
/// Calibrates the analog gyro.
///
/// This happens by calculating the average value of the gyro over 5 seconds, and
/// setting that as the center. Note that this call blocks for 5 seconds to
/// perform this.
///
/// @param handle the gyro handle
pub fn HAL_CalibrateAnalogGyro ( handle : HAL_GyroHandle , status : * mut i32 ) ; } extern "C" {
/// Sets the deadband of the analog gyro.
///
/// @param handle the gyro handle
/// @param volts the voltage deadband
pub fn HAL_SetAnalogGyroDeadband ( handle : HAL_GyroHandle , volts : f64 , status : * mut i32 ) ; } extern "C" {
/// Gets the gyro angle in degrees.
///
/// @param handle the gyro handle
/// @return the gyro angle in degrees
pub fn HAL_GetAnalogGyroAngle ( handle : HAL_GyroHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the gyro rate in degrees/second.
///
/// @param handle the gyro handle
/// @return the gyro rate in degrees/second
pub fn HAL_GetAnalogGyroRate ( handle : HAL_GyroHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the calibrated gyro offset.
///
/// Can be used to not repeat a calibration but reconstruct the gyro object.
///
/// @param handle the gyro handle
/// @return the gryo offset
pub fn HAL_GetAnalogGyroOffset ( handle : HAL_GyroHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the calibrated gyro center.
///
/// Can be used to not repeat a calibration but reconstruct the gyro object.
///
/// @param handle the gyro handle
/// @return the gyro center
pub fn HAL_GetAnalogGyroCenter ( handle : HAL_GyroHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Initializes the analog input port using the given port object.
///
/// @param portHandle Handle to the port to initialize.
/// @return the created analog input handle
pub fn HAL_InitializeAnalogInputPort ( portHandle : HAL_PortHandle , status : * mut i32 ) -> HAL_AnalogInputHandle ; } extern "C" {
/// Frees an analog input port.
///
/// @param analogPortHandle Handle to the analog port.
pub fn HAL_FreeAnalogInputPort ( analogPortHandle : HAL_AnalogInputHandle ) ; } extern "C" {
/// Checks that the analog module number is valid.
///
/// @param module The analog module number.
/// @return Analog module is valid and present
pub fn HAL_CheckAnalogModule ( module : i32 ) -> HAL_Bool ; } extern "C" {
/// Checks that the analog output channel number is value.
/// Verifies that the analog channel number is one of the legal channel numbers.
/// Channel numbers are 0-based.
///
/// @param channel The analog output channel number.
/// @return Analog channel is valid
pub fn HAL_CheckAnalogInputChannel ( channel : i32 ) -> HAL_Bool ; } extern "C" {
/// Sets the sample rate.
///
/// This is a global setting for the Athena and effects all channels.
///
/// @param samplesPerSecond The number of samples per channel per second.
pub fn HAL_SetAnalogSampleRate ( samplesPerSecond : f64 , status : * mut i32 ) ; } extern "C" {
/// Gets the current sample rate.
///
/// This assumes one entry in the scan list.
/// This is a global setting for the Athena and effects all channels.
///
/// @return Sample rate.
pub fn HAL_GetAnalogSampleRate ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Sets the number of averaging bits.
///
/// This sets the number of averaging bits. The actual number of averaged samples
/// is 2**bits. Use averaging to improve the stability of your measurement at the
/// expense of sampling rate. The averaging is done automatically in the FPGA.
///
/// @param analogPortHandle Handle to the analog port to configure.
/// @param bits Number of bits to average.
pub fn HAL_SetAnalogAverageBits ( analogPortHandle : HAL_AnalogInputHandle , bits : i32 , status : * mut i32 ) ; } extern "C" {
/// Gets the number of averaging bits.
///
/// This gets the number of averaging bits from the FPGA. The actual number of
/// averaged samples is 2**bits. The averaging is done automatically in the FPGA.
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return Bits to average.
pub fn HAL_GetAnalogAverageBits ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Sets the number of oversample bits.
///
/// This sets the number of oversample bits. The actual number of oversampled
/// values is 2**bits. Use oversampling to improve the resolution of your
/// measurements at the expense of sampling rate. The oversampling is done
/// automatically in the FPGA.
///
/// @param analogPortHandle Handle to the analog port to use.
/// @param bits Number of bits to oversample.
pub fn HAL_SetAnalogOversampleBits ( analogPortHandle : HAL_AnalogInputHandle , bits : i32 , status : * mut i32 ) ; } extern "C" {
/// Gets the number of oversample bits.
///
/// This gets the number of oversample bits from the FPGA. The actual number of
/// oversampled values is 2**bits. The oversampling is done automatically in the
/// FPGA.
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return Bits to oversample.
pub fn HAL_GetAnalogOversampleBits ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets a sample straight from the channel on this module.
///
/// The sample is a 12-bit value representing the 0V to 5V range of the A/D
/// converter in the module. The units are in A/D converter codes. Use
/// GetVoltage() to get the analog value in calibrated units.
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return A sample straight from the channel on this module.
pub fn HAL_GetAnalogValue ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets a sample from the output of the oversample and average engine for the
/// channel.
///
/// The sample is 12-bit + the value configured in SetOversampleBits().
/// The value configured in SetAverageBits() will cause this value to be averaged
/// 2**bits number of samples. This is not a sliding window. The sample will not
/// change until 2**(OversamplBits + AverageBits) samples have been acquired from
/// the module on this channel. Use GetAverageVoltage() to get the analog value
/// in calibrated units.
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return A sample from the oversample and average engine for the channel.
pub fn HAL_GetAnalogAverageValue ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Converts a voltage to a raw value for a specified channel.
///
/// This process depends on the calibration of each channel, so the channel must
/// be specified.
///
/// @todo This assumes raw values. Oversampling not supported as is.
///
/// @param analogPortHandle Handle to the analog port to use.
/// @param voltage The voltage to convert.
/// @return The raw value for the channel.
pub fn HAL_GetAnalogVoltsToValue ( analogPortHandle : HAL_AnalogInputHandle , voltage : f64 , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets a scaled sample straight from the channel on this module.
///
/// The value is scaled to units of Volts using the calibrated scaling data from
/// GetLSBWeight() and GetOffset().
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return A scaled sample straight from the channel on this module.
pub fn HAL_GetAnalogVoltage ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets a scaled sample from the output of the oversample and average engine for
/// the channel.
///
/// The value is scaled to units of Volts using the calibrated scaling data from
/// GetLSBWeight() and GetOffset(). Using oversampling will cause this value to
/// be higher resolution, but it will update more slowly. Using averaging will
/// cause this value to be more stable, but it will update more slowly.
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return A scaled sample from the output of the oversample and average engine
/// for the channel.
pub fn HAL_GetAnalogAverageVoltage ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the factory scaling least significant bit weight constant.
/// The least significant bit weight constant for the channel that was calibrated
/// in manufacturing and stored in an eeprom in the module.
///
/// Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return Least significant bit weight.
pub fn HAL_GetAnalogLSBWeight ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the factory scaling offset constant.
/// The offset constant for the channel that was calibrated in manufacturing and
/// stored in an eeprom in the module.
///
/// Volts = ((LSB_Weight * 1e-9) * raw) - (Offset * 1e-9)
///
/// @param analogPortHandle Handle to the analog port to use.
/// @return Offset constant.
pub fn HAL_GetAnalogOffset ( analogPortHandle : HAL_AnalogInputHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Initializes the analog output port using the given port object.
///
/// @param handle handle to the port
/// @return the created analog output handle
pub fn HAL_InitializeAnalogOutputPort ( portHandle : HAL_PortHandle , status : * mut i32 ) -> HAL_AnalogOutputHandle ; } extern "C" {
/// Frees an analog output port.
///
/// @param analogOutputHandle the analog output handle
pub fn HAL_FreeAnalogOutputPort ( analogOutputHandle : HAL_AnalogOutputHandle ) ; } extern "C" {
/// Sets an analog output value.
///
/// @param analogOutputHandle the analog output handle
/// @param voltage the voltage (0-5v) to output
pub fn HAL_SetAnalogOutput ( analogOutputHandle : HAL_AnalogOutputHandle , voltage : f64 , status : * mut i32 ) ; } extern "C" {
/// Gets the current analog output value.
///
/// @param analogOutputHandle the analog output handle
/// @return the current output voltage (0-5v)
pub fn HAL_GetAnalogOutput ( analogOutputHandle : HAL_AnalogOutputHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Checks that the analog output channel number is value.
///
/// Verifies that the analog channel number is one of the legal channel numbers.
/// Channel numbers are 0-based.
///
/// @return Analog channel is valid
pub fn HAL_CheckAnalogOutputChannel ( channel : i32 ) -> HAL_Bool ; } pub mod HAL_AnalogTriggerType {
/// The type of analog trigger to trigger on.
pub type Type = i32 ; pub const HAL_Trigger_kInWindow : Type = 0 ; pub const HAL_Trigger_kState : Type = 1 ; pub const HAL_Trigger_kRisingPulse : Type = 2 ; pub const HAL_Trigger_kFallingPulse : Type = 3 ; } extern "C" {
/// Initializes an analog trigger.
///
/// @param portHandle the analog input to use for triggering
/// @param index the trigger index value (output)
/// @return the created analog trigger handle
pub fn HAL_InitializeAnalogTrigger ( portHandle : HAL_AnalogInputHandle , index : * mut i32 , status : * mut i32 ) -> HAL_AnalogTriggerHandle ; } extern "C" {
/// Frees an analog trigger.
///
/// @param analogTriggerHandle the trigger handle
pub fn HAL_CleanAnalogTrigger ( analogTriggerHandle : HAL_AnalogTriggerHandle , status : * mut i32 ) ; } extern "C" {
/// Sets the raw ADC upper and lower limits of the analog trigger.
///
/// HAL_SetAnalogTriggerLimitsVoltage is likely better in most cases.
///
/// @param analogTriggerHandle the trigger handle
/// @param lower the lower ADC value
/// @param upper the upper ADC value
pub fn HAL_SetAnalogTriggerLimitsRaw ( analogTriggerHandle : HAL_AnalogTriggerHandle , lower : i32 , upper : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the upper and lower limits of the analog trigger.
///
/// The limits are given as floating point voltage values.
///
/// @param analogTriggerHandle the trigger handle
/// @param lower the lower voltage value
/// @param upper the upper voltage value
pub fn HAL_SetAnalogTriggerLimitsVoltage ( analogTriggerHandle : HAL_AnalogTriggerHandle , lower : f64 , upper : f64 , status : * mut i32 ) ; } extern "C" {
/// Configures the analog trigger to use the averaged vs. raw values.
///
/// If the value is true, then the averaged value is selected for the analog
/// trigger, otherwise the immediate value is used.
///
/// @param analogTriggerHandle the trigger handle
/// @param useAveragedValue true to use averaged values, false for raw
pub fn HAL_SetAnalogTriggerAveraged ( analogTriggerHandle : HAL_AnalogTriggerHandle , useAveragedValue : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Configures the analog trigger to use a filtered value.
///
/// The analog trigger will operate with a 3 point average rejection filter. This
/// is designed to help with 360 degree pot applications for the period where the
/// pot crosses through zero.
///
/// @param analogTriggerHandle the trigger handle
/// @param useFilteredValue true to use filtered values, false for average or
/// raw
pub fn HAL_SetAnalogTriggerFiltered ( analogTriggerHandle : HAL_AnalogTriggerHandle , useFilteredValue : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Returns the InWindow output of the analog trigger.
///
/// True if the analog input is between the upper and lower limits.
///
/// @param analogTriggerHandle the trigger handle
/// @return the InWindow output of the analog trigger
pub fn HAL_GetAnalogTriggerInWindow ( analogTriggerHandle : HAL_AnalogTriggerHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Returns the TriggerState output of the analog trigger.
///
/// True if above upper limit.
/// False if below lower limit.
/// If in Hysteresis, maintain previous state.
///
/// @param analogTriggerHandle the trigger handle
/// @return the TriggerState output of the analog trigger
pub fn HAL_GetAnalogTriggerTriggerState ( analogTriggerHandle : HAL_AnalogTriggerHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the state of the analog trigger output.
///
/// @param analogTriggerHandle the trigger handle
/// @param type the type of trigger to trigger on
/// @return the state of the analog trigger output
pub fn HAL_GetAnalogTriggerOutput ( analogTriggerHandle : HAL_AnalogTriggerHandle , type_ : HAL_AnalogTriggerType::Type , status : * mut i32 ) -> HAL_Bool ; }
/// Storage for CAN Stream Messages.
# [ repr ( C ) ] # [ derive ( Debug , Default , Copy , Clone ) ] pub struct HAL_CANStreamMessage { pub messageID : u32 , pub timeStamp : u32 , pub data : [ u8 ; 8usize ] , pub dataSize : u8 , } # [ test ] fn bindgen_test_layout_HAL_CANStreamMessage ( ) { assert_eq ! ( :: std :: mem :: size_of :: < HAL_CANStreamMessage > ( ) , 20usize , concat ! ( "Size of: " , stringify ! ( HAL_CANStreamMessage ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < HAL_CANStreamMessage > ( ) , 4usize , concat ! ( "Alignment of " , stringify ! ( HAL_CANStreamMessage ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_CANStreamMessage > ( ) ) ) . messageID as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( HAL_CANStreamMessage ) , "::" , stringify ! ( messageID ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_CANStreamMessage > ( ) ) ) . timeStamp as * const _ as usize } , 4usize , concat ! ( "Offset of field: " , stringify ! ( HAL_CANStreamMessage ) , "::" , stringify ! ( timeStamp ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_CANStreamMessage > ( ) ) ) . data as * const _ as usize } , 8usize , concat ! ( "Offset of field: " , stringify ! ( HAL_CANStreamMessage ) , "::" , stringify ! ( data ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_CANStreamMessage > ( ) ) ) . dataSize as * const _ as usize } , 16usize , concat ! ( "Offset of field: " , stringify ! ( HAL_CANStreamMessage ) , "::" , stringify ! ( dataSize ) ) ) ; } extern "C" {
/// Initializes a compressor on the given PCM module.
///
/// @param module the module number
/// @return the created handle
pub fn HAL_InitializeCompressor ( module : i32 , status : * mut i32 ) -> HAL_CompressorHandle ; } extern "C" {
/// Gets if a compressor module is valid.
///
/// @param module the module number
/// @return true if the module is valid, otherwise false
pub fn HAL_CheckCompressorModule ( module : i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the compressor state (on or off).
///
/// @param compressorHandle the compressor handle
/// @return true if the compressor is on, otherwise false
pub fn HAL_GetCompressor ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Sets the compressor to closed loop mode.
///
/// @param compressorHandle the compressor handle
/// @param value true for closed loop mode, false for off
pub fn HAL_SetCompressorClosedLoopControl ( compressorHandle : HAL_CompressorHandle , value : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Gets if the compressor is in closed loop mode.
///
/// @param compressorHandle the compressor handle
/// @return true if the compressor is in closed loop mode,
/// otherwise false
pub fn HAL_GetCompressorClosedLoopControl ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the compressor pressure switch state.
///
/// @param compressorHandle the compressor handle
/// @return true if the pressure switch is triggered, otherwise
/// false
pub fn HAL_GetCompressorPressureSwitch ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the compressor current.
///
/// @param compressorHandle the compressor handle
/// @return the compressor current in amps
pub fn HAL_GetCompressorCurrent ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets if the compressor is faulted because of too high of current.
///
/// @param compressorHandle the compressor handle
/// @return true if falted, otherwise false
pub fn HAL_GetCompressorCurrentTooHighFault ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if a sticky fauly is triggered because of too high of current.
///
/// @param compressorHandle the compressor handle
/// @return true if falted, otherwise false
pub fn HAL_GetCompressorCurrentTooHighStickyFault ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if a sticky fauly is triggered because of a short.
///
/// @param compressorHandle the compressor handle
/// @return true if falted, otherwise false
pub fn HAL_GetCompressorShortedStickyFault ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if the compressor is faulted because of a short.
///
/// @param compressorHandle the compressor handle
/// @return true if shorted, otherwise false
pub fn HAL_GetCompressorShortedFault ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if a sticky fault is triggered of the compressor not connected.
///
/// @param compressorHandle the compressor handle
/// @return true if falted, otherwise false
pub fn HAL_GetCompressorNotConnectedStickyFault ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if the compressor is not connected.
///
/// @param compressorHandle the compressor handle
/// @return true if not connected, otherwise false
pub fn HAL_GetCompressorNotConnectedFault ( compressorHandle : HAL_CompressorHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the number of FPGA system clock ticks per microsecond.
///
/// @return the number of clock ticks per microsecond
pub fn HAL_GetSystemClockTicksPerMicrosecond ( ) -> i32 ; } pub mod HAL_Counter_Mode {
/// The counter mode.
pub type Type = i32 ; pub const HAL_Counter_kTwoPulse : Type = 0 ; pub const HAL_Counter_kSemiperiod : Type = 1 ; pub const HAL_Counter_kPulseLength : Type = 2 ; pub const HAL_Counter_kExternalDirection : Type = 3 ; } extern "C" {
/// Initializes a counter.
///
/// @param mode the counter mode
/// @param index the compressor index (output)
/// @return the created handle
pub fn HAL_InitializeCounter ( mode : HAL_Counter_Mode::Type , index : * mut i32 , status : * mut i32 ) -> HAL_CounterHandle ; } extern "C" {
/// Frees a counter.
///
/// @param counterHandle the counter handle
pub fn HAL_FreeCounter ( counterHandle : HAL_CounterHandle , status : * mut i32 ) ; } extern "C" {
/// Sets the average sample size of a counter.
///
/// @param counterHandle the counter handle
/// @param size the size of samples to average
pub fn HAL_SetCounterAverageSize ( counterHandle : HAL_CounterHandle , size : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the source object that causes the counter to count up.
///
/// @param counterHandle the counter handle
/// @param digitalSourceHandle the digital source handle (either a
/// HAL_AnalogTriggerHandle of a HAL_DigitalHandle)
/// @param analogTriggerType the analog trigger type if the source is an analog
/// trigger
pub fn HAL_SetCounterUpSource ( counterHandle : HAL_CounterHandle , digitalSourceHandle : HAL_Handle , analogTriggerType : HAL_AnalogTriggerType::Type , status : * mut i32 ) ; } extern "C" {
/// Sets the up source to either detect rising edges or falling edges.
///
/// Note that both are allowed to be set true at the same time without issues.
///
/// @param counterHandle the counter handle
/// @param risingEdge true to trigger on rising
/// @param fallingEdge true to trigger on falling
pub fn HAL_SetCounterUpSourceEdge ( counterHandle : HAL_CounterHandle , risingEdge : HAL_Bool , fallingEdge : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Disables the up counting source to the counter.
///
/// @param counterHandle the counter handle
pub fn HAL_ClearCounterUpSource ( counterHandle : HAL_CounterHandle , status : * mut i32 ) ; } extern "C" {
/// Sets the source object that causes the counter to count down.
///
/// @param counterHandle the counter handle
/// @param digitalSourceHandle the digital source handle (either a
/// HAL_AnalogTriggerHandle of a HAL_DigitalHandle)
/// @param analogTriggerType the analog trigger type if the source is an analog
/// trigger
pub fn HAL_SetCounterDownSource ( counterHandle : HAL_CounterHandle , digitalSourceHandle : HAL_Handle , analogTriggerType : HAL_AnalogTriggerType::Type , status : * mut i32 ) ; } extern "C" {
/// Sets the down source to either detect rising edges or falling edges.
/// Note that both are allowed to be set true at the same time without issues.
///
/// @param counterHandle the counter handle
/// @param risingEdge true to trigger on rising
/// @param fallingEdge true to trigger on falling
pub fn HAL_SetCounterDownSourceEdge ( counterHandle : HAL_CounterHandle , risingEdge : HAL_Bool , fallingEdge : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Disables the down counting source to the counter.
///
/// @param counterHandle the counter handle
pub fn HAL_ClearCounterDownSource ( counterHandle : HAL_CounterHandle , status : * mut i32 ) ; } extern "C" {
/// Sets standard up / down counting mode on this counter.
///
/// Up and down counts are sourced independently from two inputs.
///
/// @param counterHandle the counter handle
pub fn HAL_SetCounterUpDownMode ( counterHandle : HAL_CounterHandle , status : * mut i32 ) ; } extern "C" {
/// Sets directional counting mode on this counter.
///
/// The direction is determined by the B input, with counting happening with the
/// A input.
///
/// @param counterHandle the counter handle
pub fn HAL_SetCounterExternalDirectionMode ( counterHandle : HAL_CounterHandle , status : * mut i32 ) ; } extern "C" {
/// Sets Semi-period mode on this counter.
///
/// The counter counts up based on the time the input is triggered. High or Low
/// depends on the highSemiPeriod parameter.
///
/// @param counterHandle the counter handle
/// @param highSemiPeriod true for counting when the input is high, false for low
pub fn HAL_SetCounterSemiPeriodMode ( counterHandle : HAL_CounterHandle , highSemiPeriod : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Configures the counter to count in up or down based on the length of the
/// input pulse.
///
/// This mode is most useful for direction sensitive gear tooth sensors.
///
/// @param counterHandle the counter handle
/// @param threshold The pulse length beyond which the counter counts the
/// opposite direction (seconds)
pub fn HAL_SetCounterPulseLengthMode ( counterHandle : HAL_CounterHandle , threshold : f64 , status : * mut i32 ) ; } extern "C" {
/// Gets the Samples to Average which specifies the number of samples of the
/// timer to average when calculating the period. Perform averaging to account
/// for mechanical imperfections or as oversampling to increase resolution.
///
/// @param counterHandle the counter handle
/// @return SamplesToAverage The number of samples being averaged (from 1 to 127)
pub fn HAL_GetCounterSamplesToAverage ( counterHandle : HAL_CounterHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Sets the Samples to Average which specifies the number of samples of the
/// timer to average when calculating the period. Perform averaging to account
/// for mechanical imperfections or as oversampling to increase resolution.
///
/// @param counterHandle the counter handle
/// @param samplesToAverage The number of samples to average from 1 to 127
pub fn HAL_SetCounterSamplesToAverage ( counterHandle : HAL_CounterHandle , samplesToAverage : i32 , status : * mut i32 ) ; } extern "C" {
/// Resets the Counter to zero.
///
/// Sets the counter value to zero. This does not effect the running state of the
/// counter, just sets the current value to zero.
///
/// @param counterHandle the counter handle
pub fn HAL_ResetCounter ( counterHandle : HAL_CounterHandle , status : * mut i32 ) ; } extern "C" {
/// Reads the current counter value.
///
/// Reads the value at this instant. It may still be running, so it reflects the
/// current value. Next time it is read, it might have a different value.
///
/// @param counterHandle the counter handle
/// @return the current counter value
pub fn HAL_GetCounter ( counterHandle : HAL_CounterHandle , status : * mut i32 ) -> i32 ; } extern "C" { pub fn HAL_GetCounterPeriod ( counterHandle : HAL_CounterHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Sets the maximum period where the device is still considered "moving".
///
/// Sets the maximum period where the device is considered moving. This value is
/// used to determine the "stopped" state of the counter using the
/// HAL_GetCounterStopped method.
///
/// @param counterHandle the counter handle
/// @param maxPeriod the maximum period where the counted device is
/// considered moving in seconds
pub fn HAL_SetCounterMaxPeriod ( counterHandle : HAL_CounterHandle , maxPeriod : f64 , status : * mut i32 ) ; } extern "C" {
/// Selects whether you want to continue updating the event timer output when
/// there are no samples captured.
///
/// The output of the event timer has a buffer of periods that are averaged and
/// posted to a register on the FPGA. When the timer detects that the event
/// source has stopped (based on the MaxPeriod) the buffer of samples to be
/// averaged is emptied.
///
/// If you enable the update when empty, you will be
/// notified of the stopped source and the event time will report 0 samples.
///
/// If you disable update when empty, the most recent average will remain on the
/// output until a new sample is acquired.
///
/// You will never see 0 samples output (except when there have been no events
/// since an FPGA reset) and you will likely not see the stopped bit become true
/// (since it is updated at the end of an average and there are no samples to
/// average).
///
/// @param counterHandle the counter handle
/// @param enabled true to enable counter updating with no samples
pub fn HAL_SetCounterUpdateWhenEmpty ( counterHandle : HAL_CounterHandle , enabled : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Determines if the clock is stopped.
///
/// Determine if the clocked input is stopped based on the MaxPeriod value set
/// using the SetMaxPeriod method. If the clock exceeds the MaxPeriod, then the
/// device (and counter) are assumed to be stopped and it returns true.
///
/// @param counterHandle the counter handle
/// @return true if the most recent counter period exceeds the
/// MaxPeriod value set by SetMaxPeriod
pub fn HAL_GetCounterStopped ( counterHandle : HAL_CounterHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the last direction the counter value changed.
///
/// @param counterHandle the counter handle
/// @return the last direction the counter value changed
pub fn HAL_GetCounterDirection ( counterHandle : HAL_CounterHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Sets the Counter to return reversed sensing on the direction.
///
/// This allows counters to change the direction they are counting in the case of
/// 1X and 2X quadrature encoding only. Any other counter mode isn't supported.
///
/// @param counterHandle the counter handle
/// @param reverseDirection true if the value counted should be negated.
pub fn HAL_SetCounterReverseDirection ( counterHandle : HAL_CounterHandle , reverseDirection : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Creates a new instance of a digital port.
///
/// @param portHandle the port handle to create from
/// @param input true for input, false for output
/// @return the created digital handle
pub fn HAL_InitializeDIOPort ( portHandle : HAL_PortHandle , input : HAL_Bool , status : * mut i32 ) -> HAL_DigitalHandle ; } extern "C" {
/// Checks if a DIO channel is valid.
///
/// @param channel the channel number to check
/// @return true if the channel is correct, otherwise false
pub fn HAL_CheckDIOChannel ( channel : i32 ) -> HAL_Bool ; } extern "C" { pub fn HAL_FreeDIOPort ( dioPortHandle : HAL_DigitalHandle ) ; } extern "C" {
/// Allocates a DO PWM Generator.
///
/// @return the allocated digital PWM handle
pub fn HAL_AllocateDigitalPWM ( status : * mut i32 ) -> HAL_DigitalPWMHandle ; } extern "C" {
/// Frees the resource associated with a DO PWM generator.
///
/// @param pwmGenerator the digital PWM handle
pub fn HAL_FreeDigitalPWM ( pwmGenerator : HAL_DigitalPWMHandle , status : * mut i32 ) ; } extern "C" {
/// Changes the frequency of the DO PWM generator.
///
/// The valid range is from 0.6 Hz to 19 kHz.
///
/// The frequency resolution is logarithmic.
///
/// @param rate the frequency to output all digital output PWM signals
pub fn HAL_SetDigitalPWMRate ( rate : f64 , status : * mut i32 ) ; } extern "C" {
/// Configures the duty-cycle of the PWM generator.
///
/// @param pwmGenerator the digital PWM handle
/// @param dutyCycle the percent duty cycle to output [0..1]
pub fn HAL_SetDigitalPWMDutyCycle ( pwmGenerator : HAL_DigitalPWMHandle , dutyCycle : f64 , status : * mut i32 ) ; } extern "C" {
/// Configures which DO channel the PWM signal is output on.
///
/// @param pwmGenerator the digital PWM handle
/// @param channel the channel to output on
pub fn HAL_SetDigitalPWMOutputChannel ( pwmGenerator : HAL_DigitalPWMHandle , channel : i32 , status : * mut i32 ) ; } extern "C" {
/// Writes a digital value to a DIO channel.
///
/// @param dioPortHandle the digital port handle
/// @param value the state to set the digital channel (if it is
/// configured as an output)
pub fn HAL_SetDIO ( dioPortHandle : HAL_DigitalHandle , value : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Sets the direction of a DIO channel.
///
/// @param dioPortHandle the digital port handle
/// @param input true to set input, false for output
pub fn HAL_SetDIODirection ( dioPortHandle : HAL_DigitalHandle , input : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Reads a digital value from a DIO channel.
///
/// @param dioPortHandle the digital port handle
/// @return the state of the specified channel
pub fn HAL_GetDIO ( dioPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Reads the direction of a DIO channel.
///
/// @param dioPortHandle the digital port handle
/// @return true for input, false for output
pub fn HAL_GetDIODirection ( dioPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Generates a single digital pulse.
///
/// Write a pulse to the specified digital output channel. There can only be a
/// single pulse going at any time.
///
/// @param dioPortHandle the digital port handle
/// @param pulseLength the active length of the pulse (in seconds)
pub fn HAL_Pulse ( dioPortHandle : HAL_DigitalHandle , pulseLength : f64 , status : * mut i32 ) ; } extern "C" {
/// Checks a DIO line to see if it is currently generating a pulse.
///
/// @return true if a pulse is in progress, otherwise false
pub fn HAL_IsPulsing ( dioPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Checks if any DIO line is currently generating a pulse.
///
/// @return true if a pulse on some line is in progress
pub fn HAL_IsAnyPulsing ( status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Writes the filter index from the FPGA.
///
/// Set the filter index used to filter out short pulses.
///
/// @param dioPortHandle the digital port handle
/// @param filterIndex the filter index (Must be in the range 0 - 3, where 0
/// means "none" and 1 - 3 means filter # filterIndex - 1)
pub fn HAL_SetFilterSelect ( dioPortHandle : HAL_DigitalHandle , filterIndex : i32 , status : * mut i32 ) ; } extern "C" {
/// Reads the filter index from the FPGA.
///
/// Gets the filter index used to filter out short pulses.
///
/// @param dioPortHandle the digital port handle
/// @return filterIndex the filter index (Must be in the range 0 - 3,
/// where 0 means "none" and 1 - 3 means filter # filterIndex - 1)
pub fn HAL_GetFilterSelect ( dioPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Sets the filter period for the specified filter index.
///
/// Sets the filter period in FPGA cycles. Even though there are 2 different
/// filter index domains (MXP vs HDR), ignore that distinction for now since it
/// compilicates the interface. That can be changed later.
///
/// @param filterIndex the filter index, 0 - 2
/// @param value the number of cycles that the signal must not transition
/// to be counted as a transition.
pub fn HAL_SetFilterPeriod ( filterIndex : i32 , value : i64 , status : * mut i32 ) ; } extern "C" {
/// Gets the filter period for the specified filter index.
///
/// Gets the filter period in FPGA cycles. Even though there are 2 different
/// filter index domains (MXP vs HDR), ignore that distinction for now since it
/// compilicates the interface. Set status to NiFpga_Status_SoftwareFault if the
/// filter values miss-match.
///
/// @param filterIndex the filter index, 0 - 2
/// @param value the number of cycles that the signal must not transition
/// to be counted as a transition.
pub fn HAL_GetFilterPeriod ( filterIndex : i32 , status : * mut i32 ) -> i64 ; } # [ repr ( C ) ] # [ derive ( Debug , Default , Copy , Clone ) ] pub struct HAL_ControlWord { pub _bitfield_1 : __BindgenBitfieldUnit < [ u8 ; 4usize ] , u32 > , pub __bindgen_align : [ u32 ; 0usize ] , } # [ test ] fn bindgen_test_layout_HAL_ControlWord ( ) { assert_eq ! ( :: std :: mem :: size_of :: < HAL_ControlWord > ( ) , 4usize , concat ! ( "Size of: " , stringify ! ( HAL_ControlWord ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < HAL_ControlWord > ( ) , 4usize , concat ! ( "Alignment of " , stringify ! ( HAL_ControlWord ) ) ) ; } impl HAL_ControlWord { # [ inline ] pub fn enabled ( & self ) -> u32 { unsafe { :: std :: mem :: transmute ( self . _bitfield_1 . get ( 0usize , 1u8 ) as u32 ) } } # [ inline ] pub fn set_enabled ( & mut self , val : u32 ) { unsafe { let val : u32 = :: std :: mem :: transmute ( val ) ; self . _bitfield_1 . set ( 0usize , 1u8 , val as u64 ) } } # [ inline ] pub fn autonomous ( & self ) -> u32 { unsafe { :: std :: mem :: transmute ( self . _bitfield_1 . get ( 1usize , 1u8 ) as u32 ) } } # [ inline ] pub fn set_autonomous ( & mut self , val : u32 ) { unsafe { let val : u32 = :: std :: mem :: transmute ( val ) ; self . _bitfield_1 . set ( 1usize , 1u8 , val as u64 ) } } # [ inline ] pub fn test ( & self ) -> u32 { unsafe { :: std :: mem :: transmute ( self . _bitfield_1 . get ( 2usize , 1u8 ) as u32 ) } } # [ inline ] pub fn set_test ( & mut self , val : u32 ) { unsafe { let val : u32 = :: std :: mem :: transmute ( val ) ; self . _bitfield_1 . set ( 2usize , 1u8 , val as u64 ) } } # [ inline ] pub fn eStop ( & self ) -> u32 { unsafe { :: std :: mem :: transmute ( self . _bitfield_1 . get ( 3usize , 1u8 ) as u32 ) } } # [ inline ] pub fn set_eStop ( & mut self , val : u32 ) { unsafe { let val : u32 = :: std :: mem :: transmute ( val ) ; self . _bitfield_1 . set ( 3usize , 1u8 , val as u64 ) } } # [ inline ] pub fn fmsAttached ( & self ) -> u32 { unsafe { :: std :: mem :: transmute ( self . _bitfield_1 . get ( 4usize , 1u8 ) as u32 ) } } # [ inline ] pub fn set_fmsAttached ( & mut self , val : u32 ) { unsafe { let val : u32 = :: std :: mem :: transmute ( val ) ; self . _bitfield_1 . set ( 4usize , 1u8 , val as u64 ) } } # [ inline ] pub fn dsAttached ( & self ) -> u32 { unsafe { :: std :: mem :: transmute ( self . _bitfield_1 . get ( 5usize , 1u8 ) as u32 ) } } # [ inline ] pub fn set_dsAttached ( & mut self , val : u32 ) { unsafe { let val : u32 = :: std :: mem :: transmute ( val ) ; self . _bitfield_1 . set ( 5usize , 1u8 , val as u64 ) } } # [ inline ] pub fn control_reserved ( & self ) -> u32 { unsafe { :: std :: mem :: transmute ( self . _bitfield_1 . get ( 6usize , 26u8 ) as u32 ) } } # [ inline ] pub fn set_control_reserved ( & mut self , val : u32 ) { unsafe { let val : u32 = :: std :: mem :: transmute ( val ) ; self . _bitfield_1 . set ( 6usize , 26u8 , val as u64 ) } } # [ inline ] pub fn new_bitfield_1 ( enabled : u32 , autonomous : u32 , test : u32 , eStop : u32 , fmsAttached : u32 , dsAttached : u32 , control_reserved : u32 ) -> __BindgenBitfieldUnit < [ u8 ; 4usize ] , u32 > { let mut __bindgen_bitfield_unit : __BindgenBitfieldUnit < [ u8 ; 4usize ] , u32 > = Default :: default ( ) ; __bindgen_bitfield_unit . set ( 0usize , 1u8 , { let enabled : u32 = unsafe { :: std :: mem :: transmute ( enabled ) } ; enabled as u64 } ) ; __bindgen_bitfield_unit . set ( 1usize , 1u8 , { let autonomous : u32 = unsafe { :: std :: mem :: transmute ( autonomous ) } ; autonomous as u64 } ) ; __bindgen_bitfield_unit . set ( 2usize , 1u8 , { let test : u32 = unsafe { :: std :: mem :: transmute ( test ) } ; test as u64 } ) ; __bindgen_bitfield_unit . set ( 3usize , 1u8 , { let eStop : u32 = unsafe { :: std :: mem :: transmute ( eStop ) } ; eStop as u64 } ) ; __bindgen_bitfield_unit . set ( 4usize , 1u8 , { let fmsAttached : u32 = unsafe { :: std :: mem :: transmute ( fmsAttached ) } ; fmsAttached as u64 } ) ; __bindgen_bitfield_unit . set ( 5usize , 1u8 , { let dsAttached : u32 = unsafe { :: std :: mem :: transmute ( dsAttached ) } ; dsAttached as u64 } ) ; __bindgen_bitfield_unit . set ( 6usize , 26u8 , { let control_reserved : u32 = unsafe { :: std :: mem :: transmute ( control_reserved ) } ; control_reserved as u64 } ) ; __bindgen_bitfield_unit } } pub mod HAL_AllianceStationID { pub type Type = i32 ; pub const HAL_AllianceStationID_kRed1 : Type = 0 ; pub const HAL_AllianceStationID_kRed2 : Type = 1 ; pub const HAL_AllianceStationID_kRed3 : Type = 2 ; pub const HAL_AllianceStationID_kBlue1 : Type = 3 ; pub const HAL_AllianceStationID_kBlue2 : Type = 4 ; pub const HAL_AllianceStationID_kBlue3 : Type = 5 ; } pub mod HAL_MatchType { pub type Type = i32 ; pub const HAL_kMatchType_none : Type = 0 ; pub const HAL_kMatchType_practice : Type = 1 ; pub const HAL_kMatchType_qualification : Type = 2 ; pub const HAL_kMatchType_elimination : Type = 3 ; } # [ repr ( C ) ] # [ derive ( Debug , Default , Copy , Clone ) ] pub struct HAL_JoystickAxes { pub count : i16 , pub axes : [ f32 ; 12usize ] , } # [ test ] fn bindgen_test_layout_HAL_JoystickAxes ( ) { assert_eq ! ( :: std :: mem :: size_of :: < HAL_JoystickAxes > ( ) , 52usize , concat ! ( "Size of: " , stringify ! ( HAL_JoystickAxes ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < HAL_JoystickAxes > ( ) , 4usize , concat ! ( "Alignment of " , stringify ! ( HAL_JoystickAxes ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickAxes > ( ) ) ) . count as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickAxes ) , "::" , stringify ! ( count ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickAxes > ( ) ) ) . axes as * const _ as usize } , 4usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickAxes ) , "::" , stringify ! ( axes ) ) ) ; } # [ repr ( C ) ] # [ derive ( Debug , Default , Copy , Clone ) ] pub struct HAL_JoystickPOVs { pub count : i16 , pub povs : [ i16 ; 12usize ] , } # [ test ] fn bindgen_test_layout_HAL_JoystickPOVs ( ) { assert_eq ! ( :: std :: mem :: size_of :: < HAL_JoystickPOVs > ( ) , 26usize , concat ! ( "Size of: " , stringify ! ( HAL_JoystickPOVs ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < HAL_JoystickPOVs > ( ) , 2usize , concat ! ( "Alignment of " , stringify ! ( HAL_JoystickPOVs ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickPOVs > ( ) ) ) . count as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickPOVs ) , "::" , stringify ! ( count ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickPOVs > ( ) ) ) . povs as * const _ as usize } , 2usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickPOVs ) , "::" , stringify ! ( povs ) ) ) ; } # [ repr ( C ) ] # [ derive ( Debug , Default , Copy , Clone ) ] pub struct HAL_JoystickButtons { pub buttons : u32 , pub count : u8 , } # [ test ] fn bindgen_test_layout_HAL_JoystickButtons ( ) { assert_eq ! ( :: std :: mem :: size_of :: < HAL_JoystickButtons > ( ) , 8usize , concat ! ( "Size of: " , stringify ! ( HAL_JoystickButtons ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < HAL_JoystickButtons > ( ) , 4usize , concat ! ( "Alignment of " , stringify ! ( HAL_JoystickButtons ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickButtons > ( ) ) ) . buttons as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickButtons ) , "::" , stringify ! ( buttons ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickButtons > ( ) ) ) . count as * const _ as usize } , 4usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickButtons ) , "::" , stringify ! ( count ) ) ) ; } # [ repr ( C ) ] # [ derive ( Copy , Clone ) ] pub struct HAL_JoystickDescriptor { pub isXbox : u8 , pub type_ : u8 , pub name : [ :: std :: os :: raw :: c_char ; 256usize ] , pub axisCount : u8 , pub axisTypes : [ u8 ; 12usize ] , pub buttonCount : u8 , pub povCount : u8 , } # [ test ] fn bindgen_test_layout_HAL_JoystickDescriptor ( ) { assert_eq ! ( :: std :: mem :: size_of :: < HAL_JoystickDescriptor > ( ) , 273usize , concat ! ( "Size of: " , stringify ! ( HAL_JoystickDescriptor ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < HAL_JoystickDescriptor > ( ) , 1usize , concat ! ( "Alignment of " , stringify ! ( HAL_JoystickDescriptor ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickDescriptor > ( ) ) ) . isXbox as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickDescriptor ) , "::" , stringify ! ( isXbox ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickDescriptor > ( ) ) ) . type_ as * const _ as usize } , 1usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickDescriptor ) , "::" , stringify ! ( type_ ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickDescriptor > ( ) ) ) . name as * const _ as usize } , 2usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickDescriptor ) , "::" , stringify ! ( name ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickDescriptor > ( ) ) ) . axisCount as * const _ as usize } , 258usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickDescriptor ) , "::" , stringify ! ( axisCount ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickDescriptor > ( ) ) ) . axisTypes as * const _ as usize } , 259usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickDescriptor ) , "::" , stringify ! ( axisTypes ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickDescriptor > ( ) ) ) . buttonCount as * const _ as usize } , 271usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickDescriptor ) , "::" , stringify ! ( buttonCount ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_JoystickDescriptor > ( ) ) ) . povCount as * const _ as usize } , 272usize , concat ! ( "Offset of field: " , stringify ! ( HAL_JoystickDescriptor ) , "::" , stringify ! ( povCount ) ) ) ; } impl Default for HAL_JoystickDescriptor { fn default ( ) -> Self { unsafe { :: std :: mem :: zeroed ( ) } } } # [ repr ( C ) ] # [ derive ( Copy , Clone ) ] pub struct HAL_MatchInfo { pub eventName : [ :: std :: os :: raw :: c_char ; 64usize ] , pub matchType : HAL_MatchType::Type , pub matchNumber : u16 , pub replayNumber : u8 , pub gameSpecificMessage : [ u8 ; 64usize ] , pub gameSpecificMessageSize : u16 , } # [ test ] fn bindgen_test_layout_HAL_MatchInfo ( ) { assert_eq ! ( :: std :: mem :: size_of :: < HAL_MatchInfo > ( ) , 140usize , concat ! ( "Size of: " , stringify ! ( HAL_MatchInfo ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < HAL_MatchInfo > ( ) , 4usize , concat ! ( "Alignment of " , stringify ! ( HAL_MatchInfo ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_MatchInfo > ( ) ) ) . eventName as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( HAL_MatchInfo ) , "::" , stringify ! ( eventName ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_MatchInfo > ( ) ) ) . matchType as * const _ as usize } , 64usize , concat ! ( "Offset of field: " , stringify ! ( HAL_MatchInfo ) , "::" , stringify ! ( matchType ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_MatchInfo > ( ) ) ) . matchNumber as * const _ as usize } , 68usize , concat ! ( "Offset of field: " , stringify ! ( HAL_MatchInfo ) , "::" , stringify ! ( matchNumber ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_MatchInfo > ( ) ) ) . replayNumber as * const _ as usize } , 70usize , concat ! ( "Offset of field: " , stringify ! ( HAL_MatchInfo ) , "::" , stringify ! ( replayNumber ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_MatchInfo > ( ) ) ) . gameSpecificMessage as * const _ as usize } , 71usize , concat ! ( "Offset of field: " , stringify ! ( HAL_MatchInfo ) , "::" , stringify ! ( gameSpecificMessage ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < HAL_MatchInfo > ( ) ) ) . gameSpecificMessageSize as * const _ as usize } , 136usize , concat ! ( "Offset of field: " , stringify ! ( HAL_MatchInfo ) , "::" , stringify ! ( gameSpecificMessageSize ) ) ) ; } impl Default for HAL_MatchInfo { fn default ( ) -> Self { unsafe { :: std :: mem :: zeroed ( ) } } } extern "C" {
/// Sends an error to the driver station.
///
/// @param isError true for error, false for warning
/// @param errorCode the error code
/// @param isLVCode true for a LV error code, false for a standard error code
/// @param details the details of the error
/// @param location the file location of the errror
/// @param callstack the callstack of the error
/// @param printMsg true to print the error message to stdout as well as to the
/// DS
pub fn HAL_SendError ( isError : HAL_Bool , errorCode : i32 , isLVCode : HAL_Bool , details : * const :: std :: os :: raw :: c_char , location : * const :: std :: os :: raw :: c_char , callStack : * const :: std :: os :: raw :: c_char , printMsg : HAL_Bool ) -> i32 ; } extern "C" {
/// Gets the current control word of the driver station.
///
/// The control work contains the robot state.
///
/// @param controlWord the control word (out)
/// @return the error code, or 0 for success
pub fn HAL_GetControlWord ( controlWord : * mut HAL_ControlWord ) -> i32 ; } extern "C" {
/// Gets the current alliance station ID.
///
/// @param status the error code, or 0 for success
/// @return the alliance station ID
pub fn HAL_GetAllianceStation ( status : * mut i32 ) -> HAL_AllianceStationID::Type ; } extern "C" {
/// Gets the axes of a specific joystick.
///
/// @param joystickNum the joystick number
/// @param axes the axes values (output)
/// @return the error code, or 0 for success
pub fn HAL_GetJoystickAxes ( joystickNum : i32 , axes : * mut HAL_JoystickAxes ) -> i32 ; } extern "C" {
/// Gets the POVs of a specific joystick.
///
/// @param joystickNum the joystick number
/// @param povs the POV values (output)
/// @return the error code, or 0 for success
pub fn HAL_GetJoystickPOVs ( joystickNum : i32 , povs : * mut HAL_JoystickPOVs ) -> i32 ; } extern "C" {
/// Gets the buttons of a specific joystick.
///
/// @param joystickNum the joystick number
/// @param buttons the button values (output)
/// @return the error code, or 0 for success
pub fn HAL_GetJoystickButtons ( joystickNum : i32 , buttons : * mut HAL_JoystickButtons ) -> i32 ; } extern "C" {
/// Retrieves the Joystick Descriptor for particular slot.
///
/// @param desc [out] descriptor (data transfer object) to fill in. desc is
/// filled in regardless of success. In other words, if descriptor is not
/// available, desc is filled in with default values matching the init-values in
/// Java and C++ Driverstation for when caller requests a too-large joystick
/// index.
///
/// @return error code reported from Network Comm back-end. Zero is good,
/// nonzero is bad.
pub fn HAL_GetJoystickDescriptor ( joystickNum : i32 , desc : * mut HAL_JoystickDescriptor ) -> i32 ; } extern "C" {
/// Gets is a specific joystick is considered to be an XBox controller.
///
/// @param joystickNum the joystick number
/// @return true if xbox, false otherwise
pub fn HAL_GetJoystickIsXbox ( joystickNum : i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the type of joystick connected.
///
/// This is device specific, and different depending on what system input type
/// the joystick uses.
///
/// @param joystickNum the joystick number
/// @return the enumerated joystick type
pub fn HAL_GetJoystickType ( joystickNum : i32 ) -> i32 ; } extern "C" {
/// Gets the name of a joystick.
///
/// The returned array must be freed with HAL_FreeJoystickName.
///
/// Will be null terminated.
///
/// @param joystickNum the joystick number
/// @return the joystick name
pub fn HAL_GetJoystickName ( joystickNum : i32 ) -> * mut :: std :: os :: raw :: c_char ; } extern "C" {
/// Frees a joystick name received with HAL_GetJoystickName
///
/// @param name the name storage
pub fn HAL_FreeJoystickName ( name : * mut :: std :: os :: raw :: c_char ) ; } extern "C" {
/// Gets the type of a specific joystick axis.
///
/// This is device specific, and different depending on what system input type
/// the joystick uses.
///
/// @param joystickNum the joystick number
/// @param axis the axis number
/// @return the enumerated axis type
pub fn HAL_GetJoystickAxisType ( joystickNum : i32 , axis : i32 ) -> i32 ; } extern "C" {
/// Set joystick outputs.
///
/// @param joystickNum the joystick numer
/// @param outputs bitmask of outputs, 1 for on 0 for off
/// @param leftRumble the left rumble value (0-FFFF)
/// @param rightRumble the right rumble value (0-FFFF)
/// @return the error code, or 0 for success
pub fn HAL_SetJoystickOutputs ( joystickNum : i32 , outputs : i64 , leftRumble : i32 , rightRumble : i32 ) -> i32 ; } extern "C" {
/// Returns the approximate match time.
///
/// The FMS does not send an official match time to the robots, but does send
/// an approximate match time. The value will count down the time remaining in
/// the current period (auto or teleop).
///
/// Warning: This is not an official time (so it cannot be used to dispute ref
/// calls or guarantee that a function will trigger before the match ends).
///
/// The Practice Match function of the DS approximates the behaviour seen on
/// the field.
///
/// @param status the error code, or 0 for success
/// @return time remaining in current match period (auto or teleop)
pub fn HAL_GetMatchTime ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets info about a specific match.
///
/// @param info the match info (output)
/// @return the error code, or 0 for success
pub fn HAL_GetMatchInfo ( info : * mut HAL_MatchInfo ) -> i32 ; } extern "C" {
/// Releases the DS Mutex to allow proper shutdown of any threads that are
/// waiting on it.
pub fn HAL_ReleaseDSMutex ( ) ; } extern "C" {
/// Has a new control packet from the driver station arrived since the last
/// time this function was called?
///
/// @return true if the control data has been updated since the last call
pub fn HAL_IsNewControlData ( ) -> HAL_Bool ; } extern "C" {
/// Waits for the newest DS packet to arrive. Note that this is a blocking call.
pub fn HAL_WaitForDSData ( ) ; } extern "C" {
/// Waits for the newest DS packet to arrive. If timeout is <= 0, this will wait
/// forever. Otherwise, it will wait until either a new packet, or the timeout
/// time has passed.
///
/// @param timeout timeout in seconds
/// @return true for new data, false for timeout
pub fn HAL_WaitForDSDataTimeout ( timeout : f64 ) -> HAL_Bool ; } extern "C" {
/// Initializes the driver station communication. This will properly
/// handle multiple calls. However note that this CANNOT be called from a library
/// that interfaces with LabVIEW.
pub fn HAL_InitializeDriverStation ( ) ; } extern "C" {
/// Sets the program starting flag in the DS.
///
/// This is what changes the DS to showing robot code ready.
pub fn HAL_ObserveUserProgramStarting ( ) ; } extern "C" {
/// Sets the disabled flag in the DS.
///
/// This is used for the DS to ensure the robot is properly responding to its
/// state request. Ensure this get called about every 50ms, or the robot will be
/// disabled by the DS.
pub fn HAL_ObserveUserProgramDisabled ( ) ; } extern "C" {
/// Sets the autonomous enabled flag in the DS.
///
/// This is used for the DS to ensure the robot is properly responding to its
/// state request. Ensure this get called about every 50ms, or the robot will be
/// disabled by the DS.
pub fn HAL_ObserveUserProgramAutonomous ( ) ; } extern "C" {
/// Sets the teleoperated enabled flag in the DS.
///
/// This is used for the DS to ensure the robot is properly responding to its
/// state request. Ensure this get called about every 50ms, or the robot will be
/// disabled by the DS.
pub fn HAL_ObserveUserProgramTeleop ( ) ; } extern "C" {
/// Sets the test mode flag in the DS.
///
/// This is used for the DS to ensure the robot is properly responding to its
/// state request. Ensure this get called about every 50ms, or the robot will be
/// disabled by the DS.
pub fn HAL_ObserveUserProgramTest ( ) ; } pub mod HAL_I2CPort {
/// @defgroup hal_i2c I2C Functions
/// @ingroup hal_capi
/// @{
pub type Type = i32 ; pub const HAL_I2C_kInvalid : Type = -1 ; pub const HAL_I2C_kOnboard : Type = 0 ; pub const HAL_I2C_kMXP : Type = 1 ; } extern "C" {
/// Initializes the I2C port.
///
/// Opens the port if necessary and saves the handle.
/// If opening the MXP port, also sets up the channel functions appropriately.
///
/// @param port The port to open, 0 for the on-board, 1 for the MXP.
pub fn HAL_InitializeI2C ( port : HAL_I2CPort::Type , status : * mut i32 ) ; } extern "C" {
/// Generic I2C read/write transaction.
///
/// This is a lower-level interface to the I2C hardware giving you more control
/// over each transaction.
///
/// @param port The I2C port, 0 for the on-board, 1 for the MXP.
/// @param dataToSend Buffer of data to send as part of the transaction.
/// @param sendSize Number of bytes to send as part of the transaction.
/// @param dataReceived Buffer to read data into.
/// @param receiveSize Number of bytes to read from the device.
/// @return >= 0 on success or -1 on transfer abort.
pub fn HAL_TransactionI2C ( port : HAL_I2CPort::Type , deviceAddress : i32 , dataToSend : * const u8 , sendSize : i32 , dataReceived : * mut u8 , receiveSize : i32 ) -> i32 ; } extern "C" {
/// Executes a write transaction with the device.
///
/// Writes a single byte to a register on a device and wait until the
/// transaction is complete.
///
/// @param port The I2C port, 0 for the on-board, 1 for the MXP.
/// @param registerAddress The address of the register on the device to be
/// written.
/// @param data The byte to write to the register on the device.
/// @return >= 0 on success or -1 on transfer abort.
pub fn HAL_WriteI2C ( port : HAL_I2CPort::Type , deviceAddress : i32 , dataToSend : * const u8 , sendSize : i32 ) -> i32 ; } extern "C" {
/// Executes a read transaction with the device.
///
/// Reads bytes from a device.
/// Most I2C devices will auto-increment the register pointer internally allowing
/// you to read consecutive registers on a device in a single transaction.
///
/// @param port The I2C port, 0 for the on-board, 1 for the MXP.
/// @param registerAddress The register to read first in the transaction.
/// @param count The number of bytes to read in the transaction.
/// @param buffer A pointer to the array of bytes to store the data read from the
/// device.
/// @return >= 0 on success or -1 on transfer abort.
pub fn HAL_ReadI2C ( port : HAL_I2CPort::Type , deviceAddress : i32 , buffer : * mut u8 , count : i32 ) -> i32 ; } extern "C" {
/// Closes an I2C port
///
/// @param port The I2C port, 0 for the on-board, 1 for the MXP.
pub fn HAL_CloseI2C ( port : HAL_I2CPort::Type ) ; } pub type HAL_InterruptHandlerFunction = :: std :: option :: Option < unsafe extern "C" fn ( interruptAssertedMask : u32 , param : * mut :: std :: os :: raw :: c_void ) > ; extern "C" {
/// Initializes an interrupt.
///
/// @param watcher true for synchronous interrupts, false for asynchronous
/// @return the created interrupt handle
pub fn HAL_InitializeInterrupts ( watcher : HAL_Bool , status : * mut i32 ) -> HAL_InterruptHandle ; } extern "C" {
/// Frees an interrupt.
///
/// @param interruptHandle the interrupt handle
/// @return the param passed to the interrupt, or nullptr if one
/// wasn't passed.
pub fn HAL_CleanInterrupts ( interruptHandle : HAL_InterruptHandle , status : * mut i32 ) -> * mut :: std :: os :: raw :: c_void ; } extern "C" {
/// In synchronous mode, waits for the defined interrupt to occur.
///
/// @param interruptHandle the interrupt handle
/// @param timeout timeout in seconds
/// @param ignorePrevious if true, ignore interrupts that happened before
/// waitForInterrupt was called
/// @return the mask of interrupts that fired
pub fn HAL_WaitForInterrupt ( interruptHandle : HAL_InterruptHandle , timeout : f64 , ignorePrevious : HAL_Bool , status : * mut i32 ) -> i64 ; } extern "C" {
/// Enables interrupts to occur on this input.
///
/// Interrupts are disabled when the RequestInterrupt call is made. This gives
/// time to do the setup of the other options before starting to field
/// interrupts.
///
/// @param interruptHandle the interrupt handle
pub fn HAL_EnableInterrupts ( interruptHandle : HAL_InterruptHandle , status : * mut i32 ) ; } extern "C" {
/// Disables interrupts without without deallocating structures.
///
/// @param interruptHandle the interrupt handle
pub fn HAL_DisableInterrupts ( interruptHandle : HAL_InterruptHandle , status : * mut i32 ) ; } extern "C" {
/// Returns the timestamp for the rising interrupt that occurred most recently.
///
/// This is in the same time domain as HAL_GetFPGATime().
///
/// @param interruptHandle the interrupt handle
/// @return timestamp in seconds since FPGA Initialization
pub fn HAL_ReadInterruptRisingTimestamp ( interruptHandle : HAL_InterruptHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Returns the timestamp for the falling interrupt that occurred most recently.
///
/// This is in the same time domain as HAL_GetFPGATime().
///
/// @param interruptHandle the interrupt handle
/// @return timestamp in seconds since FPGA Initialization
pub fn HAL_ReadInterruptFallingTimestamp ( interruptHandle : HAL_InterruptHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Requests interrupts on a specific digital source.
///
/// @param interruptHandle the interrupt handle
/// @param digitalSourceHandle the digital source handle (either a
/// HAL_AnalogTriggerHandle of a HAL_DigitalHandle)
/// @param analogTriggerType the trigger type if the source is an AnalogTrigger
pub fn HAL_RequestInterrupts ( interruptHandle : HAL_InterruptHandle , digitalSourceHandle : HAL_Handle , analogTriggerType : HAL_AnalogTriggerType::Type , status : * mut i32 ) ; } extern "C" {
/// Attaches an asynchronous interrupt handler to the interrupt.
///
/// This interrupt gets called directly on the FPGA interrupt thread, so will
/// block other interrupts while running.
///
/// @param interruptHandle the interrupt handle
/// @param handler the handler function for the interrupt to call
/// @param param a parameter to be passed to the handler
pub fn HAL_AttachInterruptHandler ( interruptHandle : HAL_InterruptHandle , handler : HAL_InterruptHandlerFunction , param : * mut :: std :: os :: raw :: c_void , status : * mut i32 ) ; } extern "C" {
/// Attaches an asynchronous interrupt handler to the interrupt.
///
/// This interrupt gets called on a thread specific to the interrupt, so will not
/// block other interrupts.
///
/// @param interruptHandle the interrupt handle
/// @param handler the handler function for the interrupt to call
/// @param param a parameter to be passed to the handler
pub fn HAL_AttachInterruptHandlerThreaded ( interruptHandle : HAL_InterruptHandle , handler : HAL_InterruptHandlerFunction , param : * mut :: std :: os :: raw :: c_void , status : * mut i32 ) ; } extern "C" {
/// Sets the edges to trigger the interrupt on.
///
/// Note that both edges triggered is a valid configuration.
///
/// @param interruptHandle the interrupt handle
/// @param risingEdge true for triggering on rising edge
/// @param fallingEdge true for triggering on falling edge
pub fn HAL_SetInterruptUpSourceEdge ( interruptHandle : HAL_InterruptHandle , risingEdge : HAL_Bool , fallingEdge : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Initializes a notifier.
///
/// A notifier is an FPGA controller timer that triggers at requested intervals
/// based on the FPGA time. This can be used to make precise control loops.
///
/// @return the created notifier
pub fn HAL_InitializeNotifier ( status : * mut i32 ) -> HAL_NotifierHandle ; } extern "C" {
/// Stops a notifier from running.
///
/// This will cause any call into HAL_WaitForNotifierAlarm to return.
///
/// @param notifierHandle the notifier handle
pub fn HAL_StopNotifier ( notifierHandle : HAL_NotifierHandle , status : * mut i32 ) ; } extern "C" {
/// Cleans a notifier.
///
/// Note this also stops a notifier if it is already running.
///
/// @param notifierHandle the notifier handle
pub fn HAL_CleanNotifier ( notifierHandle : HAL_NotifierHandle , status : * mut i32 ) ; } extern "C" {
/// Updates the trigger time for a notifier.
///
/// Note that this time is an absolute time relative to HAL_GetFPGATime()
///
/// @param notifierHandle the notifier handle
/// @param triggerTime the updated trigger time
pub fn HAL_UpdateNotifierAlarm ( notifierHandle : HAL_NotifierHandle , triggerTime : u64 , status : * mut i32 ) ; } extern "C" {
/// Cancels the next notifier alarm.
///
/// This does not cause HAL_WaitForNotifierAlarm to return.
///
/// @param notifierHandle the notifier handle
pub fn HAL_CancelNotifierAlarm ( notifierHandle : HAL_NotifierHandle , status : * mut i32 ) ; } extern "C" {
/// Waits for the next alarm for the specific notifier.
///
/// This is a blocking call until either the time elapses or HAL_StopNotifier
/// gets called.
///
/// @param notifierHandle the notifier handle
/// @return the FPGA time the notifier returned
pub fn HAL_WaitForNotifierAlarm ( notifierHandle : HAL_NotifierHandle , status : * mut i32 ) -> u64 ; } extern "C" {
/// Initializes a Power Distribution Panel.
///
/// @param module the module number to initialize
/// @return the created PDP
pub fn HAL_InitializePDP ( module : i32 , status : * mut i32 ) -> HAL_PDPHandle ; } extern "C" {
/// Cleans a PDP module.
///
/// @param handle the module handle
pub fn HAL_CleanPDP ( handle : HAL_PDPHandle ) ; } extern "C" {
/// Checks if a PDP channel is valid.
///
/// @param channel the channel to check
/// @return true if the channel is valid, otherwise false
pub fn HAL_CheckPDPChannel ( channel : i32 ) -> HAL_Bool ; } extern "C" {
/// Checks if a PDP module is valid.
///
/// @param channel the module to check
/// @return true if the module is valid, otherwise false
pub fn HAL_CheckPDPModule ( module : i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the temperature of the PDP.
///
/// @param handle the module handle
/// @return the module temperature (celsius)
pub fn HAL_GetPDPTemperature ( handle : HAL_PDPHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the PDP input voltage.
///
/// @param handle the module handle
/// @return the input voltage (volts)
pub fn HAL_GetPDPVoltage ( handle : HAL_PDPHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the current of a specific PDP channel.
///
/// @param module the module
/// @param channel the channel
/// @return the channel current (amps)
pub fn HAL_GetPDPChannelCurrent ( handle : HAL_PDPHandle , channel : i32 , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the total current of the PDP.
///
/// @param handle the module handle
/// @return the total current (amps)
pub fn HAL_GetPDPTotalCurrent ( handle : HAL_PDPHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the total power of the PDP.
///
/// @param handle the module handle
/// @return the total power (watts)
pub fn HAL_GetPDPTotalPower ( handle : HAL_PDPHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the total energy of the PDP.
///
/// @param handle the module handle
/// @return the total energy (joules)
pub fn HAL_GetPDPTotalEnergy ( handle : HAL_PDPHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Resets the PDP accumulated energy.
///
/// @param handle the module handle
pub fn HAL_ResetPDPTotalEnergy ( handle : HAL_PDPHandle , status : * mut i32 ) ; } extern "C" {
/// Clears any PDP sticky faults.
///
/// @param handle the module handle
pub fn HAL_ClearPDPStickyFaults ( handle : HAL_PDPHandle , status : * mut i32 ) ; } extern "C" {
/// Initializes a PWM port.
///
/// @param portHandle the port to initialize
/// @return the created pwm handle
pub fn HAL_InitializePWMPort ( portHandle : HAL_PortHandle , status : * mut i32 ) -> HAL_DigitalHandle ; } extern "C" {
/// Frees a PWM port.
///
/// @param pwmPortHandle the pwm handle
pub fn HAL_FreePWMPort ( pwmPortHandle : HAL_DigitalHandle , status : * mut i32 ) ; } extern "C" {
/// Checks if a pwm channel is valid.
///
/// @param channel the channel to check
/// @return true if the channel is valid, otherwise false
pub fn HAL_CheckPWMChannel ( channel : i32 ) -> HAL_Bool ; } extern "C" {
/// Sets the configuration settings for the PWM channel.
///
/// All values are in milliseconds.
///
/// @param pwmPortHandle the PWM handle
/// @param maxPwm the maximum PWM value
/// @param deadbandMaxPwm the high range of the center deadband
/// @param centerPwm the center PWM value
/// @param deadbandMinPwm the low range of the center deadband
/// @param minPwm the minimum PWM value
pub fn HAL_SetPWMConfig ( pwmPortHandle : HAL_DigitalHandle , maxPwm : f64 , deadbandMaxPwm : f64 , centerPwm : f64 , deadbandMinPwm : f64 , minPwm : f64 , status : * mut i32 ) ; } extern "C" {
/// Sets the raw configuration settings for the PWM channel.
///
/// We recommend using HAL_SetPWMConfig() instead, as those values are properly
/// scaled. Usually used for values grabbed by HAL_GetPWMConfigRaw().
///
/// Values are in raw FPGA units.
///
/// @param pwmPortHandle the PWM handle
/// @param maxPwm the maximum PWM value
/// @param deadbandMaxPwm the high range of the center deadband
/// @param centerPwm the center PWM value
/// @param deadbandMinPwm the low range of the center deadband
/// @param minPwm the minimum PWM value
pub fn HAL_SetPWMConfigRaw ( pwmPortHandle : HAL_DigitalHandle , maxPwm : i32 , deadbandMaxPwm : i32 , centerPwm : i32 , deadbandMinPwm : i32 , minPwm : i32 , status : * mut i32 ) ; } extern "C" {
/// Gets the raw pwm configuration settings for the PWM channel.
///
/// Values are in raw FPGA units. These units have the potential to change for
/// any FPGA release.
///
/// @param pwmPortHandle the PWM handle
/// @param maxPwm the maximum PWM value
/// @param deadbandMaxPwm the high range of the center deadband
/// @param centerPwm the center PWM value
/// @param deadbandMinPwm the low range of the center deadband
/// @param minPwm the minimum PWM value
pub fn HAL_GetPWMConfigRaw ( pwmPortHandle : HAL_DigitalHandle , maxPwm : * mut i32 , deadbandMaxPwm : * mut i32 , centerPwm : * mut i32 , deadbandMinPwm : * mut i32 , minPwm : * mut i32 , status : * mut i32 ) ; } extern "C" {
/// Sets if the FPGA should output the center value if the input value is within
/// the deadband.
///
/// @param pwmPortHandle the PWM handle
/// @param eliminateDeadband true to eliminate deadband, otherwise false
pub fn HAL_SetPWMEliminateDeadband ( pwmPortHandle : HAL_DigitalHandle , eliminateDeadband : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Gets the current eliminate deadband value.
///
/// @param pwmPortHandle the PWM handle
/// @return true if set, otherwise false
pub fn HAL_GetPWMEliminateDeadband ( pwmPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Sets a PWM channel to the desired value.
///
/// The values are in raw FPGA units, and have the potential to change with any
/// FPGA release.
///
/// @param pwmPortHandle the PWM handle
/// @param value the PWM value to set
pub fn HAL_SetPWMRaw ( pwmPortHandle : HAL_DigitalHandle , value : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets a PWM channel to the desired scaled value.
///
/// The values range from -1 to 1 and the period is controlled by the PWM Period
/// and MinHigh registers.
///
/// @param pwmPortHandle the PWM handle
/// @param value the scaled PWM value to set
pub fn HAL_SetPWMSpeed ( pwmPortHandle : HAL_DigitalHandle , speed : f64 , status : * mut i32 ) ; } extern "C" {
/// Sets a PWM channel to the desired position value.
///
/// The values range from 0 to 1 and the period is controlled by the PWM Period
/// and MinHigh registers.
///
/// @param pwmPortHandle the PWM handle
/// @param value the positional PWM value to set
pub fn HAL_SetPWMPosition ( pwmPortHandle : HAL_DigitalHandle , position : f64 , status : * mut i32 ) ; } extern "C" {
/// Sets a PWM channel to be disabled.
///
/// The channel is disabled until the next time it is set. Note this is different
/// from just setting a 0 speed, as this will actively stop all signalling on the
/// channel.
///
/// @param pwmPortHandle the PWM handle.
pub fn HAL_SetPWMDisabled ( pwmPortHandle : HAL_DigitalHandle , status : * mut i32 ) ; } extern "C" {
/// Gets a value from a PWM channel.
///
/// The values are in raw FPGA units, and have the potential to change with any
/// FPGA release.
///
/// @param pwmPortHandle the PWM handle
/// @return the current raw PWM value
pub fn HAL_GetPWMRaw ( pwmPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets a scaled value from a PWM channel.
///
/// The values range from -1 to 1.
///
/// @param pwmPortHandle the PWM handle
/// @return the current speed PWM value
pub fn HAL_GetPWMSpeed ( pwmPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets a position value from a PWM channel.
///
/// The values range from 0 to 1.
///
/// @param pwmPortHandle the PWM handle
/// @return the current positional PWM value
pub fn HAL_GetPWMPosition ( pwmPortHandle : HAL_DigitalHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Forces a PWM signal to go to 0 temporarily.
///
/// @param pwmPortHandle the PWM handle.
pub fn HAL_LatchPWMZero ( pwmPortHandle : HAL_DigitalHandle , status : * mut i32 ) ; } extern "C" {
/// Sets how how often the PWM signal is squelched, thus scaling the period.
///
/// @param pwmPortHandle the PWM handle.
/// @param squelchMask the 2-bit mask of outputs to squelch
pub fn HAL_SetPWMPeriodScale ( pwmPortHandle : HAL_DigitalHandle , squelchMask : i32 , status : * mut i32 ) ; } extern "C" {
/// Gets the loop timing of the PWM system.
///
/// @return the loop time
pub fn HAL_GetPWMLoopTiming ( status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the pwm starting cycle time.
///
/// This time is relative to the FPGA time.
///
/// @return the pwm cycle start time
pub fn HAL_GetPWMCycleStartTime ( status : * mut i32 ) -> u64 ; } extern "C" {
/// Gets the number of analog accumulators in the current system.
///
/// @return the number of analog accumulators
pub fn HAL_GetNumAccumulators ( ) -> i32 ; } extern "C" {
/// Gets the number of analog triggers in the current system.
///
/// @return the number of analog triggers
pub fn HAL_GetNumAnalogTriggers ( ) -> i32 ; } extern "C" {
/// Gets the number of analog inputs in the current system.
///
/// @return the number of analog inputs
pub fn HAL_GetNumAnalogInputs ( ) -> i32 ; } extern "C" {
/// Gets the number of analog outputs in the current system.
///
/// @return the number of analog outputs
pub fn HAL_GetNumAnalogOutputs ( ) -> i32 ; } extern "C" {
/// Gets the number of analog counters in the current system.
///
/// @return the number of counters
pub fn HAL_GetNumCounters ( ) -> i32 ; } extern "C" {
/// Gets the number of digital headers in the current system.
///
/// @return the number of digital headers
pub fn HAL_GetNumDigitalHeaders ( ) -> i32 ; } extern "C" {
/// Gets the number of PWM headers in the current system.
///
/// @return the number of PWM headers
pub fn HAL_GetNumPWMHeaders ( ) -> i32 ; } extern "C" {
/// Gets the number of digital channels in the current system.
///
/// @return the number of digital channels
pub fn HAL_GetNumDigitalChannels ( ) -> i32 ; } extern "C" {
/// Gets the number of PWM channels in the current system.
///
/// @return the number of PWM channels
pub fn HAL_GetNumPWMChannels ( ) -> i32 ; } extern "C" {
/// Gets the number of digital IO PWM outputs in the current system.
///
/// @return the number of digital IO PWM outputs
pub fn HAL_GetNumDigitalPWMOutputs ( ) -> i32 ; } extern "C" {
/// Gets the number of quadrature encoders in the current system.
///
/// @return the number of quadrature encoders
pub fn HAL_GetNumEncoders ( ) -> i32 ; } extern "C" {
/// Gets the number of interrupts in the current system.
///
/// @return the number of interrupts
pub fn HAL_GetNumInterrupts ( ) -> i32 ; } extern "C" {
/// Gets the number of relay channels in the current system.
///
/// @return the number of relay channels
pub fn HAL_GetNumRelayChannels ( ) -> i32 ; } extern "C" {
/// Gets the number of relay headers in the current system.
///
/// @return the number of relay headers
pub fn HAL_GetNumRelayHeaders ( ) -> i32 ; } extern "C" {
/// Gets the number of PCM modules in the current system.
///
/// @return the number of PCM modules
pub fn HAL_GetNumPCMModules ( ) -> i32 ; } extern "C" {
/// Gets the number of solenoid channels in the current system.
///
/// @return the number of solenoid channels
pub fn HAL_GetNumSolenoidChannels ( ) -> i32 ; } extern "C" {
/// Gets the number of PDP modules in the current system.
///
/// @return the number of PDP modules
pub fn HAL_GetNumPDPModules ( ) -> i32 ; } extern "C" {
/// Gets the number of PDP channels in the current system.
///
/// @return the number of PDP channels
pub fn HAL_GetNumPDPChannels ( ) -> i32 ; } extern "C" {
/// Gets the roboRIO input voltage.
///
/// @return the input voltage (volts)
pub fn HAL_GetVinVoltage ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the roboRIO input current.
///
/// @return the input current (amps)
pub fn HAL_GetVinCurrent ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the 6V rail voltage.
///
/// @return the 6V rail voltage (volts)
pub fn HAL_GetUserVoltage6V ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the 6V rail current.
///
/// @return the 6V rail current (amps)
pub fn HAL_GetUserCurrent6V ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the active state of the 6V rail.
///
/// @return true if the rail is active, otherwise false
pub fn HAL_GetUserActive6V ( status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the fault count for the 6V rail.
///
/// @return the number of 6V fault counts
pub fn HAL_GetUserCurrentFaults6V ( status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the 5V rail voltage.
///
/// @return the 5V rail voltage (volts)
pub fn HAL_GetUserVoltage5V ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the 5V rail current.
///
/// @return the 5V rail current (amps)
pub fn HAL_GetUserCurrent5V ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the active state of the 5V rail.
///
/// @return true if the rail is active, otherwise false
pub fn HAL_GetUserActive5V ( status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the fault count for the 5V rail.
///
/// @return the number of 5V fault counts
pub fn HAL_GetUserCurrentFaults5V ( status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the 3V3 rail voltage.
///
/// @return the 3V3 rail voltage (volts)
pub fn HAL_GetUserVoltage3V3 ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the 3V3 rail current.
///
/// @return the 3V3 rail current (amps)
pub fn HAL_GetUserCurrent3V3 ( status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the active state of the 3V3 rail.
///
/// @return true if the rail is active, otherwise false
pub fn HAL_GetUserActive3V3 ( status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the fault count for the 3V3 rail.
///
/// @return the number of 3V3 fault counts
pub fn HAL_GetUserCurrentFaults3V3 ( status : * mut i32 ) -> i32 ; } extern "C" {
/// Initializes a relay.
///
/// Note this call will only initialize either the forward or reverse port of the
/// relay. If you need both, you will need to initialize 2 relays.
///
/// @param portHandle the port handle to initialize
/// @param fwd true for the forward port, false for the reverse port
/// @return the created relay handle
pub fn HAL_InitializeRelayPort ( portHandle : HAL_PortHandle , fwd : HAL_Bool , status : * mut i32 ) -> HAL_RelayHandle ; } extern "C" {
/// Frees a relay port.
///
/// @param relayPortHandle the relay handle
pub fn HAL_FreeRelayPort ( relayPortHandle : HAL_RelayHandle ) ; } extern "C" {
/// Checks if a relay channel is valid.
///
/// @param channel the channel to check
/// @return true if the channel is valid, otherwise false
pub fn HAL_CheckRelayChannel ( channel : i32 ) -> HAL_Bool ; } extern "C" {
/// Sets the state of a relay output.
///
/// @param relayPortHandle the relay handle
/// @param on true for on, false for off
pub fn HAL_SetRelay ( relayPortHandle : HAL_RelayHandle , on : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Gets the current state of the relay channel.
///
/// @param relayPortHandle the relay handle
/// @return true for on, false for off
pub fn HAL_GetRelay ( relayPortHandle : HAL_RelayHandle , status : * mut i32 ) -> HAL_Bool ; } pub mod HAL_SPIPort {
/// @defgroup hal_spi SPI Functions
/// @ingroup hal_capi
/// @{
pub type Type = i32 ; pub const HAL_SPI_kInvalid : Type = -1 ; pub const HAL_SPI_kOnboardCS0 : Type = 0 ; pub const HAL_SPI_kOnboardCS1 : Type = 1 ; pub const HAL_SPI_kOnboardCS2 : Type = 2 ; pub const HAL_SPI_kOnboardCS3 : Type = 3 ; pub const HAL_SPI_kMXP : Type = 4 ; } extern "C" {
/// Initializes the SPI port. Opens the port if necessary and saves the handle.
///
/// If opening the MXP port, also sets up the channel functions appropriately.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS3, 4 for MXP
pub fn HAL_InitializeSPI ( port : HAL_SPIPort::Type , status : * mut i32 ) ; } extern "C" {
/// Performs an SPI send/receive transaction.
///
/// This is a lower-level interface to the spi hardware giving you more control
/// over each transaction.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
/// for MXP
/// @param dataToSend Buffer of data to send as part of the transaction.
/// @param dataReceived Buffer to read data into.
/// @param size Number of bytes to transfer. [0..7]
/// @return Number of bytes transferred, -1 for error
pub fn HAL_TransactionSPI ( port : HAL_SPIPort::Type , dataToSend : * const u8 , dataReceived : * mut u8 , size : i32 ) -> i32 ; } extern "C" {
/// Executes a write transaction with the device.
///
/// Writes to a device and wait until the transaction is complete.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
/// for MXP
/// @param datToSend The data to write to the register on the device.
/// @param sendSize The number of bytes to be written
/// @return The number of bytes written. -1 for an error
pub fn HAL_WriteSPI ( port : HAL_SPIPort::Type , dataToSend : * const u8 , sendSize : i32 ) -> i32 ; } extern "C" {
/// Executes a read from the device.
///
/// This method does not write any data out to the device.
///
/// Most spi devices will require a register address to be written before they
/// begin returning data.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP
/// @param buffer A pointer to the array of bytes to store the data read from the
/// device.
/// @param count The number of bytes to read in the transaction. [1..7]
/// @return Number of bytes read. -1 for error.
pub fn HAL_ReadSPI ( port : HAL_SPIPort::Type , buffer : * mut u8 , count : i32 ) -> i32 ; } extern "C" {
/// Closes the SPI port.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
pub fn HAL_CloseSPI ( port : HAL_SPIPort::Type ) ; } extern "C" {
/// Sets the clock speed for the SPI bus.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP
/// @param speed The speed in Hz (0-1MHz)
pub fn HAL_SetSPISpeed ( port : HAL_SPIPort::Type , speed : i32 ) ; } extern "C" {
/// Sets the SPI options.
///
/// @param port The number of the port to use. 0-3 for Onboard
/// CS0-CS2, 4 for MXP
/// @param msbFirst True to write the MSB first, False for LSB first
/// @param sampleOnTrailing True to sample on the trailing edge, False to sample
/// on the leading edge
/// @param clkIdleHigh True to set the clock to active low, False to set the
/// clock active high
pub fn HAL_SetSPIOpts ( port : HAL_SPIPort::Type , msbFirst : HAL_Bool , sampleOnTrailing : HAL_Bool , clkIdleHigh : HAL_Bool ) ; } extern "C" {
/// Sets the CS Active high for a SPI port.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
pub fn HAL_SetSPIChipSelectActiveHigh ( port : HAL_SPIPort::Type , status : * mut i32 ) ; } extern "C" {
/// Sets the CS Active low for a SPI port.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
pub fn HAL_SetSPIChipSelectActiveLow ( port : HAL_SPIPort::Type , status : * mut i32 ) ; } extern "C" {
/// Gets the stored handle for a SPI port.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
/// @return The stored handle for the SPI port. 0 represents no stored
/// handle.
pub fn HAL_GetSPIHandle ( port : HAL_SPIPort::Type ) -> i32 ; } extern "C" {
/// Sets the stored handle for a SPI port.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP.
/// @param handle The value of the handle for the port.
pub fn HAL_SetSPIHandle ( port : HAL_SPIPort::Type , handle : i32 ) ; } extern "C" {
/// Initializes the SPI automatic accumulator.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
/// for MXP.
/// @param bufferSize The accumulator buffer size.
pub fn HAL_InitSPIAuto ( port : HAL_SPIPort::Type , bufferSize : i32 , status : * mut i32 ) ; } extern "C" {
/// Frees an SPI automatic accumulator.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP.
pub fn HAL_FreeSPIAuto ( port : HAL_SPIPort::Type , status : * mut i32 ) ; } extern "C" {
/// Sets the period for automatic SPI accumulation.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP.
/// @param period The accumlation period (seconds).
pub fn HAL_StartSPIAutoRate ( port : HAL_SPIPort::Type , period : f64 , status : * mut i32 ) ; } extern "C" {
/// Starts the auto SPI accumulator on a specific trigger.
///
/// Note that triggering on both rising and falling edges is a valid
/// configuration.
///
/// @param port The number of the port to use. 0-3 for Onboard
/// CS0-CS2, 4 for MXP.
/// @param digitalSourceHandle The trigger source to use (Either
/// HAL_AnalogTriggerHandle or HAL_DigitalHandle).
/// @param analogTriggerType The analog trigger type, if the source is an
/// analog trigger.
/// @param triggerRising Trigger on the rising edge if true.
/// @param triggerFalling Trigger on the falling edge if true.
pub fn HAL_StartSPIAutoTrigger ( port : HAL_SPIPort::Type , digitalSourceHandle : HAL_Handle , analogTriggerType : HAL_AnalogTriggerType::Type , triggerRising : HAL_Bool , triggerFalling : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Stops an automatic SPI accumlation.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP.
pub fn HAL_StopSPIAuto ( port : HAL_SPIPort::Type , status : * mut i32 ) ; } extern "C" {
/// Sets the data to be transmitted to the device to initiate a read.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
/// for MXP.
/// @param dataToSend Pointer to the data to send (Gets copied for continue use,
/// so no need to keep alive).
/// @param dataSize The length of the data to send.
/// @param zeroSize The number of zeros to send after the data.
pub fn HAL_SetSPIAutoTransmitData ( port : HAL_SPIPort::Type , dataToSend : * const u8 , dataSize : i32 , zeroSize : i32 , status : * mut i32 ) ; } extern "C" {
/// Immediately forces an SPI read to happen.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP.
pub fn HAL_ForceSPIAutoRead ( port : HAL_SPIPort::Type , status : * mut i32 ) ; } extern "C" {
/// Reads data received by the SPI accumulator.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4
/// for MXP.
/// @param buffer The buffer to store the data into.
/// @param numToRead The number of bytes to read.
/// @param timeout The read timeout (in seconds).
/// @return The number of bytes actually read.
pub fn HAL_ReadSPIAutoReceivedData ( port : HAL_SPIPort::Type , buffer : * mut u8 , numToRead : i32 , timeout : f64 , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the count of how many SPI accumulations have been missed.
///
/// @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for
/// MXP.
/// @return The number of missed accumulations.
pub fn HAL_GetSPIAutoDroppedCount ( port : HAL_SPIPort::Type , status : * mut i32 ) -> i32 ; } pub mod HAL_SerialPort {
/// @defgroup hal_serialport Serial Port Functions
/// @ingroup hal_capi
/// @{
pub type Type = i32 ; pub const HAL_SerialPort_Onboard : Type = 0 ; pub const HAL_SerialPort_MXP : Type = 1 ; pub const HAL_SerialPort_USB1 : Type = 2 ; pub const HAL_SerialPort_USB2 : Type = 3 ; } extern "C" {
/// Initializes a serial port.
///
/// The channels are either the onboard RS232, the mxp uart, or 2 USB ports. The
/// top port is USB1, the bottom port is USB2.
///
/// @param port the serial port to initialize
pub fn HAL_InitializeSerialPort ( port : HAL_SerialPort::Type , status : * mut i32 ) ; } extern "C" {
/// Initializes a serial port with a direct name.
///
/// This name is the VISA name for a specific port (find this in the web dash).
/// Note these are not always consistent between roboRIO reboots.
///
/// @param port the serial port to initialize
/// @param portName the VISA port name
pub fn HAL_InitializeSerialPortDirect ( port : HAL_SerialPort::Type , portName : * const :: std :: os :: raw :: c_char , status : * mut i32 ) ; } extern "C" {
/// Sets the baud rate of a serial port.
///
/// Any value between 0 and 0xFFFFFFFF may be used. Default is 9600.
///
/// @param port the serial port
/// @param baud the baud rate to set
pub fn HAL_SetSerialBaudRate ( port : HAL_SerialPort::Type , baud : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the number of data bits on a serial port.
///
/// Defaults to 8.
///
/// @param port the serial port
/// @param bits the number of data bits (5-8)
pub fn HAL_SetSerialDataBits ( port : HAL_SerialPort::Type , bits : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the number of parity bits on a serial port.
///
/// Valid values are:
/// 0: None (default)
/// 1: Odd
/// 2: Even
/// 3: Mark - Means exists and always 1
/// 4: Space - Means exists and always 0
///
/// @param port the serial port
/// @param parity the parity bit mode (see remarks for valid values)
pub fn HAL_SetSerialParity ( port : HAL_SerialPort::Type , parity : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the number of stop bits on a serial port.
///
/// Valid values are:
/// 10: One stop bit (default)
/// 15: One and a half stop bits
/// 20: Two stop bits
///
/// @param port the serial port
/// @param stopBits the stop bit value (see remarks for valid values)
pub fn HAL_SetSerialStopBits ( port : HAL_SerialPort::Type , stopBits : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the write mode on a serial port.
///
/// Valid values are:
/// 1: Flush on access
/// 2: Flush when full (default)
///
/// @param port the serial port
/// @param mode the mode to set (see remarks for valid values)
pub fn HAL_SetSerialWriteMode ( port : HAL_SerialPort::Type , mode : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the flow control mode of a serial port.
///
/// Valid values are:
/// 0: None (default)
/// 1: XON-XOFF
/// 2: RTS-CTS
/// 3: DTR-DSR
///
/// @param port the serial port
/// @param flow the mode to set (see remarks for valid values)
pub fn HAL_SetSerialFlowControl ( port : HAL_SerialPort::Type , flow : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the minimum serial read timeout of a port.
///
/// @param port the serial port
/// @param timeout the timeout in milliseconds
pub fn HAL_SetSerialTimeout ( port : HAL_SerialPort::Type , timeout : f64 , status : * mut i32 ) ; } extern "C" {
/// Sets the termination character that terminates a read.
///
/// By default this is disabled.
///
/// @param port the serial port
/// @param terminator the termination character to set
pub fn HAL_EnableSerialTermination ( port : HAL_SerialPort::Type , terminator : :: std :: os :: raw :: c_char , status : * mut i32 ) ; } extern "C" {
/// Disables a termination character for reads.
///
/// @param port the serial port
pub fn HAL_DisableSerialTermination ( port : HAL_SerialPort::Type , status : * mut i32 ) ; } extern "C" {
/// Sets the size of the read buffer.
///
/// @param port the serial port
/// @param size the read buffer size
pub fn HAL_SetSerialReadBufferSize ( port : HAL_SerialPort::Type , size : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the size of the write buffer.
///
/// @param port the serial port
/// @param size the write buffer size
pub fn HAL_SetSerialWriteBufferSize ( port : HAL_SerialPort::Type , size : i32 , status : * mut i32 ) ; } extern "C" {
/// Gets the number of bytes currently in the read buffer.
///
/// @param port the serial port
/// @return the number of bytes in the read buffer
pub fn HAL_GetSerialBytesReceived ( port : HAL_SerialPort::Type , status : * mut i32 ) -> i32 ; } extern "C" {
/// Reads data from the serial port.
///
/// Will wait for either timeout (if set), the termination char (if set), or the
/// count to be full. Whichever one comes first.
///
/// @param port the serial port
/// @param count the number of bytes maximum to read
/// @return the number of bytes actually read
pub fn HAL_ReadSerial ( port : HAL_SerialPort::Type , buffer : * mut :: std :: os :: raw :: c_char , count : i32 , status : * mut i32 ) -> i32 ; } extern "C" {
/// Writes data to the serial port.
///
/// @param port the serial port
/// @param buffer the buffer to write
/// @param count the number of bytes to write from the buffer
/// @return the number of bytes actually written
pub fn HAL_WriteSerial ( port : HAL_SerialPort::Type , buffer : * const :: std :: os :: raw :: c_char , count : i32 , status : * mut i32 ) -> i32 ; } extern "C" {
/// Flushes the serial write buffer out to the port.
///
/// @param port the serial port
pub fn HAL_FlushSerial ( port : HAL_SerialPort::Type , status : * mut i32 ) ; } extern "C" {
/// Clears the receive buffer of the serial port.
///
/// @param port the serial port
pub fn HAL_ClearSerial ( port : HAL_SerialPort::Type , status : * mut i32 ) ; } extern "C" {
/// Closes a serial port.
///
/// @param port the serial port to close
pub fn HAL_CloseSerial ( port : HAL_SerialPort::Type , status : * mut i32 ) ; } extern "C" {
/// Initializes a solenoid port.
///
/// @param portHandle the port handle of the module and channel to initialize
/// @return the created solenoid handle
pub fn HAL_InitializeSolenoidPort ( portHandle : HAL_PortHandle , status : * mut i32 ) -> HAL_SolenoidHandle ; } extern "C" {
/// Frees a solenoid port.
///
/// @param solenoidPortHandle the solenoid handle
pub fn HAL_FreeSolenoidPort ( solenoidPortHandle : HAL_SolenoidHandle ) ; } extern "C" {
/// Checks if a solenoid module is in the valid range.
///
/// @param module the module number to check
/// @return true if the module number is valid, otherwise false
pub fn HAL_CheckSolenoidModule ( module : i32 ) -> HAL_Bool ; } extern "C" {
/// Checks if a solenoid channel is in the valid range.
///
/// @param channel the channel number to check
/// @return true if the channel number is valid, otherwise false
pub fn HAL_CheckSolenoidChannel ( channel : i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the current solenoid output value.
///
/// @param solenoidPortHandle the solenoid handle
/// @return true if the solenoid is on, otherwise false
pub fn HAL_GetSolenoid ( solenoidPortHandle : HAL_SolenoidHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the status of all solenoids on a specific module.
///
/// @param module the module to check
/// @return bitmask of the channels, 1 for on 0 for off
pub fn HAL_GetAllSolenoids ( module : i32 , status : * mut i32 ) -> i32 ; } extern "C" {
/// Sets a solenoid output value.
///
/// @param solenoidPortHandle the solenoid handle
/// @param value true for on, false for off
pub fn HAL_SetSolenoid ( solenoidPortHandle : HAL_SolenoidHandle , value : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Sets all channels on a specific module.
///
/// @param module the module to set the channels on
/// @param state bitmask of the channels to set, 1 for on 0 for off
pub fn HAL_SetAllSolenoids ( module : i32 , state : i32 , status : * mut i32 ) ; } extern "C" {
/// Gets the channels blacklisted from being enabled on a module.
///
/// @param module the module to check
/// @retur bitmask of the blacklisted channels, 1 for true 0 for false
pub fn HAL_GetPCMSolenoidBlackList ( module : i32 , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets if a specific module has an over or under voltage sticky fault.
///
/// @param module the module to check
/// @return true if a stick fault is set, otherwise false
pub fn HAL_GetPCMSolenoidVoltageStickyFault ( module : i32 , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if a specific module has an over or under voltage fault.
///
/// @param module the module to check
/// @return true if faulted, otherwise false
pub fn HAL_GetPCMSolenoidVoltageFault ( module : i32 , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Clears all faults on a module.
///
/// @param module the module to clear
pub fn HAL_ClearAllPCMStickyFaults ( module : i32 , status : * mut i32 ) ; } extern "C" {
/// Sets the one shot duration on a solenoid channel.
///
/// @param solenoidPortHandle the solenoid handle
/// @param durMS the one shot duration in ms
pub fn HAL_SetOneShotDuration ( solenoidPortHandle : HAL_SolenoidHandle , durMS : i32 , status : * mut i32 ) ; } extern "C" {
/// Fires a single pulse on a solenoid channel.
///
/// The pulse is the duration set by HAL_SetOneShotDuration().
///
/// @param solenoidPortHandle the solenoid handle
pub fn HAL_FireOneShot ( solenoidPortHandle : HAL_SolenoidHandle , status : * mut i32 ) ; } pub mod HALUsageReporting_tResourceType { pub type Type = u32 ; pub const kResourceType_Controller : Type = 0 ; pub const kResourceType_Module : Type = 1 ; pub const kResourceType_Language : Type = 2 ; pub const kResourceType_CANPlugin : Type = 3 ; pub const kResourceType_Accelerometer : Type = 4 ; pub const kResourceType_ADXL345 : Type = 5 ; pub const kResourceType_AnalogChannel : Type = 6 ; pub const kResourceType_AnalogTrigger : Type = 7 ; pub const kResourceType_AnalogTriggerOutput : Type = 8 ; pub const kResourceType_CANJaguar : Type = 9 ; pub const kResourceType_Compressor : Type = 10 ; pub const kResourceType_Counter : Type = 11 ; pub const kResourceType_Dashboard : Type = 12 ; pub const kResourceType_DigitalInput : Type = 13 ; pub const kResourceType_DigitalOutput : Type = 14 ; pub const kResourceType_DriverStationCIO : Type = 15 ; pub const kResourceType_DriverStationEIO : Type = 16 ; pub const kResourceType_DriverStationLCD : Type = 17 ; pub const kResourceType_Encoder : Type = 18 ; pub const kResourceType_GearTooth : Type = 19 ; pub const kResourceType_Gyro : Type = 20 ; pub const kResourceType_I2C : Type = 21 ; pub const kResourceType_Framework : Type = 22 ; pub const kResourceType_Jaguar : Type = 23 ; pub const kResourceType_Joystick : Type = 24 ; pub const kResourceType_Kinect : Type = 25 ; pub const kResourceType_KinectStick : Type = 26 ; pub const kResourceType_PIDController : Type = 27 ; pub const kResourceType_Preferences : Type = 28 ; pub const kResourceType_PWM : Type = 29 ; pub const kResourceType_Relay : Type = 30 ; pub const kResourceType_RobotDrive : Type = 31 ; pub const kResourceType_SerialPort : Type = 32 ; pub const kResourceType_Servo : Type = 33 ; pub const kResourceType_Solenoid : Type = 34 ; pub const kResourceType_SPI : Type = 35 ; pub const kResourceType_Task : Type = 36 ; pub const kResourceType_Ultrasonic : Type = 37 ; pub const kResourceType_Victor : Type = 38 ; pub const kResourceType_Button : Type = 39 ; pub const kResourceType_Command : Type = 40 ; pub const kResourceType_AxisCamera : Type = 41 ; pub const kResourceType_PCVideoServer : Type = 42 ; pub const kResourceType_SmartDashboard : Type = 43 ; pub const kResourceType_Talon : Type = 44 ; pub const kResourceType_HiTechnicColorSensor : Type = 45 ; pub const kResourceType_HiTechnicAccel : Type = 46 ; pub const kResourceType_HiTechnicCompass : Type = 47 ; pub const kResourceType_SRF08 : Type = 48 ; pub const kResourceType_AnalogOutput : Type = 49 ; pub const kResourceType_VictorSP : Type = 50 ; pub const kResourceType_PWMTalonSRX : Type = 51 ; pub const kResourceType_CANTalonSRX : Type = 52 ; pub const kResourceType_ADXL362 : Type = 53 ; pub const kResourceType_ADXRS450 : Type = 54 ; pub const kResourceType_RevSPARK : Type = 55 ; pub const kResourceType_MindsensorsSD540 : Type = 56 ; pub const kResourceType_DigitalGlitchFilter : Type = 57 ; pub const kResourceType_ADIS16448 : Type = 58 ; pub const kResourceType_PDP : Type = 59 ; pub const kResourceType_PCM : Type = 60 ; pub const kResourceType_PigeonIMU : Type = 61 ; pub const kResourceType_NidecBrushless : Type = 62 ; pub const kResourceType_CANifier : Type = 63 ; pub const kResourceType_CTRE_future0 : Type = 64 ; pub const kResourceType_CTRE_future1 : Type = 65 ; pub const kResourceType_CTRE_future2 : Type = 66 ; pub const kResourceType_CTRE_future3 : Type = 67 ; pub const kResourceType_CTRE_future4 : Type = 68 ; pub const kResourceType_CTRE_future5 : Type = 69 ; pub const kResourceType_CTRE_future6 : Type = 70 ; pub const kResourceType_LinearFilter : Type = 71 ; pub const kResourceType_XboxController : Type = 72 ; pub const kResourceType_UsbCamera : Type = 73 ; pub const kResourceType_NavX : Type = 74 ; pub const kResourceType_Pixy : Type = 75 ; pub const kResourceType_Pixy2 : Type = 76 ; pub const kResourceType_ScanseSweep : Type = 77 ; pub const kResourceType_Shuffleboard : Type = 78 ; pub const kResourceType_CAN : Type = 79 ; pub const kResourceType_DigilentDMC60 : Type = 80 ; pub const kResourceType_PWMVictorSPX : Type = 81 ; } pub mod HALUsageReporting_tInstances { pub type Type = u32 ; pub const kLanguage_LabVIEW : Type = 1 ; pub const kLanguage_CPlusPlus : Type = 2 ; pub const kLanguage_Java : Type = 3 ; pub const kLanguage_Python : Type = 4 ; pub const kLanguage_DotNet : Type = 5 ; pub const kCANPlugin_BlackJagBridge : Type = 1 ; pub const kCANPlugin_2CAN : Type = 2 ; pub const kFramework_Iterative : Type = 1 ; pub const kFramework_Simple : Type = 2 ; pub const kFramework_CommandControl : Type = 3 ; pub const kFramework_Timed : Type = 4 ; pub const kFramework_ROS : Type = 5 ; pub const kFramework_RobotBuilder : Type = 6 ; pub const kRobotDrive_ArcadeStandard : Type = 1 ; pub const kRobotDrive_ArcadeButtonSpin : Type = 2 ; pub const kRobotDrive_ArcadeRatioCurve : Type = 3 ; pub const kRobotDrive_Tank : Type = 4 ; pub const kRobotDrive_MecanumPolar : Type = 5 ; pub const kRobotDrive_MecanumCartesian : Type = 6 ; pub const kRobotDrive2_DifferentialArcade : Type = 7 ; pub const kRobotDrive2_DifferentialTank : Type = 8 ; pub const kRobotDrive2_DifferentialCurvature : Type = 9 ; pub const kRobotDrive2_MecanumCartesian : Type = 10 ; pub const kRobotDrive2_MecanumPolar : Type = 11 ; pub const kRobotDrive2_KilloughCartesian : Type = 12 ; pub const kRobotDrive2_KilloughPolar : Type = 13 ; pub const kDriverStationCIO_Analog : Type = 1 ; pub const kDriverStationCIO_DigitalIn : Type = 2 ; pub const kDriverStationCIO_DigitalOut : Type = 3 ; pub const kDriverStationEIO_Acceleration : Type = 1 ; pub const kDriverStationEIO_AnalogIn : Type = 2 ; pub const kDriverStationEIO_AnalogOut : Type = 3 ; pub const kDriverStationEIO_Button : Type = 4 ; pub const kDriverStationEIO_LED : Type = 5 ; pub const kDriverStationEIO_DigitalIn : Type = 6 ; pub const kDriverStationEIO_DigitalOut : Type = 7 ; pub const kDriverStationEIO_FixedDigitalOut : Type = 8 ; pub const kDriverStationEIO_PWM : Type = 9 ; pub const kDriverStationEIO_Encoder : Type = 10 ; pub const kDriverStationEIO_TouchSlider : Type = 11 ; pub const kADXL345_SPI : Type = 1 ; pub const kADXL345_I2C : Type = 2 ; pub const kCommand_Scheduler : Type = 1 ; pub const kSmartDashboard_Instance : Type = 1 ; } pub mod HAL_RuntimeType {
/// @defgroup hal_capi WPILib HAL API
/// Hardware Abstraction Layer to hardware or simulator
/// @{
pub type Type = i32 ; pub const HAL_Athena : Type = 0 ; pub const HAL_Mock : Type = 1 ; } extern "C" {
/// Gets the error message for a specific status code.
///
/// @param code the status code
/// @return the error message for the code. This does not need to be freed.
pub fn HAL_GetErrorMessage ( code : i32 ) -> * const :: std :: os :: raw :: c_char ; } extern "C" {
/// Returns the FPGA Version number.
///
/// For now, expect this to be competition year.
///
/// @return FPGA Version number.
pub fn HAL_GetFPGAVersion ( status : * mut i32 ) -> i32 ; } extern "C" {
/// Returns the FPGA Revision number.
///
/// The format of the revision is 3 numbers.
/// The 12 most significant bits are the Major Revision.
/// the next 8 bits are the Minor Revision.
/// The 12 least significant bits are the Build Number.
///
/// @return FPGA Revision number.
pub fn HAL_GetFPGARevision ( status : * mut i32 ) -> i64 ; } extern "C" { pub fn HAL_GetRuntimeType ( ) -> HAL_RuntimeType::Type ; } extern "C" {
/// Gets the state of the "USER" button on the roboRIO.
///
/// @return true if the button is currently pressed down
pub fn HAL_GetFPGAButton ( status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if the system outputs are currently active
///
/// @return true if the system outputs are active, false if disabled
pub fn HAL_GetSystemActive ( status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets if the system is in a browned out state.
///
/// @return true if the system is in a low voltage brown out, false otherwise
pub fn HAL_GetBrownedOut ( status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// The base HAL initialize function. Useful if you need to ensure the DS and
/// base HAL functions (the ones above this declaration in HAL.h) are properly
/// initialized. For normal programs and executables, please use HAL_Initialize.
///
/// This is mainly expected to be use from libraries that are expected to be used
/// from LabVIEW, as it handles its own initialization for objects.
pub fn HAL_BaseInitialize ( status : * mut i32 ) ; } extern "C" {
/// Gets a port handle for a specific channel.
///
/// The created handle does not need to be freed.
///
/// @param channel the channel number
/// @return the created port
pub fn HAL_GetPort ( channel : i32 ) -> HAL_PortHandle ; } extern "C" {
/// Gets a port handle for a specific channel and module.
///
/// This is expected to be used for PCMs, as the roboRIO does not work with
/// modules anymore.
///
/// The created handle does not need to be freed.
///
/// @param module the module number
/// @param channel the channel number
/// @return the created port
pub fn HAL_GetPortWithModule ( module : i32 , channel : i32 ) -> HAL_PortHandle ; } extern "C" {
/// Reads the microsecond-resolution timer on the FPGA.
///
/// @return The current time in microseconds according to the FPGA (since FPGA
/// reset).
pub fn HAL_GetFPGATime ( status : * mut i32 ) -> u64 ; } extern "C" {
/// Call this to start up HAL. This is required for robot programs.
///
/// This must be called before any other HAL functions. Failure to do so will
/// result in undefined behavior, and likely segmentation faults. This means that
/// any statically initialized variables in a program MUST call this function in
/// their constructors if they want to use other HAL calls.
///
/// The common parameters are 500 for timeout and 0 for mode.
///
/// This function is safe to call from any thread, and as many times as you wish.
/// It internally guards from any reentrancy.
///
/// The applicable modes are:
/// 0: Try to kill an existing HAL from another program, if not successful,
/// error.
/// 1: Force kill a HAL from another program.
/// 2: Just warn if another hal exists and cannot be killed. Will likely result
/// in undefined behavior.
///
/// @param timeout the initialization timeout (ms)
/// @param mode the initialization mode (see remarks)
/// @return true if initialization was successful, otherwise false.
pub fn HAL_Initialize ( timeout : i32 , mode : i32 ) -> HAL_Bool ; } extern "C" {
/// Reports a hardware usage to the HAL.
///
/// @param resource the used resource
/// @param instanceNumber the instance of the resource
/// @param context a user specified context index
/// @param feature a user specified feature string
/// @return the index of the added value in NetComm
pub fn HAL_Report ( resource : i32 , instanceNumber : i32 , context : i32 , feature : * const :: std :: os :: raw :: c_char ) -> i64 ; } pub mod HAL_EncoderIndexingType {
/// The type of index pulse for the encoder.
pub type Type = i32 ; pub const HAL_kResetWhileHigh : Type = 0 ; pub const HAL_kResetWhileLow : Type = 1 ; pub const HAL_kResetOnFallingEdge : Type = 2 ; pub const HAL_kResetOnRisingEdge : Type = 3 ; } pub mod HAL_EncoderEncodingType {
/// The encoding scaling of the encoder.
pub type Type = i32 ; pub const HAL_Encoder_k1X : Type = 0 ; pub const HAL_Encoder_k2X : Type = 1 ; pub const HAL_Encoder_k4X : Type = 2 ; } extern "C" {
/// Initializes an encoder.
///
/// @param digitalSourceHandleA the A source (either a HAL_DigitalHandle or a
/// HAL_AnalogTriggerHandle)
/// @param analogTriggerTypeA the analog trigger type of the A source if it is
/// an analog trigger
/// @param digitalSourceHandleB the B source (either a HAL_DigitalHandle or a
/// HAL_AnalogTriggerHandle)
/// @param analogTriggerTypeB the analog trigger type of the B source if it is
/// an analog trigger
/// @param reverseDirection true to reverse the counting direction from
/// standard, otherwise false
/// @param encodingType the encoding type
///@return the created encoder handle
pub fn HAL_InitializeEncoder ( digitalSourceHandleA : HAL_Handle , analogTriggerTypeA : HAL_AnalogTriggerType::Type , digitalSourceHandleB : HAL_Handle , analogTriggerTypeB : HAL_AnalogTriggerType::Type , reverseDirection : HAL_Bool , encodingType : HAL_EncoderEncodingType::Type , status : * mut i32 ) -> HAL_EncoderHandle ; } extern "C" {
/// Frees an encoder.
///
/// @param encoderHandle the encoder handle
pub fn HAL_FreeEncoder ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) ; } extern "C" {
/// Gets the current counts of the encoder after encoding type scaling.
///
/// This is scaled by the value passed duing initialization to encodingType.
///
/// @param encoderHandle the encoder handle
/// @return the current scaled count
pub fn HAL_GetEncoder ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the raw counts of the encoder.
///
/// This is not scaled by any values.
///
/// @param encoderHandle the encoder handle
/// @return the raw encoder count
pub fn HAL_GetEncoderRaw ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the encoder scale value.
///
/// This is set by the value passed during initialization to encodingType.
///
/// @param encoderHandle the encoder handle
/// @return the encoder scale value
pub fn HAL_GetEncoderEncodingScale ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Reads the current encoder value.
///
/// Read the value at this instant. It may still be running, so it reflects the
/// current value. Next time it is read, it might have a different value.
///
/// @param encoderHandle the encoder handle
/// @return the current encoder value
pub fn HAL_ResetEncoder ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) ; } extern "C" { pub fn HAL_GetEncoderPeriod ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Sets the maximum period where the device is still considered "moving".
///
/// Sets the maximum period where the device is considered moving. This value is
/// used to determine the "stopped" state of the encoder using the
/// HAL_GetEncoderStopped method.
///
/// @param encoderHandle the encoder handle
/// @param maxPeriod the maximum period where the counted device is
/// considered moving in seconds
pub fn HAL_SetEncoderMaxPeriod ( encoderHandle : HAL_EncoderHandle , maxPeriod : f64 , status : * mut i32 ) ; } extern "C" {
/// Determines if the clock is stopped.
///
/// Determines if the clocked input is stopped based on the MaxPeriod value set
/// using the SetMaxPeriod method. If the clock exceeds the MaxPeriod, then the
/// device (and encoder) are assumed to be stopped and it returns true.
///
/// @param encoderHandle the encoder handle
/// @return true if the most recent encoder period exceeds the
/// MaxPeriod value set by SetMaxPeriod
pub fn HAL_GetEncoderStopped ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the last direction the encoder value changed.
///
/// @param encoderHandle the encoder handle
/// @return the last direction the encoder value changed
pub fn HAL_GetEncoderDirection ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> HAL_Bool ; } extern "C" {
/// Gets the current distance traveled by the encoder.
///
/// This is the encoder count scaled by the distance per pulse set for the
/// encoder.
///
/// @param encoderHandle the encoder handle
/// @return the encoder distance (units are determined by the units
/// passed to HAL_SetEncoderDistancePerPulse)
pub fn HAL_GetEncoderDistance ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the current rate of the encoder.
///
/// This is the encoder period scaled by the distance per pulse set for the
/// encoder.
///
/// @param encoderHandle the encoder handle
/// @return the encoder rate (units are determined by the units
/// passed to HAL_SetEncoderDistancePerPulse, time value is seconds)
pub fn HAL_GetEncoderRate ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Sets the minimum rate to be considered moving by the encoder.
///
/// Units need to match what is set by HAL_SetEncoderDistancePerPulse, with time
/// as seconds.
///
/// @param encoderHandle the encoder handle
/// @param minRate the minimum rate to be considered moving (units are
/// determined by the units passed to HAL_SetEncoderDistancePerPulse, time value
/// is seconds)
pub fn HAL_SetEncoderMinRate ( encoderHandle : HAL_EncoderHandle , minRate : f64 , status : * mut i32 ) ; } extern "C" {
/// Sets the distance traveled per encoder pulse. This is used as a scaling
/// factor for the rate and distance calls.
///
/// @param encoderHandle the encoder handle
/// @param distancePerPulse the distance traveled per encoder pulse (units user
/// defined)
pub fn HAL_SetEncoderDistancePerPulse ( encoderHandle : HAL_EncoderHandle , distancePerPulse : f64 , status : * mut i32 ) ; } extern "C" {
/// Sets if to reverse the direction of the encoder.
///
/// Note that this is not a toggle. It is an absolute set.
///
/// @param encoderHandle the encoder handle
/// @param reverseDirection true to reverse the direction, false to not.
pub fn HAL_SetEncoderReverseDirection ( encoderHandle : HAL_EncoderHandle , reverseDirection : HAL_Bool , status : * mut i32 ) ; } extern "C" {
/// Sets the number of encoder samples to average when calculating encoder rate.
///
/// @param encoderHandle the encoder handle
/// @param samplesToAverage the number of samples to average
pub fn HAL_SetEncoderSamplesToAverage ( encoderHandle : HAL_EncoderHandle , samplesToAverage : i32 , status : * mut i32 ) ; } extern "C" {
/// Gets the current samples to average value.
///
/// @param encoderHandle the encoder handle
/// @return the current samples to average value
pub fn HAL_GetEncoderSamplesToAverage ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Sets the source for an index pulse on the encoder.
///
/// The index pulse can be used to cause an encoder to reset based on an external
/// input.
///
/// @param encoderHandle the encoder handle
/// @param digitalSourceHandle the index source handle (either a
/// HAL_AnalogTriggerHandle of a HAL_DigitalHandle)
/// @param analogTriggerType the analog trigger type if the source is an analog
/// trigger
/// @param type the index triggering type
pub fn HAL_SetEncoderIndexSource ( encoderHandle : HAL_EncoderHandle , digitalSourceHandle : HAL_Handle , analogTriggerType : HAL_AnalogTriggerType::Type , type_ : HAL_EncoderIndexingType::Type , status : * mut i32 ) ; } extern "C" {
/// Gets the FPGA index of the encoder.
///
/// @param encoderHandle the encoder handle
/// @return the FPGA index of the encoder
pub fn HAL_GetEncoderFPGAIndex ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> i32 ; } extern "C" {
/// Gets the decoding scale factor of the encoder.
///
/// This is used to perform the scaling from raw to type scaled values.
///
/// @param encoderHandle the encoder handle
/// @return the scale value for the encoder
pub fn HAL_GetEncoderDecodingScaleFactor ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the user set distance per pulse of the encoder.
///
/// @param encoderHandle the encoder handle
/// @return the set distance per pulse
pub fn HAL_GetEncoderDistancePerPulse ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> f64 ; } extern "C" {
/// Gets the encoding type of the encoder.
///
/// @param encoderHandle the encoder handle
/// @return the encoding type
pub fn HAL_GetEncoderEncodingType ( encoderHandle : HAL_EncoderHandle , status : * mut i32 ) -> HAL_EncoderEncodingType::Type ; }