nidas v1.2.3
DSC_FreqCounter.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 ** 2008, 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_DSC_FREQCOUNTER_H
27#define NIDAS_DYNLD_DSC_FREQCOUNTER_H
28
32
33namespace nidas { namespace dynld {
34
35using namespace nidas::core;
36
47class DSC_FreqCounter : public DSMSensor {
48
49public:
50
53
58
63
70 void open(int flags);
71
75 void validate();
76
80 void init();
81
85 void printStatus(std::ostream& ostr);
86
90 double calculatePeriodUsec(const Sample*) const;
91
97 double calculatePeriodUsec(unsigned int npulses, unsigned int tics) const;
98
103 bool process(const Sample*,std::list<const Sample*>& result)
104 throw();
105
110 {
111 return _msecPeriod;
112 }
113
114
115protected:
116
120 virtual void readParams(const std::list<const Parameter*>& params);
121
123
125
127
132
138
140
141private:
142
145
148
149};
150
151}} // namespace nidas namespace dynld
152
153#endif
DSMSensor provides the basic support for reading, processing and distributing samples from a sensor a...
Definition DSMSensor.h:88
An interface to an IO device.
Definition IODevice.h:42
A scanner of sample data.
Definition SampleScanner.h:74
Interface to a data sample.
Definition Sample.h:190
Sensor support for a frequency counter device.
Definition DSC_FreqCounter.h:47
void open(int flags)
Open a GPIO-MM frequency counter.
Definition DSC_FreqCounter.cc:69
void init()
Definition DSC_FreqCounter.cc:111
IODevice * buildIODevice()
Definition DSC_FreqCounter.cc:59
int _msecPeriod
Definition DSC_FreqCounter.h:126
SampleScanner * buildSampleScanner()
Definition DSC_FreqCounter.cc:64
DSC_FreqCounter()
Definition DSC_FreqCounter.cc:46
double calculatePeriodUsec(const Sample *) const
Calculate the input pulse period in microseconds.
Definition DSC_FreqCounter.cc:164
virtual void readParams(const std::list< const Parameter * > &params)
Definition DSC_FreqCounter.cc:118
double _clockRate
Rate of reference clock whose tics are counted while _numPulses are counted.
Definition DSC_FreqCounter.h:137
DSC_FreqCounter & operator=(const DSC_FreqCounter &)
No assignment.
~DSC_FreqCounter()
Definition DSC_FreqCounter.cc:55
void validate()
Definition DSC_FreqCounter.cc:80
int _nvars
Definition DSC_FreqCounter.h:124
int getSamplePeriodMsec() const
Return the frequency sample period.
Definition DSC_FreqCounter.h:109
dsm_sample_id_t _sampleId
Definition DSC_FreqCounter.h:122
bool process(const Sample *, std::list< const Sample * > &result)
Process a raw sample, which in this case means convert the counts and elapsed ticks into a frequency.
Definition DSC_FreqCounter.cc:184
const nidas::util::EndianConverter * _cvtr
Definition DSC_FreqCounter.h:139
DSC_FreqCounter(const DSC_FreqCounter &)
No copying.
void printStatus(std::ostream &ostr)
Definition DSC_FreqCounter.cc:139
int _numPulses
Number of input pulses to count.
Definition DSC_FreqCounter.h:131
Virtual base class declaring methods for converting numeric values between little-endian and big-endi...
Definition EndianConverter.h:304
The essential core classes of nidas.
Definition A2DConverter.h:31
unsigned int dsm_sample_id_t
Definition Sample.h:64
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31