libkovan  1
The kovan standard library
analog.hpp
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright 2012 KISS Institute for Practical Robotics *
3  * *
4  * This file is part of libkovan. *
5  * *
6  * libkovan is free software: you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation, either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * libkovan is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with libkovan. Check the LICENSE file in the project root. *
18  * If not, see <http://www.gnu.org/licenses/>. *
19  **************************************************************************/
20 
29 #ifndef _ANALOG_HPP_
30 #define _ANALOG_HPP_
31 
32 #include "sensor.hpp"
33 
34 #include "export.h"
35 
44 class EXPORT_SYM Analog : public Sensor<unsigned short>
45 {
46 public:
47  Analog(const unsigned char& port);
48 
49  virtual unsigned short value() const;
50 
51  virtual void setPullup(bool pullup);
52  virtual bool pullup() const;
53 
58  unsigned char port() const;
59 
60 private:
61  unsigned char m_port;
62 };
63 
72 class EXPORT_SYM Analog8 : public Analog
73 {
74 public:
75  Analog8(const unsigned char& port);
76  virtual unsigned short value() const;
77 };
78 
79 #endif
The base class for all sensors of any type.
Definition: sensor.hpp:45
virtual unsigned short value() const
Base sensor classes.
virtual T value() const =0
A derivative of the Analog class that returns 8 bit values rather than 10 bit ones.
Definition: analog.hpp:72
Implements the sensor type "analog".
Definition: analog.hpp:44
#define EXPORT_SYM
Definition: export.h:7