blob: b968a4439e94ff5b043633c1af2d7cf1aee1d366 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001#ifndef PDP_H_
2#define PDP_H_
3#include "ctre.h" //BIT Defines + Typedefs
4#include "CtreCanNode.h"
5class PDP : public CtreCanNode
6{
7public:
8 /* Get PDP Channel Current
9 *
10 * @Param - deviceNumber - Device ID for PDP. Factory default is 60. Function defaults to 60.
11 */
12 PDP(UINT8 deviceNumber=0);
13 ~PDP();
14 /* Get PDP Channel Current
15 *
16 * @Return - CTR_Code - Error code (if any)
17 *
18 * @Param - idx - ID of channel to return current for (channels 1-16)
19 *
20 * @Param - status - Current of channel 'idx' in Amps (A)
21 */
22 CTR_Code GetChannelCurrent(UINT8 idx, double &status);
23
24 /* Get Bus Voltage of PDP
25 *
26 * @Return - CTR_Code - Error code (if any)
27 *
28 * @Param - status - Voltage (V) across PDP
29 */
30 CTR_Code GetVoltage(double &status);
31
32 /* Get Temperature of PDP
33 *
34 * @Return - CTR_Code - Error code (if any)
35 *
36 * @Param - status - Temperature of PDP in Centigrade / Celcius (C)
37 */
38 CTR_Code GetTemperature(double &status);
39
40 CTR_Code GetTotalCurrent(double &currentAmps);
41 CTR_Code GetTotalPower(double &powerWatts);
42 CTR_Code GetTotalEnergy(double &energyJoules);
43 /* Clear sticky faults.
44 * @Return - CTR_Code - Error code (if any)
45 */
46 CTR_Code ClearStickyFaults();
47
48 /* Reset Energy Signals
49 * @Return - CTR_Code - Error code (if any)
50 */
51 CTR_Code ResetEnergy();
52private:
53 uint64_t ReadCurrents(uint8_t api);
54};
55extern "C" {
56 void * c_PDP_Init();
57 CTR_Code c_GetChannelCurrent(void * handle,UINT8 idx, double *status);
58 CTR_Code c_GetVoltage(void * handle,double *status);
59 CTR_Code c_GetTemperature(void * handle,double *status);
60 void c_SetDeviceNumber_PDP(void * handle,UINT8 deviceNumber);
61}
62#endif /* PDP_H_ */