integrating fsfw_hal
This commit is contained in:
30
linux/archive/gpio/GpioCookie.cpp
Normal file
30
linux/archive/gpio/GpioCookie.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "GpioCookie.h"
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
GpioCookie::GpioCookie() {
|
||||
}
|
||||
|
||||
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpiodRegular& gpioConfig){
|
||||
auto gpioMapIter = gpioMap.find(gpioId);
|
||||
if(gpioMapIter == gpioMap.end()) {
|
||||
auto statusPair = gpioMap.emplace(gpioId, new GpiodRegular(gpioConfig));
|
||||
if (statusPair.second == false) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId <<
|
||||
"to GPIO map" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
sif::error << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
GpioMap GpioCookie::getGpioMap() const {
|
||||
return gpioMap;
|
||||
}
|
||||
|
||||
GpioCookie::~GpioCookie() {}
|
Reference in New Issue
Block a user