This commit is contained in:
Robin Müller 2021-04-01 15:54:21 +02:00
parent 8edc956ec8
commit 5f288ca4bc
3 changed files with 11 additions and 7 deletions

View File

@ -20,6 +20,10 @@ if(NOT LIB_FSFW_NAME)
message(ERROR "LIB_FSFW_NAME needs to be set as a linkable target") message(ERROR "LIB_FSFW_NAME needs to be set as a linkable target")
endif() endif()
target_include_directories(${LIB_FSFW_HAL_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
add_subdirectory(common) add_subdirectory(common)

View File

@ -1,6 +1,6 @@
#include "LinuxLibgpioIF.h" #include "LinuxLibgpioIF.h"
#include "../../common/gpio/GpioCookie.h" #include <common/gpio/gpioDefinitions.h>
#include "../../common/gpio/gpioDefinitions.h" #include <common/gpio/GpioCookie.h>
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
@ -8,7 +8,6 @@
#include <unistd.h> #include <unistd.h>
#include <gpiod.h> #include <gpiod.h>
LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) { LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
} }
@ -56,11 +55,11 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) {
break; break;
} }
case(gpio::GpioTypes::CALLBACK): { case(gpio::GpioTypes::CALLBACK): {
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second); auto gpioCallback = dynamic_cast<GpioCallback*>(gpioConfig.second);
if(gpioCallback->callback == nullptr) { if(gpioCallback->callback == nullptr) {
return GPIO_INVALID_INSTANCE; return GPIO_INVALID_INSTANCE;
} }
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::READ, gpioCallback->callback(gpioConfig.first, gpio::GpioOperation::WRITE,
gpioCallback->initValue, gpioCallback->callbackArgs); gpioCallback->initValue, gpioCallback->callbackArgs);
} }
} }
@ -88,7 +87,8 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular
lineNum = regularGpio->lineNum; lineNum = regularGpio->lineNum;
lineHandle = gpiod_chip_get_line(chip, lineNum); lineHandle = gpiod_chip_get_line(chip, lineNum);
if (!lineHandle) { if (!lineHandle) {
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line" << std::endl; sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line for GPIO with id "
<< gpioId << std::endl;
gpiod_chip_close(chip); gpiod_chip_close(chip);
return RETURN_FAILED; return RETURN_FAILED;
} }

View File

@ -1,7 +1,7 @@
#ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_ #ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_
#define LINUX_GPIO_LINUXLIBGPIOIF_H_ #define LINUX_GPIO_LINUXLIBGPIOIF_H_
#include "../../common/gpio/GpioIF.h" #include <common/gpio/GpioIF.h>
#include <returnvalues/classIds.h> #include <returnvalues/classIds.h>
#include <fsfw/objectmanager/SystemObject.h> #include <fsfw/objectmanager/SystemObject.h>