nidas v1.2.3
ViperDIO.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2007, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26#ifndef NIDAS_DYNLD_VIPER_DIO_H
27#define NIDAS_DYNLD_VIPER_DIO_H
28
30
31#include <nidas/core/DOMable.h>
32
35#include <nidas/util/BitArray.h>
36
37namespace nidas { namespace dynld {
38
45class ViperDIO {
46
47public:
48
49 ViperDIO();
50
51 ~ViperDIO();
52
53 void setDeviceName(const std::string& val)
54 {
55 _devName = val;
56 }
57
58 const std::string& getDeviceName() const
59 {
60 return _devName;
61 }
62
63 const std::string& getName() const
64 {
65 return _devName;
66 }
67
68 int getFd() const { return _fd; }
69
75 void open();
76
82 void close();
83
89 int getNumOutputs() const
90 {
91 return _noutputs;
92 }
93
99 int getNumInputs() const
100 {
101 return _ninputs;
102 }
103
111 void clearOutputs(const nidas::util::BitArray& which);
112
120 void setOutputs(const nidas::util::BitArray& which);
121
129 void setOutputs(const nidas::util::BitArray& which,
130 const nidas::util::BitArray& val);
131
138
145
146private:
147
148 std::string _devName;
149
153 int _fd;
154
159
164
165};
166
167}} // namespace nidas namespace dynld
168
169#endif
Support for the digital IO on an Arcom Viper.
Definition ViperDIO.h:45
int getNumInputs() const
Return number of DIN pins on this device (8).
Definition ViperDIO.h:99
nidas::util::BitArray getInputs()
get current settings of IN0-7
Definition ViperDIO.cc:125
int _fd
The file descriptor of this device.
Definition ViperDIO.h:153
void setDeviceName(const std::string &val)
Definition ViperDIO.h:53
ViperDIO()
Definition ViperDIO.cc:43
int _ninputs
How many DIN pins are on this device?
Definition ViperDIO.h:163
nidas::util::BitArray getOutputs()
Get current settings of OUT0-7.
Definition ViperDIO.cc:115
~ViperDIO()
Definition ViperDIO.cc:47
int getNumOutputs() const
Return number of DOUT pins on this device (8).
Definition ViperDIO.h:89
void clearOutputs(const nidas::util::BitArray &which)
Clear, to low state, viper digital output ports OUT0-7, as selected by bits 0-7 of which.
Definition ViperDIO.cc:88
void setOutputs(const nidas::util::BitArray &which)
Set, to high state, viper digital output ports OUT0-7, as selected by bits 0-7 of which.
Definition ViperDIO.cc:76
std::string _devName
Definition ViperDIO.h:148
int getFd() const
Definition ViperDIO.h:68
const std::string & getName() const
Definition ViperDIO.h:63
const std::string & getDeviceName() const
Definition ViperDIO.h:58
int _noutputs
How many DOUT pins are on this device?
Definition ViperDIO.h:158
void open()
Open the DIO device.
Definition ViperDIO.cc:55
void close()
Close the DIO device.
Definition ViperDIO.cc:69
A class for holding bits.
Definition BitArray.h:39
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31