1234567891011121314151617181920212223242526 |
- #include "gpiomanager.h"
- #include <wiringPi.h>
-
- GpioManager::GpioManager(QObject *parent) : InputManager(parent)
- {
- }
-
- GpioManager::~GpioManager()
- {
- }
-
- bool GpioManager::init(const QVariant &pins)
- {
- if (wiringPiSetupPhys())
- return false;
- auto list = pins.toList();
- foreach (auto pin, list)
- pinMode(pin.toInt(), INPUT);
- return true;
- }
-
- QVariant GpioManager::read(const QVariant &pin)
- {
- return digitalRead(pin.toInt());
- }
|