eive-obsw/linux/gpio/GpioCookie.cpp

25 lines
653 B
C++

#include "GpioCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
GpioCookie::GpioCookie() {
}
void GpioCookie::addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig){
auto gpioMapIter = gpioMap.find(gpioId);
if(gpioMapIter == gpioMap.end()) {
auto statusPair = gpioMap.emplace(gpioId, gpioConfig);
if (statusPair.second == false) {
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId <<
"to GPIO map" << std::endl;
}
return;
}
sif::error << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl;
}
GpioMap GpioCookie::getGpioMap() const {
return gpioMap;
}
GpioCookie::~GpioCookie() {}