2021-02-14 12:35:08 +01:00
|
|
|
#include "GpioCookie.h"
|
2021-02-01 11:17:20 +01:00
|
|
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
2021-01-16 12:22:17 +01:00
|
|
|
|
|
|
|
GpioCookie::GpioCookie() {
|
|
|
|
}
|
|
|
|
|
2021-02-01 11:17:20 +01:00
|
|
|
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()) {
|
2021-02-01 11:17:20 +01:00
|
|
|
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 "
|
2021-02-01 11:17:20 +01:00
|
|
|
<< 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() {}
|