blob: b4c322c5cf3ca88447ebcd5fa7477e44732bd5a5 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
5/*----------------------------------------------------------------------------*/
6
7#ifndef SOLENOID_BASE_H_
8#define SOLENOID_BASE_H_
9
10#include "Resource.h"
11#include "SensorBase.h"
12#include "ChipObject.h"
13#include "Synchronized.h"
14
15/**
16 * SolenoidBase class is the common base class for the Solenoid and
17 * DoubleSolenoid classes.
18 */
19class SolenoidBase : public SensorBase {
20public:
21 virtual ~SolenoidBase();
22 UINT8 GetAll();
23
24protected:
25 explicit SolenoidBase(UINT8 moduleNumber);
26 void Set(UINT8 value, UINT8 mask);
27 virtual void InitSolenoid() = 0;
28
29 UINT32 m_moduleNumber; ///< Slot number where the module is plugged into the chassis.
30 static Resource *m_allocated;
31
32private:
33 static tSolenoid *m_fpgaSolenoidModule; ///< FPGA Solenoid Module object.
34 static UINT32 m_refCount; ///< Reference count for the chip object.
35 static ReentrantSemaphore m_semaphore;
36};
37
38#endif