eive-obsw/bsp_q7s/gpio/cookies/GpioCookie.cpp

27 lines
671 B
C++
Raw Normal View History

2021-01-23 17:22:40 +01:00
#include <bsp_q7s/gpio/cookies/GpioCookie.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
2021-01-16 12:22:17 +01:00
GpioCookie::GpioCookie() {
}
void GpioCookie::addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig){
gpioMapIter = gpioMap.find(gpioId);
2021-01-16 12:22:17 +01:00
if(gpioMapIter == gpioMap.end()) {
std::pair status = gpioMap.emplace(gpioId, gpioConfig);
2021-01-16 12:22:17 +01:00
if (status.second == false) {
sif::error << "GpioCookie::addGpio: Failed to add GPIO "
<< gpioId << "to GPIO map" << std::endl;
2021-01-16 12:22:17 +01:00
}
}
else {
sif::error << "GpioCookie::addGpio: GPIO already exists in GPIO map "
<< std::endl;
}
}
GpioMap GpioCookie::getGpioMap() const{
2021-01-16 12:22:17 +01:00
return gpioMap;
}
GpioCookie::~GpioCookie() {}