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) 2016-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2016-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. */
@@ -79,6 +79,17 @@ double HAL_GetPDPVoltage(HAL_PDPHandle handle, int32_t* status);
double HAL_GetPDPChannelCurrent(HAL_PDPHandle handle, int32_t channel,
int32_t* status);
/**
* Gets the current of all 16 channels on the PDP.
*
* The array must be large enough to hold all channels.
*
* @param handle the module handle
* @param current the currents (output)
*/
void HAL_GetPDPAllChannelCurrents(HAL_PDPHandle handle, double* currents,
int32_t* status);
/**
* Gets the total current of the PDP.
*

View File

@@ -74,6 +74,9 @@ void HALSIM_CancelPCMCompressorCurrentCallback(int32_t index, int32_t uid);
double HALSIM_GetPCMCompressorCurrent(int32_t index);
void HALSIM_SetPCMCompressorCurrent(int32_t index, double compressorCurrent);
void HALSIM_GetPCMAllSolenoids(int32_t index, uint8_t* values);
void HALSIM_SetPCMAllSolenoids(int32_t index, uint8_t values);
void HALSIM_RegisterPCMAllNonSolenoidCallbacks(int32_t index,
HAL_NotifyCallback callback,
void* param,

View File

@@ -46,6 +46,9 @@ void HALSIM_CancelPDPCurrentCallback(int32_t index, int32_t channel,
double HALSIM_GetPDPCurrent(int32_t index, int32_t channel);
void HALSIM_SetPDPCurrent(int32_t index, int32_t channel, double current);
void HALSIM_GetPDPAllCurrents(int32_t index, double* currents);
void HALSIM_SetPDPAllCurrents(int32_t index, const double* currents);
void HALSIM_RegisterPDPAllNonCurrentCallbacks(int32_t index, int32_t channel,
HAL_NotifyCallback callback,
void* param,

View File

@@ -138,6 +138,16 @@ class PCMSim {
HALSIM_SetPCMCompressorCurrent(m_index, compressorCurrent);
}
uint8_t GetAllSolenoidOutputs() {
uint8_t ret = 0;
HALSIM_GetPCMAllSolenoids(m_index, &ret);
return ret;
}
void SetAllSolenoidOutputs(uint8_t outputs) {
HALSIM_SetPCMAllSolenoids(m_index, outputs);
}
void ResetData() { HALSIM_ResetPCMData(m_index); }
private:

View File

@@ -79,6 +79,14 @@ class PDPSim {
HALSIM_SetPDPCurrent(m_index, channel, current);
}
void GetAllCurrents(double* currents) {
HALSIM_GetPDPAllCurrents(m_index, currents);
}
void SetAllCurrents(const double* currents) {
HALSIM_SetPDPAllCurrents(m_index, currents);
}
void ResetData() { HALSIM_ResetPDPData(m_index); }
private: