diff --git a/hal/lib/athena/Compressor.cpp b/hal/lib/athena/Compressor.cpp index b1407c6962..8e386bf9d3 100644 --- a/hal/lib/athena/Compressor.cpp +++ b/hal/lib/athena/Compressor.cpp @@ -8,13 +8,10 @@ #include "HAL/Compressor.h" #include "HAL/Errors.h" +#include "PCMInternal.h" #include "ctre/PCM.h" #include "handles/HandlesInternal.h" -static const int NUM_MODULE_NUMBERS = 63; -extern PCM* PCM_modules[NUM_MODULE_NUMBERS]; -extern void initializePCM(int module); - using namespace hal; extern "C" { diff --git a/hal/lib/athena/PCMInternal.cpp b/hal/lib/athena/PCMInternal.cpp new file mode 100644 index 0000000000..3101cc0a20 --- /dev/null +++ b/hal/lib/athena/PCMInternal.cpp @@ -0,0 +1,18 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#include "PCMInternal.h" + +namespace hal { +PCM* PCM_modules[NUM_MODULE_NUMBERS] = {nullptr}; + +void initializePCM(int module) { + if (!PCM_modules[module]) { + PCM_modules[module] = new PCM(module); + } +} +} diff --git a/hal/lib/athena/PCMInternal.h b/hal/lib/athena/PCMInternal.h new file mode 100644 index 0000000000..5acac0bbe1 --- /dev/null +++ b/hal/lib/athena/PCMInternal.h @@ -0,0 +1,21 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#pragma once + +#include + +#include "ctre/PCM.h" + +namespace hal { +constexpr int NUM_MODULE_NUMBERS = 63; +constexpr int NUM_SOLENOID_PINS = 8; + +extern PCM* PCM_modules[NUM_MODULE_NUMBERS]; + +void initializePCM(int module); +} diff --git a/hal/lib/athena/Solenoid.cpp b/hal/lib/athena/Solenoid.cpp index bfbfda5c26..aadb325b99 100644 --- a/hal/lib/athena/Solenoid.cpp +++ b/hal/lib/athena/Solenoid.cpp @@ -10,15 +10,11 @@ #include "ChipObject.h" #include "FRC_NetworkCommunication/LoadOut.h" #include "HAL/Errors.h" +#include "PCMInternal.h" #include "ctre/PCM.h" #include "handles/HandlesInternal.h" #include "handles/IndexedHandleResource.h" -static constexpr int NUM_MODULE_NUMBERS = 63; -static constexpr int NUM_SOLENOID_PINS = 8; - -PCM* PCM_modules[NUM_MODULE_NUMBERS] = {nullptr}; - namespace { struct Solenoid { uint8_t module; @@ -26,16 +22,11 @@ struct Solenoid { }; } -void initializePCM(int module) { - if (!PCM_modules[module]) { - PCM_modules[module] = new PCM(module); - } -} - using namespace hal; static IndexedHandleResource + NUM_MODULE_NUMBERS * NUM_SOLENOID_PINS, + HalHandleEnum::Solenoid> solenoidHandles; extern "C" {