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:
Peter Johnson
2015-11-26 00:08:32 -08:00
parent e2ec34090a
commit 351e8599ac
15 changed files with 105 additions and 50 deletions

View File

@@ -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"