-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPIO.h
More file actions
32 lines (25 loc) · 678 Bytes
/
GPIO.h
File metadata and controls
32 lines (25 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef GPIO_H
#define GPIO_H
#include <string>
enum GPIO_DIRECTION { IN, OUT };
enum GPIO_VALUE { LOW=0, HIGH=1 };
const std::string GPIO_PATH = "/sys/class/gpio/";
class GPIO {
private:
int number;
int holdTime;
std::string name, path;
public:
GPIO(int number, int holdTime);
virtual void setDirection(GPIO_DIRECTION);
virtual GPIO_DIRECTION getDirection();
virtual void setValue(GPIO_VALUE);
virtual GPIO_VALUE getValue();
virtual ~GPIO();
void status();
void pulse(GPIO_VALUE pulseVal);
private:
void exportGPIO();
void unexportGPIO();
};
#endif