eive-obsw/linux/gpio/GpioCookie.cpp

27 lines
652 B
C++
Raw Normal View History

2021-02-14 12:35:08 +01:00
#include "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;
}
}
2021-02-14 17:44:16 +01:00
GpioMap& GpioCookie::getGpioMap() const {
2021-01-16 12:22:17 +01:00
return gpioMap;
}
GpioCookie::~GpioCookie() {}