34 lines
833 B
C++
34 lines
833 B
C++
#include "SdCardAccessManager.h"
|
|
#include "fsfw/ipc/MutexFactory.h"
|
|
|
|
SdCardAccessManager* SdCardAccessManager::factoryInstance = nullptr;
|
|
|
|
SdCardAccessManager::~SdCardAccessManager() {
|
|
MutexFactory::instance()->deleteMutex(mutex);
|
|
}
|
|
|
|
void SdCardAccessManager::create() {
|
|
if(factoryInstance == nullptr) {
|
|
factoryInstance = new SdCardAccessManager();
|
|
}
|
|
}
|
|
|
|
SdCardAccessManager* SdCardAccessManager::instance() {
|
|
SdCardAccessManager::create();
|
|
return SdCardAccessManager::factoryInstance;
|
|
}
|
|
|
|
SdCardAccessManager::SdCardAccessManager() {
|
|
mutex = MutexFactory::instance()->createMutex();
|
|
|
|
}
|
|
|
|
uint8_t SdCardAccessManager::getSdCardAccessors(sd::SdCard sdCard) const {
|
|
if(sdCard == sd::SdCard::SLOT_0) {
|
|
return activeAccessesSdCard0;
|
|
}
|
|
else {
|
|
return activeAccessesSdCard1;
|
|
}
|
|
}
|