-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGPIO.hpp
43 lines (39 loc) · 817 Bytes
/
GPIO.hpp
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
33
34
35
36
37
38
39
40
41
42
43
#ifndef GPIO_HPP_
#define GPIO_HPP_
#include "definitions.hpp"
enum class gpio_direction
{
INPUT,
OUTPUT
};
enum class gpio_event
{
RISING_EDGE,
FALLING_EDGE,
BOTH_EDGES
};
enum logic_level
{
ACTIVE_HIGH,
ACTIVE_LOW
};
/**
* @brief Generic class for all IO-pins
*
*/
class GPIO
{
protected:
public:
gpiod::line line;
gpiod::line_bulk lines;
GPIO(void) {}
~GPIO(void) { std::cout << "GPIO destructor called\n"; }
void GPIO_init(const uint8_t pin,
const char *alias,
const gpio_direction direction = gpio_direction::OUTPUT,
const logic_level logic_level = logic_level::ACTIVE_HIGH);
void GPIO_init_bulk_output(const ::std::vector<unsigned int> &pin, const char *alias);
bool active(void);
};
#endif