mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
* **New Features** * Added NFC chip-select to SD card hardware configuration. * **Refactor** * Consolidated and renamed icon resources; apps and status-bar now reference unified icon headers and new icon constants. * Renamed LVGL lock API (timed → lvgl_try_lock) and updated callers. * **Documentation** * Updated module README and license files; added Apache-2.0 license document.
37 lines
1019 B
C++
37 lines
1019 B
C++
#include "SdCard.h"
|
|
|
|
#include <tactility/device.h>
|
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
#include <Tactility/lvgl/LvglSync.h>
|
|
|
|
using tt::hal::sdcard::SpiSdCardDevice;
|
|
|
|
constexpr auto TPAGER_SDCARD_PIN_CS = GPIO_NUM_21;
|
|
constexpr auto TPAGER_LCD_PIN_CS = GPIO_NUM_38;
|
|
constexpr auto TPAGER_RADIO_PIN_CS = GPIO_NUM_36;
|
|
constexpr auto TPAGER_NFC_PIN_CS = GPIO_NUM_39;
|
|
|
|
std::shared_ptr<SdCardDevice> createTpagerSdCard() {
|
|
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
TPAGER_SDCARD_PIN_CS,
|
|
GPIO_NUM_NC,
|
|
GPIO_NUM_NC,
|
|
GPIO_NUM_NC,
|
|
SdCardDevice::MountBehaviour::AtBoot,
|
|
tt::lvgl::getSyncLock(),
|
|
std::vector {
|
|
TPAGER_RADIO_PIN_CS,
|
|
TPAGER_LCD_PIN_CS,
|
|
TPAGER_NFC_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
|
|
);
|
|
}
|