mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
HAL: Use extern "C" in implementation files.
This turns accidental parameter mismatches between header and implementation into compiler errors. Change-Id: Ic26fabb82b2fd5f79407a11435cdbd35348af15f
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
static const int NUM_MODULE_NUMBERS = 63;
|
||||
|
||||
PCM *modules[NUM_MODULE_NUMBERS] = { NULL };
|
||||
PCM *PCM_modules[NUM_MODULE_NUMBERS] = { NULL };
|
||||
|
||||
struct solenoid_port_t {
|
||||
PCM *module;
|
||||
@@ -17,17 +17,19 @@ struct solenoid_port_t {
|
||||
};
|
||||
|
||||
void initializePCM(int module) {
|
||||
if(!modules[module]) {
|
||||
modules[module] = new PCM(module);
|
||||
if(!PCM_modules[module]) {
|
||||
PCM_modules[module] = new PCM(module);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
void* initializeSolenoidPort(void *port_pointer, int32_t *status) {
|
||||
Port* port = (Port*) port_pointer;
|
||||
initializePCM(port->module);
|
||||
|
||||
solenoid_port_t *solenoid_port = new solenoid_port_t;
|
||||
solenoid_port->module = modules[port->module];
|
||||
solenoid_port->module = PCM_modules[port->module];
|
||||
solenoid_port->pin = port->pin;
|
||||
|
||||
return solenoid_port;
|
||||
@@ -95,3 +97,5 @@ void clearAllPCMStickyFaults_sol(void *solenoid_port_pointer, int32_t *status){
|
||||
|
||||
*status = port->module->ClearStickyFaults();
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user