blob: 52f0f75784c36bca4887bc1ac5d0df5824c6bbe5 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#pragma once
9
10#include <stdint.h>
11
12#include <memory>
13
14#include "PortsInternal.h"
15#include "ctre/PCM.h"
16#include "hal/Errors.h"
17#include "hal/Ports.h"
18#include "hal/Solenoid.h"
19
20namespace hal {
21
22extern std::unique_ptr<PCM> PCM_modules[kNumPCMModules];
23
24static inline bool checkPCMInit(int32_t module, int32_t* status) {
25 if (!HAL_CheckSolenoidModule(module)) {
26 *status = RESOURCE_OUT_OF_RANGE;
27 return false;
28 }
29 if (!PCM_modules[module]) {
30 *status = INCOMPATIBLE_STATE;
31 return false;
32 }
33 return true;
34}
35
36void initializePCM(int32_t module, int32_t* status);
37
38} // namespace hal