mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
CtreCanNode registers the periodic tx messages and provides an rx function to child classes for easy getters and setters. Some template magic to make the PDP and PCM getters/setters easy to stamp out. Change-Id: Ibdd0745af070756a282df5074504491fadfde336
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#ifndef PDP_H_
|
|
#define PDP_H_
|
|
#include "ctre.h" //BIT Defines + Typedefs
|
|
#include <NetworkCommunication/CANSessionMux.h> //CAN Comm
|
|
#include "CtreCanNode.h"
|
|
#include <pthread.h>
|
|
class PDP : public CtreCanNode
|
|
{
|
|
public:
|
|
/* Get PDP Channel Current
|
|
*
|
|
* @Param - deviceNumber - Device ID for PDP. Factory default is 60. Function defaults to 60.
|
|
*/
|
|
PDP(UINT8 deviceNumber=0);
|
|
~PDP();
|
|
/* Get PDP Channel Current
|
|
*
|
|
* @Return - CTR_Code - Error code (if any)
|
|
*
|
|
* @Param - idx - ID of channel to return current for (channels 1-16)
|
|
*
|
|
* @Param - status - Current of channel 'idx' in Amps (A)
|
|
*/
|
|
CTR_Code GetChannelCurrent(UINT8 idx, double &status);
|
|
|
|
/* Get Bus Voltage of PDP
|
|
*
|
|
* @Return - CTR_Code - Error code (if any)
|
|
*
|
|
* @Param - status - Voltage (V) across PDP
|
|
*/
|
|
CTR_Code GetVoltage(double &status);
|
|
|
|
/* Get Temperature of PDP
|
|
*
|
|
* @Return - CTR_Code - Error code (if any)
|
|
*
|
|
* @Param - status - Temperature of PDP in Centigrade / Celcius (C)
|
|
*/
|
|
CTR_Code GetTemperature(double &status);
|
|
private:
|
|
uint64_t ReadCurrents(uint8_t api);
|
|
};
|
|
extern "C" {
|
|
void * c_PDP_Init();
|
|
CTR_Code c_GetChannelCurrent(void * handle,UINT8 idx, double *status);
|
|
CTR_Code c_GetVoltage(void * handle,double *status);
|
|
CTR_Code c_GetTemperature(void * handle,double *status);
|
|
void c_SetDeviceNumber_PDP(void * handle,UINT8 deviceNumber);
|
|
}
|
|
#endif /* PDP_H_ */
|