mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
23 lines
936 B
C++
23 lines
936 B
C++
#include "SdCard.h"
|
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
#include <Tactility/RecursiveMutex.h>
|
|
|
|
using tt::hal::sdcard::SpiSdCardDevice;
|
|
using SdCardDevice = tt::hal::sdcard::SdCardDevice;
|
|
|
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
SD_CS_PIN, // CS pin (IO5 on the module)
|
|
GPIO_NUM_NC, // MOSI override: leave NC to use SPI host pins
|
|
GPIO_NUM_NC, // MISO override: leave NC
|
|
GPIO_NUM_NC, // SCLK override: leave NC
|
|
SdCardDevice::MountBehaviour::AtBoot,
|
|
std::make_shared<tt::RecursiveMutex>(),
|
|
std::vector<gpio_num_t>(),
|
|
SD_SPI_HOST // SPI host for SD card (SPI3_HOST)
|
|
);
|
|
|
|
return std::make_shared<SpiSdCardDevice>(
|
|
std::move(configuration)
|
|
);
|
|
} |