eive-obsw/bsp_q7s/memory/SdCardAccess.cpp

23 lines
680 B
C++

#include "SdCardAccess.h"
#include "q7sConfig.h"
#include "SdCardAccessManager.h"
#include "fsfw/ipc/MutexGuard.h"
SdCardAccess::SdCardAccess(sd::SdCard sdCard) {
auto accessManager = SdCardAccessManager::instance();
MutexGuard(accessManager->mutex, MutexIF::TimeoutType::WAITING,
config::SD_CARD_ACCESS_MUTEX_TIMEOUT);
if(accessManager->getSdCardAccessors(sdCard) == 0) {
if(sdCard == sd::SdCard::SLOT_0) {
std::system("q7hw sd set 0 on");
accessManager->activeAccessesSdCard0++;
}
else {
std::system("q7hw sd set 1 on");
accessManager->activeAccessesSdCard1++;
}
}
}