blob: a9d076c7d6c497a8c6dbece8b57a291a50973d43 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001/*----------------------------------------------------------------------------*/
Austin Schuh1e69f942020-11-14 15:06:14 -08002/* Copyright (c) 2016-2020 FIRST. All Rights Reserved. */
Brian Silverman8fce7482020-01-05 13:18:21 -08003/* 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"
Brian Silverman8fce7482020-01-05 13:18:21 -080017#include "hal/Solenoid.h"
18
19namespace hal {
20
21extern std::unique_ptr<PCM> PCM_modules[kNumPCMModules];
22
23static inline bool checkPCMInit(int32_t module, int32_t* status) {
24 if (!HAL_CheckSolenoidModule(module)) {
25 *status = RESOURCE_OUT_OF_RANGE;
26 return false;
27 }
28 if (!PCM_modules[module]) {
29 *status = INCOMPATIBLE_STATE;
30 return false;
31 }
32 return true;
33}
34
35void initializePCM(int32_t module, int32_t* status);
36
37} // namespace hal