implemented dtors

This commit is contained in:
Robin Müller 2021-04-11 12:29:54 +02:00
parent a12f036339
commit ee08658f55
3 changed files with 14 additions and 7 deletions

View File

@ -42,4 +42,8 @@ GpioMap GpioCookie::getGpioMap() const {
return gpioMap;
}
GpioCookie::~GpioCookie() {}
GpioCookie::~GpioCookie() {
for(auto& config: gpioMap) {
delete(config.second);
}
}

View File

@ -12,6 +12,9 @@ LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
}
LinuxLibgpioIF::~LinuxLibgpioIF() {
for(auto& config: gpioMap) {
delete(config.second);
}
}
ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) {

View File

@ -11,14 +11,14 @@ ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int
return HasReturnvaluesIF::RETURN_FAILED;
}
GpiodRegular config;
GpiodRegular* config = new GpiodRegular();
/* Default chipname for Raspberry Pi. There is still gpiochip1 for expansion, but most users
will not need this */
config.chipname = "gpiochip0";
config->chipname = "gpiochip0";
config.consumer = consumer;
config.direction = direction;
config.initValue = initValue;
config->consumer = consumer;
config->direction = direction;
config->initValue = initValue;
/* Sanity check for the BCM pins before assigning it */
if(bcmPin > 27) {
@ -31,7 +31,7 @@ ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
return HasReturnvaluesIF::RETURN_FAILED;
}
config.lineNum = bcmPin;
config->lineNum = bcmPin;
cookie->addGpio(gpioId, config);
return HasReturnvaluesIF::RETURN_OK;
}