Update GPIO API #76

Merged
meierj merged 3 commits from mueller/update-gpio-api into eive/develop 2022-05-04 14:03:29 +02:00
2 changed files with 5 additions and 1 deletions
Showing only changes of commit 3556eca8e8 - Show all commits

View File

@ -46,7 +46,7 @@ class GpioIF : public HasReturnvaluesIF {
* an ouput or input gpio. * an ouput or input gpio.
* *
* @param gpioId A unique number which specifies the GPIO to read. * @param gpioId A unique number which specifies the GPIO to read.
* @param gpioState State of GPIO will be written to this pointer. * @param gpioState State of GPIO will be written to this reference
*/ */
virtual ReturnValue_t readGpio(gpioId_t gpioId, gpio::Levels& gpioState) = 0; virtual ReturnValue_t readGpio(gpioId_t gpioId, gpio::Levels& gpioState) = 0;
}; };

View File

@ -300,6 +300,10 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, gpio::Levels& gpioState)
return GPIO_TYPE_FAILURE; return GPIO_TYPE_FAILURE;
} }
gpioState = static_cast<gpio::Levels>(gpiod_line_get_value(regularGpio->lineHandle)); gpioState = static_cast<gpio::Levels>(gpiod_line_get_value(regularGpio->lineHandle));
if (gpioState == gpio::Levels::FAILED) {
// TODO: Print error
return RETURN_FAILED;
}
} else { } else {
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second); auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
if (gpioCallback->callback == nullptr) { if (gpioCallback->callback == nullptr) {