gpio cookie update
This commit is contained in:
parent
7ffae254b1
commit
8edc956ec8
@ -1,30 +1,33 @@
|
|||||||
#include "GpioCookie.h"
|
#include "GpioCookie.h"
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
GpioCookie::GpioCookie() {
|
GpioCookie::GpioCookie() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpiodRegular& gpioConfig){
|
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) {
|
||||||
auto gpioMapIter = gpioMap.find(gpioId);
|
if (gpioConfig == nullptr) {
|
||||||
if(gpioMapIter == gpioMap.end()) {
|
sif::debug << "GpioCookie::addGpio: gpioConfig is nullpointer" << std::endl;
|
||||||
auto statusPair = gpioMap.emplace(gpioId, new GpiodRegular(gpioConfig));
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
if (statusPair.second == false) {
|
}
|
||||||
|
auto gpioMapIter = gpioMap.find(gpioId);
|
||||||
|
if(gpioMapIter == gpioMap.end()) {
|
||||||
|
auto statusPair = gpioMap.emplace(gpioId, gpioConfig);
|
||||||
|
if (statusPair.second == false) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId <<
|
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId <<
|
||||||
"to GPIO map" << std::endl;
|
" to GPIO map" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
sif::error << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl;
|
sif::error << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
GpioMap GpioCookie::getGpioMap() const {
|
GpioMap GpioCookie::getGpioMap() const {
|
||||||
return gpioMap;
|
return gpioMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
GpioCookie::~GpioCookie() {}
|
GpioCookie::~GpioCookie() {}
|
||||||
|
@ -23,7 +23,8 @@ public:
|
|||||||
|
|
||||||
virtual ~GpioCookie();
|
virtual ~GpioCookie();
|
||||||
|
|
||||||
ReturnValue_t addGpio(gpioId_t gpioId, GpiodRegular& gpioConfig);
|
ReturnValue_t addGpio(gpioId_t gpioId, GpioBase* gpioConfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get map with registered GPIOs.
|
* @brief Get map with registered GPIOs.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user