35 lines
507 B
C++
35 lines
507 B
C++
#ifndef GPIO_HPP_
|
|
#define GPIO_HPP_
|
|
|
|
class gpio
|
|
{
|
|
public:
|
|
enum class pin_direction
|
|
{
|
|
INPUT,
|
|
OUTPUT
|
|
};
|
|
enum class pin_type
|
|
{
|
|
HIGH_ON,
|
|
LOW_ON
|
|
};
|
|
|
|
private:
|
|
int pin;
|
|
pin_direction direction;
|
|
pin_type type;
|
|
bool current_state;
|
|
void set_value(bool on, bool use_cache);
|
|
public:
|
|
gpio(int pin, pin_direction, pin_type=pin_type::HIGH_ON, bool default_state=false);
|
|
gpio(const gpio&) = delete;
|
|
gpio(gpio&&);
|
|
~gpio();
|
|
void set_value(bool on);
|
|
bool get_value();
|
|
int get_pin() const;
|
|
};
|
|
|
|
#endif
|