Now you can download a copy of these docs so you can use them offline! Download now
SensorBase.cpp
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 #include "SensorBase.h" 00008 00009 #include "NetworkCommunication/LoadOut.h" 00010 #include "WPIErrors.h" 00011 00012 const UINT32 SensorBase::kSystemClockTicksPerMicrosecond; 00013 const UINT32 SensorBase::kDigitalChannels; 00014 const UINT32 SensorBase::kAnalogChannels; 00015 const UINT32 SensorBase::kAnalogModules; 00016 const UINT32 SensorBase::kDigitalModules; 00017 const UINT32 SensorBase::kSolenoidChannels; 00018 const UINT32 SensorBase::kSolenoidModules; 00019 const UINT32 SensorBase::kPwmChannels; 00020 const UINT32 SensorBase::kRelayChannels; 00021 const UINT32 SensorBase::kChassisSlots; 00022 SensorBase *SensorBase::m_singletonList = NULL; 00023 00027 SensorBase::SensorBase() 00028 { 00029 } 00030 00034 SensorBase::~SensorBase() 00035 { 00036 } 00037 00047 void SensorBase::AddToSingletonList() 00048 { 00049 m_nextSingleton = m_singletonList; 00050 m_singletonList = this; 00051 } 00052 00058 void SensorBase::DeleteSingletons() 00059 { 00060 for (SensorBase *next = m_singletonList; next != NULL;) 00061 { 00062 SensorBase *tmp = next; 00063 next = next->m_nextSingleton; 00064 delete tmp; 00065 } 00066 m_singletonList = NULL; 00067 } 00068 00074 bool SensorBase::CheckAnalogModule(UINT8 moduleNumber) 00075 { 00076 if (nLoadOut::getModulePresence(nLoadOut::kModuleType_Analog, moduleNumber - 1)) 00077 return true; 00078 return false; 00079 } 00080 00086 bool SensorBase::CheckDigitalModule(UINT8 moduleNumber) 00087 { 00088 if (nLoadOut::getModulePresence(nLoadOut::kModuleType_Digital, moduleNumber - 1)) 00089 return true; 00090 return false; 00091 } 00092 00098 bool SensorBase::CheckPWMModule(UINT8 moduleNumber) 00099 { 00100 return CheckDigitalModule(moduleNumber); 00101 } 00102 00108 bool SensorBase::CheckRelayModule(UINT8 moduleNumber) 00109 { 00110 return CheckDigitalModule(moduleNumber); 00111 } 00112 00118 bool SensorBase::CheckSolenoidModule(UINT8 moduleNumber) 00119 { 00120 if (nLoadOut::getModulePresence(nLoadOut::kModuleType_Solenoid, moduleNumber - 1)) 00121 return true; 00122 return false; 00123 } 00124 00132 bool SensorBase::CheckDigitalChannel(UINT32 channel) 00133 { 00134 if (channel > 0 && channel <= kDigitalChannels) 00135 return true; 00136 return false; 00137 } 00138 00146 bool SensorBase::CheckRelayChannel(UINT32 channel) 00147 { 00148 if (channel > 0 && channel <= kRelayChannels) 00149 return true; 00150 return false; 00151 } 00152 00160 bool SensorBase::CheckPWMChannel(UINT32 channel) 00161 { 00162 if (channel > 0 && channel <= kPwmChannels) 00163 return true; 00164 return false; 00165 } 00166 00174 bool SensorBase::CheckAnalogChannel(UINT32 channel) 00175 { 00176 if (channel > 0 && channel <= kAnalogChannels) 00177 return true; 00178 return false; 00179 } 00180 00186 bool SensorBase::CheckSolenoidChannel(UINT32 channel) 00187 { 00188 if (channel > 0 && channel <= kSolenoidChannels) 00189 return true; 00190 return false; 00191 } 00192
Generated on Thu Jan 12 2012 22:35:24 for WPILibC++ by
1.7.1