mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Updated the HAL, wpilibj, and wpilibc for PCM and PDP
Removed #if 0...#endif from PCM.cpp Change-Id: I2d117c87a3fa10bddebf83706f79c2e767d22a0d Update the HAL to the PCM/PDP changes Change-Id: If554b650e263f174e90864f1e9ffba91daf20f7e Update C++ to the PCM/PDP changes Change-Id: Ia3114d4526be1dc5cc2f74fd8f7ab44f204d15f2 Updated PCM/PDP in Java Change-Id: I8fe03afbcb1739d555e86abc0eaae1e12313d490
This commit is contained in:
@@ -8,39 +8,34 @@
|
||||
#include "NetworkCommunication/LoadOut.h"
|
||||
#include "ctre/PCM.h"
|
||||
|
||||
bool pcmModulesInitialized = false;
|
||||
static const int NUM_MODULE_NUMBERS = 63;
|
||||
|
||||
static const int NUM_PCMS = 2;
|
||||
PCM *modules[NUM_PCMS];
|
||||
PCM *modules[NUM_MODULE_NUMBERS] = { NULL };
|
||||
|
||||
struct solenoid_port_t {
|
||||
PCM *module;
|
||||
uint32_t pin;
|
||||
};
|
||||
|
||||
void initializePCM() {
|
||||
if(!pcmModulesInitialized) {
|
||||
modules[0] = new PCM(50);
|
||||
modules[1] = new PCM(51);
|
||||
|
||||
pcmModulesInitialized = true;
|
||||
void initializePCM(int module) {
|
||||
if(!modules[module]) {
|
||||
modules[module] = new PCM(module);
|
||||
}
|
||||
}
|
||||
|
||||
void* initializeSolenoidPort(void *port_pointer, int32_t *status) {
|
||||
initializePCM();
|
||||
|
||||
Port* port = (Port*) port_pointer;
|
||||
|
||||
initializePCM(port->module);
|
||||
|
||||
solenoid_port_t *solenoid_port = new solenoid_port_t;
|
||||
solenoid_port->module = modules[port->module - 1];
|
||||
solenoid_port->module = modules[port->module];
|
||||
solenoid_port->pin = port->pin;
|
||||
|
||||
return solenoid_port;
|
||||
}
|
||||
|
||||
bool checkSolenoidModule(uint8_t module) {
|
||||
return module > 0 and module <= NUM_PCMS;
|
||||
return module < NUM_MODULE_NUMBERS;
|
||||
}
|
||||
|
||||
bool getSolenoid(void* solenoid_port_pointer, int32_t *status) {
|
||||
|
||||
Reference in New Issue
Block a user