Now you can download a copy of these docs so you can use them offline! Download now
SensorBase.cpp
1 /*----------------------------------------------------------------------------*/
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 #include "SensorBase.h"
8 
9 #include "NetworkCommunication/LoadOut.h"
10 #include "WPIErrors.h"
11 
12 const uint32_t SensorBase::kSystemClockTicksPerMicrosecond;
13 const uint32_t SensorBase::kDigitalChannels;
14 const uint32_t SensorBase::kAnalogChannels;
15 const uint32_t SensorBase::kAnalogModules;
16 const uint32_t SensorBase::kDigitalModules;
17 const uint32_t SensorBase::kSolenoidChannels;
18 const uint32_t SensorBase::kSolenoidModules;
19 const uint32_t SensorBase::kPwmChannels;
20 const uint32_t SensorBase::kRelayChannels;
21 const uint32_t SensorBase::kChassisSlots;
22 SensorBase *SensorBase::m_singletonList = NULL;
23 
28 {
29 }
30 
35 {
36 }
37 
48 {
49  m_nextSingleton = m_singletonList;
50  m_singletonList = this;
51 }
52 
59 {
60  for (SensorBase *next = m_singletonList; next != NULL;)
61  {
62  SensorBase *tmp = next;
63  next = next->m_nextSingleton;
64  delete tmp;
65  }
66  m_singletonList = NULL;
67 }
68 
74 bool SensorBase::CheckAnalogModule(uint8_t moduleNumber)
75 {
76  if (nLoadOut::getModulePresence(nLoadOut::kModuleType_Analog, moduleNumber - 1))
77  return true;
78  return false;
79 }
80 
86 bool SensorBase::CheckDigitalModule(uint8_t moduleNumber)
87 {
88  if (nLoadOut::getModulePresence(nLoadOut::kModuleType_Digital, moduleNumber - 1))
89  return true;
90  return false;
91 }
92 
98 bool SensorBase::CheckPWMModule(uint8_t moduleNumber)
99 {
100  return CheckDigitalModule(moduleNumber);
101 }
102 
108 bool SensorBase::CheckRelayModule(uint8_t moduleNumber)
109 {
110  return CheckDigitalModule(moduleNumber);
111 }
112 
118 bool SensorBase::CheckSolenoidModule(uint8_t moduleNumber)
119 {
120  if (nLoadOut::getModulePresence(nLoadOut::kModuleType_Solenoid, moduleNumber - 1))
121  return true;
122  return false;
123 }
124 
132 bool SensorBase::CheckDigitalChannel(uint32_t channel)
133 {
134  if (channel > 0 && channel <= kDigitalChannels)
135  return true;
136  return false;
137 }
138 
146 bool SensorBase::CheckRelayChannel(uint32_t channel)
147 {
148  if (channel > 0 && channel <= kRelayChannels)
149  return true;
150  return false;
151 }
152 
160 bool SensorBase::CheckPWMChannel(uint32_t channel)
161 {
162  if (channel > 0 && channel <= kPwmChannels)
163  return true;
164  return false;
165 }
166 
174 bool SensorBase::CheckAnalogChannel(uint32_t channel)
175 {
176  if (channel > 0 && channel <= kAnalogChannels)
177  return true;
178  return false;
179 }
180 
186 bool SensorBase::CheckSolenoidChannel(uint32_t channel)
187 {
188  if (channel > 0 && channel <= kSolenoidChannels)
189  return true;
190  return false;
191 }
192 
static bool CheckDigitalChannel(uint32_t channel)
Definition: SensorBase.cpp:132
static bool CheckAnalogModule(uint8_t moduleNumber)
Definition: SensorBase.cpp:74
static bool CheckPWMChannel(uint32_t channel)
Definition: SensorBase.cpp:160
static void DeleteSingletons()
Definition: SensorBase.cpp:58
static bool CheckPWMModule(uint8_t moduleNumber)
Definition: SensorBase.cpp:98
virtual ~SensorBase()
Definition: SensorBase.cpp:34
static bool CheckRelayModule(uint8_t moduleNumber)
Definition: SensorBase.cpp:108
static bool CheckDigitalModule(uint8_t moduleNumber)
Definition: SensorBase.cpp:86
static bool CheckSolenoidModule(uint8_t moduleNumber)
Definition: SensorBase.cpp:118
static bool CheckRelayChannel(uint32_t channel)
Definition: SensorBase.cpp:146
void AddToSingletonList()
Definition: SensorBase.cpp:47
static bool CheckAnalogChannel(uint32_t channel)
Definition: SensorBase.cpp:174
static bool CheckSolenoidChannel(uint32_t channel)
Definition: SensorBase.cpp:186

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6