Show the file size of the files in the tmp_dir on the LCD.
[ruwai.git] / software / c++ / ruwaicom / src / libgpio / gpio.h
blob1bd666920a3770174dd47364b6d1fe662a9bb108
1 /*--------------------------------------------------------------------------*/
2 // LICENSE
3 //
4 // This file is part of ruwai.
5 //
6 // If you use ruwai_parser in any program or publication, please inform and
7 // acknowledge its author Stefan Mertl (stefan@mertl-research.at).
8 //
9 // ruwai 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 3 of the License, or
12 // (at your option) any later version.
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.
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 /*--------------------------------------------------------------------------*/
23 #ifndef GPIO_H
24 #define GPIO_H
26 #define GPIO_PATH "/sys/class/gpio/"
28 #include <string>
30 typedef enum gpio_direction_e {
31 INPUT = 0,
32 OUTPUT = 1
33 } gpio_direction_t;
36 typedef enum gpio_value_e {
37 LOW = 0,
38 HIGH = 1
39 }gpio_value_t;
42 class GPIO {
44 private:
45 int number; // The GPIO number of the object.
46 std::string name; // The name of the GPIO.
47 std::string path; // The full path to the GPIO.
50 public:
51 GPIO(int gpio_number);
52 virtual ~GPIO();
54 virtual int set_direction(gpio_direction_t);
55 virtual int set_value(gpio_value_t);
57 private:
58 int export_gpio(void);
59 int unexport_gpio(void);
60 int write(std::string path, std::string filename, std::string value);
61 int write(std::string path, std::string filename, int value);
65 #endif /* GPIO_H */