mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-19 03:13:14 +00:00
33 lines
845 B
C++
33 lines
845 B
C++
#include "SdCard.h"
|
|
|
|
#include <tactility/device.h>
|
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
#include <Tactility/lvgl/LvglSync.h>
|
|
|
|
constexpr auto CORE2_SDCARD_PIN_CS = GPIO_NUM_4;
|
|
constexpr auto CORE2_LCD_PIN_CS = GPIO_NUM_5;
|
|
|
|
using tt::hal::sdcard::SpiSdCardDevice;
|
|
|
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
CORE2_SDCARD_PIN_CS,
|
|
GPIO_NUM_NC,
|
|
GPIO_NUM_NC,
|
|
GPIO_NUM_NC,
|
|
SdCardDevice::MountBehaviour::AtBoot,
|
|
tt::lvgl::getSyncLock(),
|
|
std::vector {
|
|
CORE2_LCD_PIN_CS
|
|
}
|
|
);
|
|
|
|
auto* spi_controller = device_find_by_name("spi0");
|
|
check(spi_controller, "spi0 not found");
|
|
|
|
return std::make_shared<SpiSdCardDevice>(
|
|
std::move(configuration),
|
|
spi_controller
|
|
);
|
|
}
|