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
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <stdint.h>
#include "hal/Types.h"
/**
* @defgroup hal_power Power Functions
* @ingroup hal_capi
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Gets the roboRIO input voltage.
*
* @param[out] status the error code, or 0 for success
* @return the input voltage (volts)
*/
double HAL_GetVinVoltage(int32_t* status);
/**
* Gets the roboRIO input current.
*
* @param[out] status the error code, or 0 for success
* @return the input current (amps)
*/
double HAL_GetVinCurrent(int32_t* status);
/**
* Gets the 6V rail voltage.
*
* @param[out] status the error code, or 0 for success
* @return the 6V rail voltage (volts)
*/
double HAL_GetUserVoltage6V(int32_t* status);
/**
* Gets the 6V rail current.
*
* @param[out] status the error code, or 0 for success
* @return the 6V rail current (amps)
*/
double HAL_GetUserCurrent6V(int32_t* status);
/**
* Gets the active state of the 6V rail.
*
* @param[out] status the error code, or 0 for success
* @return true if the rail is active, otherwise false
*/
HAL_Bool HAL_GetUserActive6V(int32_t* status);
/**
* Gets the fault count for the 6V rail. Capped at 255.
*
* @param[out] status the error code, or 0 for success
* @return the number of 6V fault counts
*/
int32_t HAL_GetUserCurrentFaults6V(int32_t* status);
/**
* Enables or disables the 6V rail.
*
* @param enabled whether the rail should be enabled
* @param[out] status the error code, or 0 for success
*/
void HAL_SetUserRailEnabled6V(HAL_Bool enabled, int32_t* status);
/**
* Gets the 5V rail voltage.
*
* @param[out] status the error code, or 0 for success
* @return the 5V rail voltage (volts)
*/
double HAL_GetUserVoltage5V(int32_t* status);
/**
* Gets the 5V rail current.
*
* @param[out] status the error code, or 0 for success
* @return the 5V rail current (amps)
*/
double HAL_GetUserCurrent5V(int32_t* status);
/**
* Gets the active state of the 5V rail.
*
* @param[out] status the error code, or 0 for success
* @return true if the rail is active, otherwise false
*/
HAL_Bool HAL_GetUserActive5V(int32_t* status);
/**
* Gets the fault count for the 5V rail. Capped at 255.
*
* @param[out] status the error code, or 0 for success
* @return the number of 5V fault counts
*/
int32_t HAL_GetUserCurrentFaults5V(int32_t* status);
/**
* Enables or disables the 5V rail.
*
* @param enabled whether the rail should be enabled
* @param[out] status the error code, or 0 for success
*/
void HAL_SetUserRailEnabled5V(HAL_Bool enabled, int32_t* status);
/**
* Gets the 3V3 rail voltage.
*
* @param[out] status the error code, or 0 for success
* @return the 3V3 rail voltage (volts)
*/
double HAL_GetUserVoltage3V3(int32_t* status);
/**
* Gets the 3V3 rail current.
*
* @param[out] status the error code, or 0 for success
* @return the 3V3 rail current (amps)
*/
double HAL_GetUserCurrent3V3(int32_t* status);
/**
* Gets the active state of the 3V3 rail.
*
* @param[out] status the error code, or 0 for success
* @return true if the rail is active, otherwise false
*/
HAL_Bool HAL_GetUserActive3V3(int32_t* status);
/**
* Gets the fault count for the 3V3 rail. Capped at 255.
*
* @param[out] status the error code, or 0 for success
* @return the number of 3V3 fault counts
*/
int32_t HAL_GetUserCurrentFaults3V3(int32_t* status);
/**
* Enables or disables the 3V3 rail.
*
* @param enabled whether the rail should be enabled
* @param[out] status the error code, or 0 for success
*/
void HAL_SetUserRailEnabled3V3(HAL_Bool enabled, int32_t* status);
/**
* Resets the overcurrent fault counters for all user rails to 0.
* @param[out] status the error code, or 0 for success
*/
void HAL_ResetUserCurrentFaults(int32_t* status);
/**
* Get the current brownout voltage setting.
*
* @param[out] status the error code, or 0 for success
* @return The brownout voltage
*/
double HAL_GetBrownoutVoltage(int32_t* status);
/**
* Set the voltage the roboRIO will brownout and disable all outputs.
*
* Note that this only does anything on the roboRIO 2.
* On the roboRIO it is a no-op.
*
* @param[in] voltage The brownout voltage
* @param[out] status the error code, or 0 for success
*/
void HAL_SetBrownoutVoltage(double voltage, int32_t* status);
/**
* Get the current CPU temperature in degrees Celsius
*
* @param[out] status the error code, or 0 for success
* @return current CPU temperature in degrees Celsius
*/
double HAL_GetCPUTemp(int32_t* status);
#ifdef __cplusplus
} // extern "C"
#endif
/** @} */