WPILib 2012
WPILibRoboticsLibraryforFRC
|
00001 /*----------------------------------------------------------------------------*/ 00002 /* Copyright (c) FIRST 2008. All Rights Reserved. */ 00003 /* Open Source Software - may be modified and shared by FRC teams. The code */ 00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ 00005 /*----------------------------------------------------------------------------*/ 00006 00007 #ifndef SENSORBASE_H_ 00008 #define SENSORBASE_H_ 00009 00010 #include "ChipObject/NiRio.h" 00011 #include "ErrorBase.h" 00012 #include <stdio.h> 00013 #include "Base.h" 00014 00020 class SensorBase: public ErrorBase { 00021 public: 00022 SensorBase(); 00023 virtual ~SensorBase(); 00024 static void DeleteSingletons(); 00025 static UINT32 GetDefaultAnalogModule() { return 1; } 00026 static UINT32 GetDefaultDigitalModule() { return 1; } 00027 static UINT32 GetDefaultSolenoidModule() { return 1; } 00028 static bool CheckAnalogModule(UINT8 moduleNumber); 00029 static bool CheckDigitalModule(UINT8 moduleNumber); 00030 static bool CheckPWMModule(UINT8 moduleNumber); 00031 static bool CheckRelayModule(UINT8 moduleNumber); 00032 static bool CheckSolenoidModule(UINT8 moduleNumber); 00033 static bool CheckDigitalChannel(UINT32 channel); 00034 static bool CheckRelayChannel(UINT32 channel); 00035 static bool CheckPWMChannel(UINT32 channel); 00036 static bool CheckAnalogChannel(UINT32 channel); 00037 static bool CheckSolenoidChannel(UINT32 channel); 00038 00039 static const UINT32 kSystemClockTicksPerMicrosecond = 40; 00040 static const UINT32 kDigitalChannels = 14; 00041 static const UINT32 kAnalogChannels = 8; 00042 static const UINT32 kAnalogModules = 2; 00043 static const UINT32 kDigitalModules = 2; 00044 static const UINT32 kSolenoidChannels = 8; 00045 static const UINT32 kSolenoidModules = 2; 00046 static const UINT32 kPwmChannels = 10; 00047 static const UINT32 kRelayChannels = 8; 00048 static const UINT32 kChassisSlots = 8; 00049 protected: 00050 void AddToSingletonList(); 00051 00052 private: 00053 DISALLOW_COPY_AND_ASSIGN(SensorBase); 00054 static SensorBase *m_singletonList; 00055 SensorBase *m_nextSingleton; 00056 }; 00057 00058 00059 #endif