LabJackDevice.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H
17 #define SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H
18 
19 #include <memory>
20 #include <string>
21 #include <unordered_map>
22 #include <unordered_set>
23 
26 
27 namespace SurgSim
28 {
29 namespace Devices
30 {
31 class LabJackScaffold;
32 
33 SURGSIM_STATIC_REGISTRATION(LabJackDevice);
34 
35 namespace LabJack
36 {
40 enum TIMER
41 {
47  TIMER5
48 };
49 
51 {
59  FIO7
60 };
61 
63 {
64  EIO0 = 8,
71  EIO7
72 };
73 
75 {
76  CIO0 = 16,
79  CIO3
80 };
81 
83 {
84  MIO0 = 20,
86  MIO2
87 };
88 
89 enum AIN
90 {
106  AIN15
107 };
108 
109 enum DAC
110 {
112  DAC1
113 };
115 
117 enum Model
118 {
121  MODEL_U3 = 3,
122  MODEL_U6 = 6
123 };
124 
127 {
133 };
134 
139 {
154  TIMERBASE_26 = 26
155 };
156 
161 {
162  TIMERMODE_PWM_16BIT = 0, // 16 bit PWM
163  TIMERMODE_PWM_8BIT = 1, // 8 bit PWM
164  TIMERMODE_RISING_EDGES_32BIT = 2, // 32-bit rising to rising edge measurement
165  TIMERMODE_FALLING_EDGES_32BIT = 3, // 32-bit falling to falling edge measurement
166  TIMERMODE_DUTY_CYCLE = 4, // duty cycle measurement
167  TIMERMODE_FIRMWARE_COUNTER = 5, // firmware based rising edge counter
168  TIMERMODE_FIRMWARE_COUNTER_DEBOUNCED = 6, // firmware counter with debounce
169  TIMERMODE_FREQUENCY_OUTPUT = 7, // frequency output
170  TIMERMODE_QUADRATURE = 8, // Quadrature
171  TIMERMODE_TIMER_STOP = 9, // stops another timer after n pulses
172  TIMERMODE_SYSTEM_TIMER_LOWER_32BITS = 10, // read lower 32-bits of system timer
173  TIMERMODE_SYSTEM_TIMER_UPPR_32BITS = 11, // read upper 32-bits of system timer
174  TIMERMODE_RISING_EDGES_16BIT = 12, // 16-bit rising to rising edge measurement
175  TIMERMODE_FALLING_EDGES_16BIT = 13, // 16-bit falling to falling edge measurement
176  TIMERMODE_LINE_TO_LINE = 14 // Line to Line measurement
177 };
178 
181 {
185  bool operator==(const TimerSettings& other) const
186  {
187  return (mode == other.mode) && (initialValue == other.initialValue);
188  }
189 
192 
195 };
196 
198 enum Range
199 {
200  RANGE_20 = 1, // -20V to +20V, LJ_rgBIP20V
201  RANGE_10 = 2, // -10V to +10V, LJ_rgBIP10V
202  RANGE_5 = 3, // -5V to +5V, LJ_rgBIP5V
203  RANGE_4 = 4, // -4V to +4V, LJ_rgBIP4V
204  RANGE_2_POINT_5 = 5, // -2.5V to +2.5V, LJ_rgBIP2P5V
205  RANGE_2 = 6, // -2V to +2V, LJ_rgBIP2V
206  RANGE_1_POINT_25 = 7, // -1.25V to +1.25V, LJ_rgBIP1P25V
207  RANGE_1 = 8, // -1V to +1V, LJ_rgBIP1V
208  RANGE_0_POINT_625 = 9, // -0.625V to +0.625V, LJ_rgBIPP625V
209  RANGE_0_POINT_1 = 10, // -0.1V to +0.1V, LJ_rgBIPP1V
210  RANGE_0_POINT_01 = 11 // -0.01V to +0.01V, LJ_rgBIPP01V
211 };
212 
215 {
219  bool operator==(const AnalogInputSettings& other) const
220  {
221  return (negativeChannel == other.negativeChannel) && (range == other.range);
222  }
223 
226 
229 };
230 };
231 
275 {
276 public:
279  explicit LabJackDevice(const std::string& uniqueName);
280 
282 
284  virtual ~LabJackDevice();
285 
286  bool initialize() override;
287 
288  bool isInitialized() const override;
289 
293  void setModel(LabJack::Model model);
294 
296  LabJack::Model getModel() const;
297 
301  void setConnection(LabJack::Connection connection);
302 
305 
310  void setAddress(std::string address);
311 
313  const std::string& getAddress() const;
314 
324  void setResetOnDestruct(bool reset);
325 
328  bool getResetOnDestruct() const;
329 
333  void enableDigitalInput(int channel);
334 
338  void setDigitalInputs(const std::unordered_set<int>& digitalInputChannels);
339 
341  const std::unordered_set<int>& getDigitalInputs() const;
342 
346  void enableDigitalOutput(int channel);
347 
351  void setDigitalOutputs(const std::unordered_set<int>& digitalOutputChannels);
352 
354  const std::unordered_set<int>& getDigitalOutputs() const;
355 
360  void setTimerBase(LabJack::TimerBase base);
361 
364 
369  void setTimerClockDivisor(int divisor);
370 
372  int getTimerClockDivisor() const;
373 
377  void setTimerCounterPinOffset(int offset);
378 
380  int getTimerCounterPinOffset() const;
381 
389  void enableTimer(int index, LabJack::TimerMode mode);
390 
400  void enableTimer(int index, LabJack::TimerMode mode, int initialValue);
401 
406  void setTimers(const std::unordered_map<int, LabJack::TimerSettings>& timers);
407 
409  const std::unordered_map<int, LabJack::TimerSettings>& getTimers() const;
410 
414  void setMaximumUpdateRate(double rate);
415 
417  double getMaximumUpdateRate() const;
418 
425  void enableAnalogInput(int positiveChannel, LabJack::Range range, int negativeChannel);
426 
431  void enableAnalogInput(int channel, LabJack::Range range);
432 
438  void setAnalogInputs(const std::unordered_map<int, LabJack::AnalogInputSettings>& analogInputs);
439 
441  const std::unordered_map<int, LabJack::AnalogInputSettings>& getAnalogInputs() const;
442 
446  void enableAnalogOutput(int channel);
447 
452  void setAnalogOutputs(const std::unordered_set<int>& analogOutputChannels);
453 
455  const std::unordered_set<int>& getAnalogOutputs() const;
456 
462  void setAnalogInputResolution(int resolution);
463 
465  int getAnalogInputResolution() const;
466 
472  void setAnalogInputSettling(int settling);
473 
475  int getAnalogInputSettling() const;
476 
477 private:
478  friend class LabJackScaffold;
479 
480  bool finalize() override;
481 
483  std::shared_ptr<LabJackScaffold> m_scaffold;
484 
487 
490 
493 
495  bool m_reset;
496 
498  std::unordered_set<int> m_digitalInputChannels;
499 
501  std::unordered_map<int, LabJack::AnalogInputSettings> m_analogInputs;
502 
504  std::unordered_set<int> m_digitalOutputChannels;
505 
507  std::unordered_set<int> m_analogOutputChannels;
508 
513 
516 
519 
521  std::unordered_map<int, LabJack::TimerSettings> m_timers;
522 
524  double m_threadRate;
525 
528 
531 };
532 
533 }; // namespace Devices
534 }; // namespace SurgSim
535 
536 #endif // SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H
SurgSim::Devices::LabJackDevice::setTimerCounterPinOffset
void setTimerCounterPinOffset(int offset)
The timers and counters are always on consecutive pins, but the start pin can be varied within limits...
Definition: LabJackDevice.cpp:190
SurgSim::Devices::LabJack::AIN5
@ AIN5
Definition: LabJackDevice.h:96
SurgSim::Devices::LabJackDevice::m_connection
LabJack::Connection m_connection
The type of communication connection, e.g., USB.
Definition: LabJackDevice.h:489
SurgSim::Devices::LabJack::TimerSettings::operator==
bool operator==(const TimerSettings &other) const
Equality comparison.
Definition: LabJackDevice.h:185
SurgSim::Devices::LabJack::MIO2
@ MIO2
Definition: LabJackDevice.h:86
SurgSim::Devices::LabJack::EIO2
@ EIO2
Definition: LabJackDevice.h:66
SurgSim::Devices::LabJack::EIO1
@ EIO1
Definition: LabJackDevice.h:65
SurgSim::Devices::LabJackDevice::getTimerBase
LabJack::TimerBase getTimerBase() const
Definition: LabJackDevice.cpp:174
SurgSim::Devices::LabJack::TIMERMODE_SYSTEM_TIMER_LOWER_32BITS
@ TIMERMODE_SYSTEM_TIMER_LOWER_32BITS
Definition: LabJackDevice.h:172
SurgSim::Devices::LabJackDevice::getTimerCounterPinOffset
int getTimerCounterPinOffset() const
Definition: LabJackDevice.cpp:197
SurgSim::Devices::LabJack::FIO5
@ FIO5
Definition: LabJackDevice.h:57
SurgSim::Devices::LabJack::RANGE_0_POINT_625
@ RANGE_0_POINT_625
Definition: LabJackDevice.h:208
SurgSim::Devices::LabJack::AnalogInputSettings::negativeChannel
SurgSim::DataStructures::OptionalValue< int > negativeChannel
The negative channel.
Definition: LabJackDevice.h:228
SurgSim::Devices::LabJackDevice::isInitialized
bool isInitialized() const override
Definition: LabJackDevice.cpp:85
SurgSim::Devices::LabJack::MIO_LINE
MIO_LINE
Definition: LabJackDevice.h:83
SurgSim::Devices::LabJack::TIMER4
@ TIMER4
Definition: LabJackDevice.h:46
SurgSim::Devices::LabJack::DAC1
@ DAC1
Definition: LabJackDevice.h:112
SurgSim::Devices::LabJackDevice::setAddress
void setAddress(std::string address)
Set the address of the LabJack, e.g., "1" or "192.168.7.23".
Definition: LabJackDevice.cpp:112
SurgSim::Devices::LabJack::TIMER3
@ TIMER3
Definition: LabJackDevice.h:45
SurgSim::Devices::LabJack::CIO3
@ CIO3
Definition: LabJackDevice.h:79
SurgSim::Devices::LabJack::DAC
DAC
Definition: LabJackDevice.h:110
SurgSim::DataStructures::OptionalValue< int >
SurgSim::Devices::LabJack::AnalogInputSettings
A struct holding the data to be associated with the positive channel for an analog input.
Definition: LabJackDevice.h:215
SurgSim::Devices::LabJack::TIMERBASE_26
@ TIMERBASE_26
Definition: LabJackDevice.h:154
SurgSim::Devices::LabJackDevice::m_timerClockDivisor
int m_timerClockDivisor
The timer clock's divisor, see m_timerBase.
Definition: LabJackDevice.h:515
SurgSim::Devices::LabJack::CIO1
@ CIO1
Definition: LabJackDevice.h:77
SurgSim::Devices::LabJack::CONNECTION_SEARCH
@ CONNECTION_SEARCH
Definition: LabJackDevice.h:128
SurgSim::Devices::LabJackDevice::m_analogInputResolution
int m_analogInputResolution
The resolution for all the analog inputs.
Definition: LabJackDevice.h:527
SurgSim::Devices::LabJackDevice::getAnalogInputSettling
int getAnalogInputSettling() const
Definition: LabJackDevice.cpp:305
SurgSim::Devices::LabJackDevice::getAnalogInputResolution
int getAnalogInputResolution() const
Definition: LabJackDevice.cpp:293
SurgSim::Devices::LabJackScaffold
A class that implements the behavior of LabJackDevice objects.
Definition: LabJackScaffold.h:42
SurgSim::Devices::LabJackDevice::m_timerCounterPinOffset
int m_timerCounterPinOffset
The number of the lowest FIO pin that is a timer or counter.
Definition: LabJackDevice.h:518
SurgSim::Devices::LabJack::MODEL_SEARCH
@ MODEL_SEARCH
Definition: LabJackDevice.h:119
SurgSim::Devices::LabJack::CONNECTION_ETHERNET
@ CONNECTION_ETHERNET
Definition: LabJackDevice.h:130
SurgSim::Devices::LabJackDevice::getAnalogInputs
const std::unordered_map< int, LabJack::AnalogInputSettings > & getAnalogInputs() const
Definition: LabJackDevice.cpp:264
SurgSim::Devices::LabJackDevice::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::LabJackDevice)
SurgSim::Devices::LabJack::FIO6
@ FIO6
Definition: LabJackDevice.h:58
SurgSim::Devices::LabJack::TIMERMODE_RISING_EDGES_16BIT
@ TIMERMODE_RISING_EDGES_16BIT
Definition: LabJackDevice.h:174
SurgSim::Devices::LabJack::FIO7
@ FIO7
Definition: LabJackDevice.h:59
SurgSim::Devices::LabJackDevice::enableAnalogOutput
void enableAnalogOutput(int channel)
Enable analog output.
Definition: LabJackDevice.cpp:269
SurgSim::Devices::LabJack::TIMER0
@ TIMER0
Definition: LabJackDevice.h:42
SurgSim::Devices::LabJack::EIO0
@ EIO0
Definition: LabJackDevice.h:64
SurgSim::Devices::LabJack::RANGE_0_POINT_01
@ RANGE_0_POINT_01
Definition: LabJackDevice.h:210
SurgSim::Devices::LabJackDevice::m_timers
std::unordered_map< int, LabJack::TimerSettings > m_timers
A map from the timers' line numbers to their mode and optional initial value.
Definition: LabJackDevice.h:521
SurgSim::Devices::LabJack::EIO6
@ EIO6
Definition: LabJackDevice.h:70
SurgSim::Devices::LabJackDevice::setTimerClockDivisor
void setTimerClockDivisor(int divisor)
If the Timer type ends in "_DIV", then the actual timer frequency is divided by the divisor.
Definition: LabJackDevice.cpp:179
SurgSim::Devices::LabJackDevice::setDigitalInputs
void setDigitalInputs(const std::unordered_set< int > &digitalInputChannels)
Set which digital input lines are enabled.
Definition: LabJackDevice.cpp:139
SurgSim::Devices::LabJack::CONNECTION_ETHERNET_MB
@ CONNECTION_ETHERNET_MB
Definition: LabJackDevice.h:131
SurgSim::Devices::LabJack::MODEL_U6
@ MODEL_U6
Definition: LabJackDevice.h:122
SurgSim::Devices::LabJackDevice::setResetOnDestruct
void setResetOnDestruct(bool reset)
Reset LabJack during destruct.
Definition: LabJackDevice.cpp:123
SurgSim::Devices::LabJack::TIMERMODE_PWM_16BIT
@ TIMERMODE_PWM_16BIT
Definition: LabJackDevice.h:162
OptionalValue.h
SurgSim::Devices::LabJack::AIN2
@ AIN2
Definition: LabJackDevice.h:93
SurgSim::Devices::LabJack::TIMER
TIMER
Definition: LabJackDevice.h:41
SurgSim::Devices::LabJackDevice::getTimers
const std::unordered_map< int, LabJack::TimerSettings > & getTimers() const
Definition: LabJackDevice.cpp:222
SurgSim::Devices::LabJackDevice::getMaximumUpdateRate
double getMaximumUpdateRate() const
Definition: LabJackDevice.cpp:234
SurgSim::Devices::LabJackDevice::setConnection
void setConnection(LabJack::Connection connection)
Set the connection type of the LabJack, e.g., USB.
Definition: LabJackDevice.cpp:101
SurgSim::Devices::LabJack::CONNECTION_ETHERNET_DATA_ONLY
@ CONNECTION_ETHERNET_DATA_ONLY
Definition: LabJackDevice.h:132
SurgSim::Devices::LabJackDevice::setDigitalOutputs
void setDigitalOutputs(const std::unordered_set< int > &digitalOutputChannels)
Set which digital output lines are enabled.
Definition: LabJackDevice.cpp:156
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Input::CommonDevice
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:36
SurgSim::Devices::LabJack::AIN9
@ AIN9
Definition: LabJackDevice.h:100
SurgSim::Devices::LabJack::TIMERBASE_3
@ TIMERBASE_3
Definition: LabJackDevice.h:144
SurgSim::Devices::LabJackDevice::getAddress
const std::string & getAddress() const
Definition: LabJackDevice.cpp:118
SurgSim::Devices::LabJack::TIMERMODE_FALLING_EDGES_16BIT
@ TIMERMODE_FALLING_EDGES_16BIT
Definition: LabJackDevice.h:175
SurgSim::Devices::LabJack::TIMERBASE_4
@ TIMERBASE_4
Definition: LabJackDevice.h:145
SurgSim::Devices::LabJack::Range
Range
The analog input ranges. Equivalent to gain. Ignored for Linux scaffold, which auto-ranges.
Definition: LabJackDevice.h:199
SurgSim::Devices::LabJack::TIMERMODE_RISING_EDGES_32BIT
@ TIMERMODE_RISING_EDGES_32BIT
Definition: LabJackDevice.h:164
SurgSim::Devices::LabJackDevice::m_threadRate
double m_threadRate
The maximum update rate for the LabJackThread.
Definition: LabJackDevice.h:524
SurgSim::Devices::LabJackDevice::m_scaffold
std::shared_ptr< LabJackScaffold > m_scaffold
The single scaffold object that handles communications with all instances of LabJackDevice.
Definition: LabJackDevice.h:483
SurgSim::Devices::LabJackDevice::setAnalogInputSettling
void setAnalogInputSettling(int settling)
Set the settling time for all the analog inputs.
Definition: LabJackDevice.cpp:298
SurgSim::Devices::LabJackDevice::m_model
LabJack::Model m_model
The model, e.g., U6.
Definition: LabJackDevice.h:486
SurgSim::Devices::LabJackDevice::m_timerBase
LabJack::TimerBase m_timerBase
The timer base, which is the frequency of all the output timers unless it ends in "_DIV",...
Definition: LabJackDevice.h:512
SurgSim::Devices::LabJack::AIN3
@ AIN3
Definition: LabJackDevice.h:94
SurgSim::Devices::LabJackDevice::enableDigitalOutput
void enableDigitalOutput(int channel)
Enable digital output line.
Definition: LabJackDevice.cpp:150
SurgSim::Devices::LabJack::EIO4
@ EIO4
Definition: LabJackDevice.h:68
SurgSim::Devices::LabJack::TIMERBASE_6
@ TIMERBASE_6
Definition: LabJackDevice.h:147
SurgSim::Devices::LabJack::CIO_LINE
CIO_LINE
Definition: LabJackDevice.h:75
SurgSim::Devices::LabJack::AIN7
@ AIN7
Definition: LabJackDevice.h:98
SurgSim::Devices::LabJack::RANGE_1_POINT_25
@ RANGE_1_POINT_25
Definition: LabJackDevice.h:206
SurgSim::Devices::LabJack::TIMERMODE_TIMER_STOP
@ TIMERMODE_TIMER_STOP
Definition: LabJackDevice.h:171
SurgSim::Devices::LabJack::TIMERBASE_DEFAULT
@ TIMERBASE_DEFAULT
Definition: LabJackDevice.h:140
SurgSim::Devices::LabJack::RANGE_10
@ RANGE_10
Definition: LabJackDevice.h:201
SurgSim::Devices::LabJack::AIN
AIN
Definition: LabJackDevice.h:90
SurgSim::Devices::LabJack::TIMERBASE_25
@ TIMERBASE_25
Definition: LabJackDevice.h:153
SurgSim::Devices::LabJackDevice::setAnalogOutputs
void setAnalogOutputs(const std::unordered_set< int > &analogOutputChannels)
Set which analog outputs are enabled.
Definition: LabJackDevice.cpp:275
SurgSim::Devices::LabJack::AnalogInputSettings::range
Range range
The range.
Definition: LabJackDevice.h:225
SurgSim::Devices::LabJack::TIMERBASE_23
@ TIMERBASE_23
Definition: LabJackDevice.h:151
SurgSim::Devices::LabJackDevice::LabJackDevice
LabJackDevice(const std::string &uniqueName)
Constructor.
Definition: LabJackDevice.cpp:28
SurgSim::Devices::LabJackDevice::setModel
void setModel(LabJack::Model model)
Set the model, e.g., U6.
Definition: LabJackDevice.cpp:90
SurgSim::Devices::LabJack::AnalogInputSettings::operator==
bool operator==(const AnalogInputSettings &other) const
Equality comparison.
Definition: LabJackDevice.h:219
SurgSim::Devices::LabJack::AIN8
@ AIN8
Definition: LabJackDevice.h:99
SurgSim::Devices::LabJack::RANGE_1
@ RANGE_1
Definition: LabJackDevice.h:207
CommonDevice.h
SurgSim::Devices::LabJack::EIO_LINE
EIO_LINE
Definition: LabJackDevice.h:63
SurgSim::Devices::LabJack::TIMERBASE_21
@ TIMERBASE_21
Definition: LabJackDevice.h:149
SurgSim::Devices::LabJack::Connection
Connection
The connection (i.e., communication media) for LabJacks. Numbers come from LabJackUD....
Definition: LabJackDevice.h:127
SurgSim::Devices::LabJack::AIN6
@ AIN6
Definition: LabJackDevice.h:97
SurgSim::Devices::LabJack::AIN4
@ AIN4
Definition: LabJackDevice.h:95
SurgSim::Devices::LabJackDevice::setAnalogInputResolution
void setAnalogInputResolution(int resolution)
Set the resolution for all the analog inputs.
Definition: LabJackDevice.cpp:286
SurgSim::Devices::LabJackDevice::m_analogOutputChannels
std::unordered_set< int > m_analogOutputChannels
The line numbers for the analog outputs.
Definition: LabJackDevice.h:507
SurgSim::Devices::LabJack::TimerMode
TimerMode
The timer modes.
Definition: LabJackDevice.h:161
SurgSim::Devices::LabJack::RANGE_2_POINT_5
@ RANGE_2_POINT_5
Definition: LabJackDevice.h:204
SurgSim::Devices::LabJack::TIMER1
@ TIMER1
Definition: LabJackDevice.h:43
SurgSim::Devices::LabJackDevice::getAnalogOutputs
const std::unordered_set< int > & getAnalogOutputs() const
Definition: LabJackDevice.cpp:281
SurgSim::Devices::LabJack::MIO0
@ MIO0
Definition: LabJackDevice.h:84
SurgSim::Devices::LabJack::TIMER2
@ TIMER2
Definition: LabJackDevice.h:44
SurgSim::Devices::LabJackDevice::enableTimer
void enableTimer(int index, LabJack::TimerMode mode)
Enable timer.
Definition: LabJackDevice.cpp:202
SurgSim::Devices::LabJack::TIMERMODE_QUADRATURE
@ TIMERMODE_QUADRATURE
Definition: LabJackDevice.h:170
SurgSim::Devices::LabJack::AIN15
@ AIN15
Definition: LabJackDevice.h:106
SurgSim::Devices::LabJackDevice::m_address
std::string m_address
The address, or a zero-length string to indicate the first-found device of this type on this connecti...
Definition: LabJackDevice.h:492
SurgSim::Devices::LabJack::TIMERBASE_5
@ TIMERBASE_5
Definition: LabJackDevice.h:146
SurgSim::Devices::LabJack::RANGE_20
@ RANGE_20
Definition: LabJackDevice.h:200
SurgSim::Devices::LabJack::TIMERBASE_20
@ TIMERBASE_20
Definition: LabJackDevice.h:148
SurgSim::Devices::LabJackDevice::getDigitalInputs
const std::unordered_set< int > & getDigitalInputs() const
Definition: LabJackDevice.cpp:145
SurgSim::Devices::LabJack::FIO3
@ FIO3
Definition: LabJackDevice.h:55
SurgSim::Devices::LabJackDevice::setAnalogInputs
void setAnalogInputs(const std::unordered_map< int, LabJack::AnalogInputSettings > &analogInputs)
Set which analog inputs are enabled.
Definition: LabJackDevice.cpp:256
SurgSim::Devices::LabJackDevice::m_digitalOutputChannels
std::unordered_set< int > m_digitalOutputChannels
The line numbers for the digital outputs.
Definition: LabJackDevice.h:504
SurgSim::Devices::LabJack::TIMERBASE_0
@ TIMERBASE_0
Definition: LabJackDevice.h:141
SurgSim::Devices::LabJack::FIO_LINE
FIO_LINE
Definition: LabJackDevice.h:51
SurgSim::Devices::LabJack::TIMERMODE_DUTY_CYCLE
@ TIMERMODE_DUTY_CYCLE
Definition: LabJackDevice.h:166
SurgSim::Devices::LabJack::MODEL_UE9
@ MODEL_UE9
Definition: LabJackDevice.h:120
SurgSim::Devices::LabJack::AIN14
@ AIN14
Definition: LabJackDevice.h:105
SurgSim::Devices::LabJack::TimerSettings::mode
TimerMode mode
The mode.
Definition: LabJackDevice.h:191
SurgSim::Devices::LabJackDevice::setTimerBase
void setTimerBase(LabJack::TimerBase base)
Set the timer base rate.
Definition: LabJackDevice.cpp:168
SurgSim::Devices::LabJackDevice::enableDigitalInput
void enableDigitalInput(int channel)
Enable digital input line.
Definition: LabJackDevice.cpp:133
SurgSim::Devices::LabJack::AIN10
@ AIN10
Definition: LabJackDevice.h:101
SurgSim::Devices::LabJack::TIMER5
@ TIMER5
Definition: LabJackDevice.h:47
SurgSim::Devices::LabJack::RANGE_4
@ RANGE_4
Definition: LabJackDevice.h:203
SurgSim::Devices::LabJackDevice::enableAnalogInput
void enableAnalogInput(int positiveChannel, LabJack::Range range, int negativeChannel)
Enable differential analog input.
Definition: LabJackDevice.cpp:239
SurgSim::Devices::LabJack::TIMERBASE_22
@ TIMERBASE_22
Definition: LabJackDevice.h:150
SurgSim::Devices::LabJack::TIMERBASE_1
@ TIMERBASE_1
Definition: LabJackDevice.h:142
SurgSim::Devices::LabJack::FIO2
@ FIO2
Definition: LabJackDevice.h:54
SurgSim::Devices::LabJack::AIN11
@ AIN11
Definition: LabJackDevice.h:102
SurgSim::Devices::LabJack::FIO4
@ FIO4
Definition: LabJackDevice.h:56
SurgSim::Devices::LabJack::AIN13
@ AIN13
Definition: LabJackDevice.h:104
SurgSim::Devices::LabJack::DAC0
@ DAC0
Definition: LabJackDevice.h:111
SurgSim::Devices::LabJack::TimerBase
TimerBase
The timer base frequencies for LabJacks.
Definition: LabJackDevice.h:139
SurgSim::Devices::LabJack::TIMERBASE_2
@ TIMERBASE_2
Definition: LabJackDevice.h:143
SurgSim::Devices::LabJackDevice::initialize
bool initialize() override
Fully initialize the device.
Definition: LabJackDevice.cpp:51
SurgSim::Devices::LabJack::RANGE_2
@ RANGE_2
Definition: LabJackDevice.h:205
SurgSim::Devices::LabJack::TimerSettings::initialValue
SurgSim::DataStructures::OptionalValue< int > initialValue
The initial value.
Definition: LabJackDevice.h:194
SurgSim::Devices::LabJackDevice::m_reset
bool m_reset
Whether or not the hardware should reset when this object destructs.
Definition: LabJackDevice.h:495
SurgSim::Devices::LabJack::TIMERMODE_LINE_TO_LINE
@ TIMERMODE_LINE_TO_LINE
Definition: LabJackDevice.h:176
SurgSim::Devices::LabJackDevice::finalize
bool finalize() override
Finalize (de-initialize) the device.
Definition: LabJackDevice.cpp:77
SurgSim::Devices::LabJack::TIMERBASE_24
@ TIMERBASE_24
Definition: LabJackDevice.h:152
SurgSim::Devices::LabJack::TIMERMODE_FIRMWARE_COUNTER_DEBOUNCED
@ TIMERMODE_FIRMWARE_COUNTER_DEBOUNCED
Definition: LabJackDevice.h:168
SurgSim::Devices::LabJack::MODEL_U3
@ MODEL_U3
Definition: LabJackDevice.h:121
SurgSim::Devices::LabJack::AIN0
@ AIN0
Definition: LabJackDevice.h:91
SurgSim::Devices::LabJackDevice::m_analogInputSettling
int m_analogInputSettling
The settling time for all the analog inputs.
Definition: LabJackDevice.h:530
SurgSim::Devices::LabJackDevice::getTimerClockDivisor
int getTimerClockDivisor() const
Definition: LabJackDevice.cpp:185
SurgSim::Devices::LabJackDevice::getResetOnDestruct
bool getResetOnDestruct() const
Get whether or not the hardware should reset when the LabJackDevice object destructs.
Definition: LabJackDevice.cpp:128
SurgSim::Devices::LabJack::EIO5
@ EIO5
Definition: LabJackDevice.h:69
SurgSim::Devices::LabJack::TIMERMODE_SYSTEM_TIMER_UPPR_32BITS
@ TIMERMODE_SYSTEM_TIMER_UPPR_32BITS
Definition: LabJackDevice.h:173
SurgSim::Devices::LabJackDevice::getDigitalOutputs
const std::unordered_set< int > & getDigitalOutputs() const
Definition: LabJackDevice.cpp:163
SurgSim::Devices::LabJack::EIO7
@ EIO7
Definition: LabJackDevice.h:71
SurgSim::Devices::LabJackDevice
A class implementing the communication with a LabJack data acquisition (DAQ) device.
Definition: LabJackDevice.h:275
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Devices::LabJack::CIO0
@ CIO0
Definition: LabJackDevice.h:76
SurgSim::Devices::LabJackDevice::getConnection
LabJack::Connection getConnection() const
Definition: LabJackDevice.cpp:107
SurgSim::Devices::LabJackDevice::setTimers
void setTimers(const std::unordered_map< int, LabJack::TimerSettings > &timers)
Set which timers are enabled.
Definition: LabJackDevice.cpp:216
SurgSim::Devices::LabJackDevice::getModel
LabJack::Model getModel() const
Definition: LabJackDevice.cpp:96
SurgSim::Devices::LabJack::RANGE_0_POINT_1
@ RANGE_0_POINT_1
Definition: LabJackDevice.h:209
SurgSim::Devices::LabJack::TIMERMODE_FIRMWARE_COUNTER
@ TIMERMODE_FIRMWARE_COUNTER
Definition: LabJackDevice.h:167
SurgSim::Devices::LabJack::EIO3
@ EIO3
Definition: LabJackDevice.h:67
SurgSim::Devices::LabJack::Model
Model
The models of LabJack devices. Numbers come from LabJackUD.h.
Definition: LabJackDevice.h:118
SurgSim::Devices::LabJackDevice::~LabJackDevice
virtual ~LabJackDevice()
Destructor.
Definition: LabJackDevice.cpp:43
SurgSim::Devices::LabJack::AIN1
@ AIN1
Definition: LabJackDevice.h:92
SurgSim::Devices::LabJack::AIN12
@ AIN12
Definition: LabJackDevice.h:103
SurgSim::Devices::LabJack::FIO1
@ FIO1
Definition: LabJackDevice.h:53
SurgSim::Devices::LabJack::CIO2
@ CIO2
Definition: LabJackDevice.h:78
SurgSim::Devices::LabJack::TIMERMODE_PWM_8BIT
@ TIMERMODE_PWM_8BIT
Definition: LabJackDevice.h:163
SurgSim::Devices::LabJack::FIO0
@ FIO0
Definition: LabJackDevice.h:52
SurgSim::Devices::LabJack::CONNECTION_USB
@ CONNECTION_USB
Definition: LabJackDevice.h:129
SurgSim::Devices::LabJack::TIMERMODE_FALLING_EDGES_32BIT
@ TIMERMODE_FALLING_EDGES_32BIT
Definition: LabJackDevice.h:165
SurgSim::Devices::LabJackDevice::setMaximumUpdateRate
void setMaximumUpdateRate(double rate)
Set the maximum update rate for the LabJackThread.
Definition: LabJackDevice.cpp:227
SurgSim::Devices::LabJack::TimerSettings
A struct holding the data to be associated with a Timer.
Definition: LabJackDevice.h:181
SurgSim::Devices::LabJackDevice::m_digitalInputChannels
std::unordered_set< int > m_digitalInputChannels
The line numbers for the digital inputs.
Definition: LabJackDevice.h:498
SurgSim::Devices::LabJackDevice::m_analogInputs
std::unordered_map< int, LabJack::AnalogInputSettings > m_analogInputs
The analog inputs. The key is the positive channel.
Definition: LabJackDevice.h:501
SurgSim::Devices::LabJack::RANGE_5
@ RANGE_5
Definition: LabJackDevice.h:202
SurgSim::Devices::LabJack::TIMERMODE_FREQUENCY_OUTPUT
@ TIMERMODE_FREQUENCY_OUTPUT
Definition: LabJackDevice.h:169
SurgSim::Devices::LabJack::MIO1
@ MIO1
Definition: LabJackDevice.h:85