blob: 334e8d4ea34b5f224d9d492c5c147de05bdb0d39 [file] [log] [blame]
Brian Silverman1a675112016-02-20 20:42:49 -05001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2016. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
Brian Silverman26e4e522015-12-17 01:56:40 -05008#include "HAL/PDP.hpp"
9#include "ctre/PDP.h"
10//static PDP pdp;
11
12static const int NUM_MODULE_NUMBERS = 63;
13
14static PDP *pdp[NUM_MODULE_NUMBERS] = { NULL };
15
Brian Silverman1a675112016-02-20 20:42:49 -050016extern "C" {
17
Brian Silverman26e4e522015-12-17 01:56:40 -050018void initializePDP(uint8_t module) {
19 if(!pdp[module]) {
20 pdp[module] = new PDP(module);
21 }
22}
23
24double getPDPTemperature(uint8_t module, int32_t *status) {
25 double temperature;
26
27 *status = pdp[module]->GetTemperature(temperature);
28
29 return temperature;
30}
31
32double getPDPVoltage(uint8_t module, int32_t *status) {
33 double voltage;
34
35 *status = pdp[module]->GetVoltage(voltage);
36
37 return voltage;
38}
39
40double getPDPChannelCurrent(uint8_t module, uint8_t channel, int32_t *status) {
41 double current;
42
43 *status = pdp[module]->GetChannelCurrent(channel, current);
44
45 return current;
46}
47
48double getPDPTotalCurrent(uint8_t module, int32_t *status) {
49 double current;
50
51 *status = pdp[module]->GetTotalCurrent(current);
52
53 return current;
54}
55
56double getPDPTotalPower(uint8_t module, int32_t *status) {
57 double power;
58
59 *status = pdp[module]->GetTotalPower(power);
60
61 return power;
62}
63
64double getPDPTotalEnergy(uint8_t module, int32_t *status) {
65 double energy;
66
67 *status = pdp[module]->GetTotalEnergy(energy);
68
69 return energy;
70}
71
72void resetPDPTotalEnergy(uint8_t module, int32_t *status) {
73 *status = pdp[module]->ResetEnergy();
74}
75
76void clearPDPStickyFaults(uint8_t module, int32_t *status) {
77 *status = pdp[module]->ClearStickyFaults();
78}
79
Brian Silverman1a675112016-02-20 20:42:49 -050080} // extern "C"