Skip to content

Commit

Permalink
sdk: remove unneeded begin/endTransaction while sdcard_init/uninit (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostmorn authored Apr 13, 2024
1 parent aa14548 commit dc848ee
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sdk/lib/lilka/src/lilka/fileutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,8 @@ bool FileUtils::createSDPartTable() {
std::unique_ptr<uint8_t[]> workbufPtr(workbuf);

// init without mount
SPI1.beginTransaction(SPISettings(LILKA_SD_FREQUENCY, MSBFIRST, SPI_MODE0));
uint8_t pdrv = sdcard_init(LILKA_SDCARD_CS, &SPI1, LILKA_SD_FREQUENCY);
SPI1.endTransaction();

if (pdrv == 0xFF) {
xSemaphoreGive(sdMutex);
return false;
Expand All @@ -252,9 +251,7 @@ bool FileUtils::createSDPartTable() {
// SD card uninitializer (RAII)
std::unique_ptr<void, void (*)(void*)> sdcardUninit(nullptr, [](void* pdrv) {
// C++ is beautiful and ugly at the same time
SPI1.beginTransaction(SPISettings(LILKA_SD_FREQUENCY, MSBFIRST, SPI_MODE0));
sdcard_uninit(*static_cast<uint8_t*>(pdrv));
SPI1.endTransaction();
});

// Create partition table
Expand Down

0 comments on commit dc848ee

Please sign in to comment.