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")
endif()
target_include_directories(${LIB_FSFW_HAL_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
add_subdirectory(common)

View File

@ -1,6 +1,6 @@
#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>
@ -8,7 +8,6 @@
#include <unistd.h>
#include <gpiod.h>
LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
}
@ -56,11 +55,11 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) {
break;
}
case(gpio::GpioTypes::CALLBACK): {
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioConfig.second);
if(gpioCallback->callback == nullptr) {
return GPIO_INVALID_INSTANCE;
}
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::READ,
gpioCallback->callback(gpioConfig.first, gpio::GpioOperation::WRITE,
gpioCallback->initValue, gpioCallback->callbackArgs);
}
}
@ -88,7 +87,8 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular
lineNum = regularGpio->lineNum;
lineHandle = gpiod_chip_get_line(chip, lineNum);
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);
return RETURN_FAILED;
}

View File

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