Files
remote-ui/server/gpio/gpio.hpp
T
2026-02-14 14:31:31 +01:00

34 lines
630 B
C++

#ifndef GPIO_HPP
#define GPIO_HPP
#include <QObject>
#if defined(__linux__) && (defined(__aarch64__) || defined(__x86_64__))
#include <gpiod.hpp>
#else
#endif
class GPIO : public QObject
{
Q_OBJECT
public:
enum Direction
{
Input,
Output
};
explicit GPIO(QObject *parent = nullptr);
~GPIO();
void configure_pin(Direction dir, uint8_t gpio);
void set_value(bool val);
bool value();
private:
#if defined(__linux__) && (defined(__aarch64__) || defined(__x86_64__))
std::unique_ptr<gpiod::line_request> m_request;
#endif
unsigned int m_offset;
};
#endif // GPIO_HPP