robotpy-native-wpihal 2025.3.2__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. native/wpihal/_init_robotpy_native_wpihal.py +22 -0
  2. native/wpihal/include/hal/.clang-tidy +73 -0
  3. native/wpihal/include/hal/Accelerometer.h +74 -0
  4. native/wpihal/include/hal/AddressableLED.h +145 -0
  5. native/wpihal/include/hal/AddressableLEDTypes.h +37 -0
  6. native/wpihal/include/hal/AnalogAccumulator.h +120 -0
  7. native/wpihal/include/hal/AnalogGyro.h +149 -0
  8. native/wpihal/include/hal/AnalogInput.h +264 -0
  9. native/wpihal/include/hal/AnalogOutput.h +72 -0
  10. native/wpihal/include/hal/AnalogTrigger.h +184 -0
  11. native/wpihal/include/hal/CAN.h +151 -0
  12. native/wpihal/include/hal/CANAPI.h +169 -0
  13. native/wpihal/include/hal/CANAPITypes.h +94 -0
  14. native/wpihal/include/hal/CTREPCM.h +265 -0
  15. native/wpihal/include/hal/ChipObject.h +45 -0
  16. native/wpihal/include/hal/Constants.h +28 -0
  17. native/wpihal/include/hal/Counter.h +331 -0
  18. native/wpihal/include/hal/DIO.h +254 -0
  19. native/wpihal/include/hal/DMA.h +458 -0
  20. native/wpihal/include/hal/DriverStation.h +282 -0
  21. native/wpihal/include/hal/DriverStationTypes.h +123 -0
  22. native/wpihal/include/hal/DutyCycle.h +110 -0
  23. native/wpihal/include/hal/Encoder.h +327 -0
  24. native/wpihal/include/hal/Errors.h +159 -0
  25. native/wpihal/include/hal/Extensions.h +97 -0
  26. native/wpihal/include/hal/FRCUsageReporting.h +267 -0
  27. native/wpihal/include/hal/HAL.h +40 -0
  28. native/wpihal/include/hal/HALBase.h +263 -0
  29. native/wpihal/include/hal/I2C.h +93 -0
  30. native/wpihal/include/hal/I2CTypes.h +22 -0
  31. native/wpihal/include/hal/Interrupts.h +137 -0
  32. native/wpihal/include/hal/LEDs.h +34 -0
  33. native/wpihal/include/hal/Main.h +62 -0
  34. native/wpihal/include/hal/Notifier.h +125 -0
  35. native/wpihal/include/hal/PWM.h +234 -0
  36. native/wpihal/include/hal/Ports.h +189 -0
  37. native/wpihal/include/hal/Power.h +193 -0
  38. native/wpihal/include/hal/PowerDistribution.h +430 -0
  39. native/wpihal/include/hal/REVPH.h +428 -0
  40. native/wpihal/include/hal/Relay.h +75 -0
  41. native/wpihal/include/hal/SPI.h +281 -0
  42. native/wpihal/include/hal/SPITypes.h +44 -0
  43. native/wpihal/include/hal/SerialPort.h +263 -0
  44. native/wpihal/include/hal/SimDevice.h +948 -0
  45. native/wpihal/include/hal/Threads.h +78 -0
  46. native/wpihal/include/hal/Types.h +140 -0
  47. native/wpihal/include/hal/UsageReporting.h +262 -0
  48. native/wpihal/include/hal/Value.h +107 -0
  49. native/wpihal/include/hal/cpp/SerialHelper.h +80 -0
  50. native/wpihal/include/hal/cpp/UnsafeDIO.h +104 -0
  51. native/wpihal/include/hal/cpp/fpga_clock.h +31 -0
  52. native/wpihal/include/hal/handles/DigitalHandleResource.h +114 -0
  53. native/wpihal/include/hal/handles/HandlesInternal.h +227 -0
  54. native/wpihal/include/hal/handles/IndexedClassedHandleResource.h +119 -0
  55. native/wpihal/include/hal/handles/IndexedHandleResource.h +119 -0
  56. native/wpihal/include/hal/handles/LimitedClassedHandleResource.h +118 -0
  57. native/wpihal/include/hal/handles/LimitedHandleResource.h +112 -0
  58. native/wpihal/include/hal/handles/UnlimitedHandleResource.h +130 -0
  59. native/wpihal/include/hal/roborio/HMB.h +112 -0
  60. native/wpihal/include/hal/roborio/InterruptManager.h +33 -0
  61. native/wpihal/include/hal/simulation/AccelerometerData.h +63 -0
  62. native/wpihal/include/hal/simulation/AddressableLEDData.h +64 -0
  63. native/wpihal/include/hal/simulation/AnalogGyroData.h +44 -0
  64. native/wpihal/include/hal/simulation/AnalogInData.h +96 -0
  65. native/wpihal/include/hal/simulation/AnalogOutData.h +37 -0
  66. native/wpihal/include/hal/simulation/AnalogTriggerData.h +64 -0
  67. native/wpihal/include/hal/simulation/CTREPCMData.h +78 -0
  68. native/wpihal/include/hal/simulation/CanData.h +71 -0
  69. native/wpihal/include/hal/simulation/DIOData.h +60 -0
  70. native/wpihal/include/hal/simulation/DigitalPWMData.h +46 -0
  71. native/wpihal/include/hal/simulation/DriverStationData.h +173 -0
  72. native/wpihal/include/hal/simulation/DutyCycleData.h +51 -0
  73. native/wpihal/include/hal/simulation/EncoderData.h +102 -0
  74. native/wpihal/include/hal/simulation/I2CData.h +36 -0
  75. native/wpihal/include/hal/simulation/MockHooks.h +41 -0
  76. native/wpihal/include/hal/simulation/NotifierData.h +35 -0
  77. native/wpihal/include/hal/simulation/NotifyListener.h +37 -0
  78. native/wpihal/include/hal/simulation/PWMData.h +66 -0
  79. native/wpihal/include/hal/simulation/PowerDistributionData.h +60 -0
  80. native/wpihal/include/hal/simulation/REVPHData.h +82 -0
  81. native/wpihal/include/hal/simulation/RelayData.h +53 -0
  82. native/wpihal/include/hal/simulation/Reset.h +7 -0
  83. native/wpihal/include/hal/simulation/RoboRioData.h +169 -0
  84. native/wpihal/include/hal/simulation/SPIAccelerometerData.h +60 -0
  85. native/wpihal/include/hal/simulation/SPIData.h +46 -0
  86. native/wpihal/include/hal/simulation/SimCallbackRegistry.h +195 -0
  87. native/wpihal/include/hal/simulation/SimDataValue.h +337 -0
  88. native/wpihal/include/hal/simulation/SimDeviceData.h +92 -0
  89. native/wpihal/lib/wpiHal.dll +0 -0
  90. native/wpihal/lib/wpiHal.lib +0 -0
  91. native/wpihal/robotpy-native-wpihal.pc +11 -0
  92. robotpy_native_wpihal-2025.3.2.dist-info/METADATA +6 -0
  93. robotpy_native_wpihal-2025.3.2.dist-info/RECORD +95 -0
  94. robotpy_native_wpihal-2025.3.2.dist-info/WHEEL +4 -0
  95. robotpy_native_wpihal-2025.3.2.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,22 @@
1
+ # This file is automatically generated, DO NOT EDIT
2
+ # fmt: off
3
+
4
+ import native.wpiutil._init_robotpy_native_wpiutil
5
+
6
+ def __load_library():
7
+ from os.path import abspath, join, dirname, exists
8
+ from ctypes import cdll
9
+
10
+ root = abspath(dirname(__file__))
11
+
12
+ lib_path = join(root, 'lib', 'wpiHal.dll')
13
+
14
+ try:
15
+ return cdll.LoadLibrary(lib_path)
16
+ except FileNotFoundError:
17
+ if not exists(lib_path):
18
+ raise FileNotFoundError("wpiHal.dll was not found on your system. Is this package correctly installed?")
19
+ raise Exception("wpiHal.dll could not be loaded. Do you have Visual Studio C++ Redistributible installed?")
20
+
21
+ __lib = __load_library()
22
+
@@ -0,0 +1,73 @@
1
+ Checks:
2
+ 'bugprone-assert-side-effect,
3
+ bugprone-bool-pointer-implicit-conversion,
4
+ bugprone-copy-constructor-init,
5
+ bugprone-dangling-handle,
6
+ bugprone-dynamic-static-initializers,
7
+ bugprone-exception-escape,
8
+ bugprone-forward-declaration-namespace,
9
+ bugprone-forwarding-reference-overload,
10
+ bugprone-inaccurate-erase,
11
+ bugprone-incorrect-roundings,
12
+ bugprone-integer-division,
13
+ bugprone-lambda-function-name,
14
+ bugprone-misplaced-operator-in-strlen-in-alloc,
15
+ bugprone-misplaced-widening-cast,
16
+ bugprone-move-forwarding-reference,
17
+ bugprone-multiple-statement-macro,
18
+ bugprone-parent-virtual-call,
19
+ bugprone-posix-return,
20
+ bugprone-sizeof-container,
21
+ bugprone-sizeof-expression,
22
+ bugprone-spuriously-wake-up-functions,
23
+ bugprone-string-constructor,
24
+ bugprone-string-integer-assignment,
25
+ bugprone-string-literal-with-embedded-nul,
26
+ bugprone-suspicious-enum-usage,
27
+ bugprone-suspicious-include,
28
+ bugprone-suspicious-memset-usage,
29
+ bugprone-suspicious-missing-comma,
30
+ bugprone-suspicious-semicolon,
31
+ bugprone-suspicious-string-compare,
32
+ bugprone-throw-keyword-missing,
33
+ bugprone-too-small-loop-variable,
34
+ bugprone-undefined-memory-manipulation,
35
+ bugprone-undelegated-constructor,
36
+ bugprone-unhandled-self-assignment,
37
+ bugprone-unused-raii,
38
+ bugprone-virtual-near-miss,
39
+ cert-err52-cpp,
40
+ cert-err60-cpp,
41
+ cert-mem57-cpp,
42
+ cert-oop57-cpp,
43
+ cert-oop58-cpp,
44
+ clang-diagnostic-*,
45
+ -clang-diagnostic-deprecated-declarations,
46
+ -clang-diagnostic-#warnings,
47
+ -clang-diagnostic-pedantic,
48
+ clang-analyzer-*,
49
+ cppcoreguidelines-slicing,
50
+ google-build-namespaces,
51
+ google-explicit-constructor,
52
+ google-global-names-in-headers,
53
+ google-readability-avoid-underscore-in-googletest-name,
54
+ google-readability-casting,
55
+ google-runtime-operator,
56
+ misc-definitions-in-headers,
57
+ misc-misplaced-const,
58
+ misc-new-delete-overloads,
59
+ misc-non-copyable-objects,
60
+ modernize-avoid-bind,
61
+ modernize-concat-nested-namespaces,
62
+ modernize-make-shared,
63
+ modernize-make-unique,
64
+ modernize-pass-by-value,
65
+ modernize-use-default-member-init,
66
+ modernize-use-noexcept,
67
+ modernize-use-nullptr,
68
+ modernize-use-override,
69
+ readability-braces-around-statements'
70
+ FormatStyle: file
71
+ CheckOptions:
72
+ - key: bugprone-dangling-handle
73
+ value: 'std::string_view'
@@ -0,0 +1,74 @@
1
+ // Copyright (c) FIRST and other WPILib contributors.
2
+ // Open Source Software; you can modify and/or share it under the terms of
3
+ // the WPILib BSD license file in the root directory of this project.
4
+
5
+ #pragma once
6
+
7
+ #include "hal/Types.h"
8
+
9
+ /**
10
+ * @defgroup hal_accelerometer Accelerometer Functions
11
+ * @ingroup hal_capi
12
+ * @{
13
+ */
14
+
15
+ /**
16
+ * The acceptable accelerometer ranges.
17
+ */
18
+ HAL_ENUM(HAL_AccelerometerRange) {
19
+ HAL_AccelerometerRange_k2G = 0,
20
+ HAL_AccelerometerRange_k4G = 1,
21
+ HAL_AccelerometerRange_k8G = 2,
22
+ };
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+ /**
28
+ * Sets the accelerometer to active or standby mode.
29
+ *
30
+ * It must be in standby mode to change any configuration.
31
+ *
32
+ * @param active true to set to active, false for standby
33
+ */
34
+ void HAL_SetAccelerometerActive(HAL_Bool active);
35
+
36
+ /**
37
+ * Sets the range of values that can be measured (either 2, 4, or 8 g-forces).
38
+ *
39
+ * The accelerometer should be in standby mode when this is called.
40
+ *
41
+ * @param range the accelerometer range
42
+ */
43
+ void HAL_SetAccelerometerRange(HAL_AccelerometerRange range);
44
+
45
+ /**
46
+ * Gets the x-axis acceleration.
47
+ *
48
+ * This is a floating point value in units of 1 g-force.
49
+ *
50
+ * @return the X acceleration
51
+ */
52
+ double HAL_GetAccelerometerX(void);
53
+
54
+ /**
55
+ * Gets the y-axis acceleration.
56
+ *
57
+ * This is a floating point value in units of 1 g-force.
58
+ *
59
+ * @return the Y acceleration
60
+ */
61
+ double HAL_GetAccelerometerY(void);
62
+
63
+ /**
64
+ * Gets the z-axis acceleration.
65
+ *
66
+ * This is a floating point value in units of 1 g-force.
67
+ *
68
+ * @return the Z acceleration
69
+ */
70
+ double HAL_GetAccelerometerZ(void);
71
+ #ifdef __cplusplus
72
+ } // extern "C"
73
+ /** @} */
74
+ #endif
@@ -0,0 +1,145 @@
1
+ // Copyright (c) FIRST and other WPILib contributors.
2
+ // Open Source Software; you can modify and/or share it under the terms of
3
+ // the WPILib BSD license file in the root directory of this project.
4
+
5
+ #pragma once
6
+
7
+ #include <stdint.h>
8
+
9
+ #include "hal/AddressableLEDTypes.h"
10
+ #include "hal/Types.h"
11
+
12
+ /**
13
+ * @defgroup hal_addressable Addressable LED Functions
14
+ * @ingroup hal_capi
15
+ * @{
16
+ */
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ /**
23
+ * Initialize Addressable LED using a PWM Digital handle.
24
+ *
25
+ * @param[in] outputPort handle of the digital port for PWM
26
+ * @param[out] status the error code, or 0 for success
27
+ * @return Addressable LED handle
28
+ */
29
+ HAL_AddressableLEDHandle HAL_InitializeAddressableLED(
30
+ HAL_DigitalHandle outputPort, int32_t* status);
31
+
32
+ /**
33
+ * Free the Addressable LED Handle.
34
+ *
35
+ * @param[in] handle the Addressable LED handle to free
36
+ */
37
+ void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle);
38
+
39
+ /**
40
+ * Sets the color order for the addressable LED output. The default order is
41
+ * GRB. This will take effect on the next call to HAL_WriteAddressableLEDData().
42
+ * @param[in] handle the Addressable LED handle
43
+ * @param[in] colorOrder the color order
44
+ * @param[out] status the error code, or 0 for success
45
+ */
46
+ void HAL_SetAddressableLEDColorOrder(HAL_AddressableLEDHandle handle,
47
+ HAL_AddressableLEDColorOrder colorOrder,
48
+ int32_t* status);
49
+
50
+ /**
51
+ * Set the Addressable LED PWM Digital port.
52
+ *
53
+ * @param[in] handle the Addressable LED handle
54
+ * @param[in] outputPort The digital handle of the PWM port
55
+ * @param[out] status the error code, or 0 for success
56
+ */
57
+ void HAL_SetAddressableLEDOutputPort(HAL_AddressableLEDHandle handle,
58
+ HAL_DigitalHandle outputPort,
59
+ int32_t* status);
60
+
61
+ /**
62
+ * Sets the length of the LED strip.
63
+ *
64
+ * <p>The max length is 5460 LEDs.
65
+ *
66
+ * @param[in] handle the Addressable LED handle
67
+ * @param[in] length the strip length
68
+ * @param[out] status the error code, or 0 for success
69
+ */
70
+ void HAL_SetAddressableLEDLength(HAL_AddressableLEDHandle handle,
71
+ int32_t length, int32_t* status);
72
+
73
+ /**
74
+ * Sets the led output data.
75
+ *
76
+ * <p>If the output is enabled, this will start writing the next data cycle.
77
+ * It is safe to call, even while output is enabled.
78
+ *
79
+ * @param[in] handle the Addressable LED handle
80
+ * @param[in] data the buffer to write
81
+ * @param[in] length the strip length
82
+ * @param[out] status the error code, or 0 for success
83
+ */
84
+ void HAL_WriteAddressableLEDData(HAL_AddressableLEDHandle handle,
85
+ const struct HAL_AddressableLEDData* data,
86
+ int32_t length, int32_t* status);
87
+
88
+ /**
89
+ * Sets the bit timing.
90
+ *
91
+ * <p>By default, the driver is set up to drive WS2812B and WS2815, so nothing
92
+ * needs to be set for those.
93
+ *
94
+ * @param[in] handle the Addressable LED handle
95
+ * @param[in] highTime0NanoSeconds high time for 0 bit (default 400ns)
96
+ * @param[in] lowTime0NanoSeconds low time for 0 bit (default 900ns)
97
+ * @param[in] highTime1NanoSeconds high time for 1 bit (default 900ns)
98
+ * @param[in] lowTime1NanoSeconds low time for 1 bit (default 600ns)
99
+ * @param[out] status the error code, or 0 for success
100
+ */
101
+ void HAL_SetAddressableLEDBitTiming(HAL_AddressableLEDHandle handle,
102
+ int32_t highTime0NanoSeconds,
103
+ int32_t lowTime0NanoSeconds,
104
+ int32_t highTime1NanoSeconds,
105
+ int32_t lowTime1NanoSeconds,
106
+ int32_t* status);
107
+
108
+ /**
109
+ * Sets the sync time.
110
+ *
111
+ * <p>The sync time is the time to hold output so LEDs enable. Default set for
112
+ * WS2812B and WS2815.
113
+ *
114
+ * @param[in] handle the Addressable LED handle
115
+ * @param[in] syncTimeMicroSeconds the sync time (default 280us)
116
+ * @param[out] status the error code, or 0 for success
117
+ */
118
+ void HAL_SetAddressableLEDSyncTime(HAL_AddressableLEDHandle handle,
119
+ int32_t syncTimeMicroSeconds,
120
+ int32_t* status);
121
+
122
+ /**
123
+ * Starts the output.
124
+ *
125
+ * <p>The output writes continuously.
126
+ *
127
+ * @param[in] handle the Addressable LED handle
128
+ * @param[out] status the error code, or 0 for success
129
+ */
130
+ void HAL_StartAddressableLEDOutput(HAL_AddressableLEDHandle handle,
131
+ int32_t* status);
132
+
133
+ /**
134
+ * Stops the output.
135
+ *
136
+ * @param[in] handle the Addressable LED handle
137
+ * @param[out] status the error code, or 0 for success
138
+ */
139
+ void HAL_StopAddressableLEDOutput(HAL_AddressableLEDHandle handle,
140
+ int32_t* status);
141
+
142
+ #ifdef __cplusplus
143
+ } // extern "C"
144
+ #endif
145
+ /** @} */
@@ -0,0 +1,37 @@
1
+ // Copyright (c) FIRST and other WPILib contributors.
2
+ // Open Source Software; you can modify and/or share it under the terms of
3
+ // the WPILib BSD license file in the root directory of this project.
4
+
5
+ #pragma once
6
+
7
+ #include <hal/Types.h>
8
+ #include <stdint.h>
9
+
10
+ /** max length of LED strip supported by FPGA. */
11
+ #define HAL_kAddressableLEDMaxLength 5460
12
+
13
+ /** structure for holding one LED's color data. */
14
+ struct HAL_AddressableLEDData {
15
+ uint8_t b; ///< blue value
16
+ uint8_t g; ///< green value
17
+ uint8_t r; ///< red value
18
+ uint8_t padding;
19
+ };
20
+
21
+ /**
22
+ * Order that color data is sent over the wire.
23
+ */
24
+ HAL_ENUM(HAL_AddressableLEDColorOrder) {
25
+ HAL_ALED_RGB,
26
+ HAL_ALED_RBG,
27
+ HAL_ALED_BGR,
28
+ HAL_ALED_BRG,
29
+ HAL_ALED_GBR,
30
+ HAL_ALED_GRB
31
+ };
32
+
33
+ #ifdef __cplusplus
34
+ constexpr auto format_as(HAL_AddressableLEDColorOrder order) {
35
+ return static_cast<int32_t>(order);
36
+ }
37
+ #endif
@@ -0,0 +1,120 @@
1
+ // Copyright (c) FIRST and other WPILib contributors.
2
+ // Open Source Software; you can modify and/or share it under the terms of
3
+ // the WPILib BSD license file in the root directory of this project.
4
+
5
+ #pragma once
6
+
7
+ #include <stdint.h>
8
+
9
+ #include "hal/Types.h"
10
+
11
+ /**
12
+ * @defgroup hal_analogaccumulator Analog Accumulator Functions
13
+ * @ingroup hal_capi
14
+ * @{
15
+ */
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ /**
22
+ * Is the channel attached to an accumulator.
23
+ *
24
+ * @param[in] analogPortHandle Handle to the analog port.
25
+ * @param[out] status Error status variable. 0 on success.
26
+ * @return The analog channel is attached to an accumulator.
27
+ */
28
+ HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
29
+ int32_t* status);
30
+
31
+ /**
32
+ * Initialize the accumulator.
33
+ *
34
+ * @param[in] analogPortHandle Handle to the analog port.
35
+ * @param[out] status Error status variable. 0 on success.
36
+ */
37
+ void HAL_InitAccumulator(HAL_AnalogInputHandle analogPortHandle,
38
+ int32_t* status);
39
+
40
+ /**
41
+ * Resets the accumulator to the initial value.
42
+ *
43
+ * @param[in] analogPortHandle Handle to the analog port.
44
+ * @param[out] status Error status variable. 0 on success.
45
+ */
46
+ void HAL_ResetAccumulator(HAL_AnalogInputHandle analogPortHandle,
47
+ int32_t* status);
48
+
49
+ /**
50
+ * Set the center value of the accumulator.
51
+ *
52
+ * The center value is subtracted from each A/D value before it is added to the
53
+ * accumulator. This is used for the center value of devices like gyros and
54
+ * accelerometers to make integration work and to take the device offset into
55
+ * account when integrating.
56
+ *
57
+ * This center value is based on the output of the oversampled and averaged
58
+ * source from channel 1. Because of this, any non-zero oversample bits will
59
+ * affect the size of the value for this field.
60
+ *
61
+ * @param[in] analogPortHandle Handle to the analog port.
62
+ * @param[in] center The center value of the accumulator.
63
+ * @param[out] status Error status variable. 0 on success.
64
+ */
65
+ void HAL_SetAccumulatorCenter(HAL_AnalogInputHandle analogPortHandle,
66
+ int32_t center, int32_t* status);
67
+
68
+ /**
69
+ * Set the accumulator's deadband.
70
+ *
71
+ * @param[in] analogPortHandle Handle to the analog port.
72
+ * @param[in] deadband The deadband of the accumulator.
73
+ * @param[out] status Error status variable. 0 on success.
74
+ */
75
+ void HAL_SetAccumulatorDeadband(HAL_AnalogInputHandle analogPortHandle,
76
+ int32_t deadband, int32_t* status);
77
+
78
+ /**
79
+ * Read the accumulated value.
80
+ *
81
+ * Read the value that has been accumulating on channel 1.
82
+ * The accumulator is attached after the oversample and average engine.
83
+ *
84
+ * @param[in] analogPortHandle Handle to the analog port.
85
+ * @param[out] status Error status variable. 0 on success.
86
+ * @return The 64-bit value accumulated since the last Reset().
87
+ */
88
+ int64_t HAL_GetAccumulatorValue(HAL_AnalogInputHandle analogPortHandle,
89
+ int32_t* status);
90
+
91
+ /**
92
+ * Read the number of accumulated values.
93
+ *
94
+ * Read the count of the accumulated values since the accumulator was last
95
+ * Reset().
96
+ *
97
+ * @param[in] analogPortHandle Handle to the analog port.
98
+ * @param[out] status Error status variable. 0 on success.
99
+ * @return The number of times samples from the channel were accumulated.
100
+ */
101
+ int64_t HAL_GetAccumulatorCount(HAL_AnalogInputHandle analogPortHandle,
102
+ int32_t* status);
103
+
104
+ /**
105
+ * Read the accumulated value and the number of accumulated values atomically.
106
+ *
107
+ * This function reads the value and count from the FPGA atomically.
108
+ * This can be used for averaging.
109
+ *
110
+ * @param[in] analogPortHandle Handle to the analog port.
111
+ * @param[in] value Pointer to the 64-bit accumulated output.
112
+ * @param[in] count Pointer to the number of accumulation cycles.
113
+ * @param[out] status Error status variable. 0 on success.
114
+ */
115
+ void HAL_GetAccumulatorOutput(HAL_AnalogInputHandle analogPortHandle,
116
+ int64_t* value, int64_t* count, int32_t* status);
117
+ #ifdef __cplusplus
118
+ } // extern "C"
119
+ #endif
120
+ /** @} */
@@ -0,0 +1,149 @@
1
+ // Copyright (c) FIRST and other WPILib contributors.
2
+ // Open Source Software; you can modify and/or share it under the terms of
3
+ // the WPILib BSD license file in the root directory of this project.
4
+
5
+ #pragma once
6
+
7
+ #include <stdint.h>
8
+
9
+ #include "hal/Types.h"
10
+
11
+ /**
12
+ * @defgroup hal_analoggyro Analog Gyro Functions
13
+ * @ingroup hal_capi
14
+ * @{
15
+ */
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ /**
22
+ * Initializes an analog gyro.
23
+ *
24
+ * @param[in] handle handle to the analog input port
25
+ * @param[in] allocationLocation the location where the allocation is occurring
26
+ * (can be null)
27
+ * @param[out] status the error code, or 0 for success
28
+ * @return the initialized gyro handle
29
+ */
30
+ HAL_GyroHandle HAL_InitializeAnalogGyro(HAL_AnalogInputHandle handle,
31
+ const char* allocationLocation,
32
+ int32_t* status);
33
+
34
+ /**
35
+ * Sets up an analog gyro with the proper offsets and settings for the KOP
36
+ * analog gyro.
37
+ *
38
+ * @param[in] handle the gyro handle
39
+ * @param[out] status the error code, or 0 for success
40
+ */
41
+ void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status);
42
+
43
+ /**
44
+ * Frees an analog gyro.
45
+ *
46
+ * @param handle the gyro handle
47
+ */
48
+ void HAL_FreeAnalogGyro(HAL_GyroHandle handle);
49
+
50
+ /**
51
+ * Sets the analog gyro parameters to the specified values.
52
+ *
53
+ * This is meant to be used if you want to reuse the values from a previous
54
+ * calibration.
55
+ *
56
+ * @param[in] handle the gyro handle
57
+ * @param[in] voltsPerDegreePerSecond the gyro volts scaling
58
+ * @param[in] offset the gyro offset
59
+ * @param[in] center the gyro center
60
+ * @param[out] status the error code, or 0 for success
61
+ */
62
+ void HAL_SetAnalogGyroParameters(HAL_GyroHandle handle,
63
+ double voltsPerDegreePerSecond, double offset,
64
+ int32_t center, int32_t* status);
65
+
66
+ /**
67
+ * Sets the analog gyro volts per degrees per second scaling.
68
+ *
69
+ * @param[in] handle the gyro handle
70
+ * @param[in] voltsPerDegreePerSecond the gyro volts scaling
71
+ * @param[out] status the error code, or 0 for success
72
+ */
73
+ void HAL_SetAnalogGyroVoltsPerDegreePerSecond(HAL_GyroHandle handle,
74
+ double voltsPerDegreePerSecond,
75
+ int32_t* status);
76
+
77
+ /**
78
+ * Resets the analog gyro value to 0.
79
+ *
80
+ * @param[in] handle the gyro handle
81
+ * @param[out] status the error code, or 0 for success
82
+ */
83
+ void HAL_ResetAnalogGyro(HAL_GyroHandle handle, int32_t* status);
84
+
85
+ /**
86
+ * Calibrates the analog gyro.
87
+ *
88
+ * This happens by calculating the average value of the gyro over 5 seconds, and
89
+ * setting that as the center. Note that this call blocks for 5 seconds to
90
+ * perform this.
91
+ *
92
+ * @param[in] handle the gyro handle
93
+ * @param[out] status Error status variable. 0 on success.
94
+ */
95
+ void HAL_CalibrateAnalogGyro(HAL_GyroHandle handle, int32_t* status);
96
+
97
+ /**
98
+ * Sets the deadband of the analog gyro.
99
+ *
100
+ * @param[in] handle the gyro handle
101
+ * @param[in] volts the voltage deadband
102
+ * @param[out] status Error status variable. 0 on success.
103
+ */
104
+ void HAL_SetAnalogGyroDeadband(HAL_GyroHandle handle, double volts,
105
+ int32_t* status);
106
+
107
+ /**
108
+ * Gets the gyro angle in degrees.
109
+ *
110
+ * @param[in] handle the gyro handle
111
+ * @param[out] status Error status variable. 0 on success.
112
+ * @return the gyro angle in degrees
113
+ */
114
+ double HAL_GetAnalogGyroAngle(HAL_GyroHandle handle, int32_t* status);
115
+
116
+ /**
117
+ * Gets the gyro rate in degrees/second.
118
+ *
119
+ * @param[in] handle the gyro handle
120
+ * @param[out] status Error status variable. 0 on success.
121
+ * @return the gyro rate in degrees/second
122
+ */
123
+ double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status);
124
+
125
+ /**
126
+ * Gets the calibrated gyro offset.
127
+ *
128
+ * Can be used to not repeat a calibration but reconstruct the gyro object.
129
+ *
130
+ * @param[in] handle the gyro handle
131
+ * @param[out] status Error status variable. 0 on success.
132
+ * @return the gyro offset
133
+ */
134
+ double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status);
135
+
136
+ /**
137
+ * Gets the calibrated gyro center.
138
+ *
139
+ * Can be used to not repeat a calibration but reconstruct the gyro object.
140
+ *
141
+ * @param[in] handle the gyro handle
142
+ * @param[out] status Error status variable. 0 on success.
143
+ * @return the gyro center
144
+ */
145
+ int32_t HAL_GetAnalogGyroCenter(HAL_GyroHandle handle, int32_t* status);
146
+ #ifdef __cplusplus
147
+ } // extern "C"
148
+ #endif
149
+ /** @} */