Add multi PDP getter and sim PCM/PDP multi arg functions (#2014)

This commit is contained in:
Thad House
2019-11-01 21:55:35 -07:00
committed by Peter Johnson
parent 931b8ceefd
commit 2ad15cae19
11 changed files with 174 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -42,6 +42,20 @@ DEFINE_CAPI(double, Voltage, voltage)
HAL_SIMDATAVALUE_DEFINE_CAPI_CHANNEL(double, HALSIM, PDPCurrent, SimPDPData,
current)
void HALSIM_GetPDPAllCurrents(int32_t index, double* currents) {
auto& data = SimPDPData[index].current;
for (int i = 0; i < kNumPDPChannels; i++) {
currents[i] = data[i];
}
}
void HALSIM_SetPDPAllCurrents(int32_t index, const double* currents) {
auto& data = SimPDPData[index].current;
for (int i = 0; i < kNumPDPChannels; i++) {
data[i] = currents[i];
}
}
#define REGISTER(NAME) \
SimPDPData[index].NAME.RegisterCallback(callback, param, initialNotify)