Multi-Volume. Select Media for LVGL (#21344)

This commit is contained in:
Victor Oliveira
2021-04-13 19:34:19 -03:00
committed by GitHub
parent a5f0075a60
commit 138340ee99
29 changed files with 546 additions and 279 deletions

View File

@@ -121,7 +121,7 @@ static enum {
uint32_t lun0_capacity;
#endif
bool Sd2Card::usbStartup() {
bool DiskIODriver_USBFlash::usbStartup() {
if (state <= DO_STARTUP) {
SERIAL_ECHOPGM("Starting USB host...");
if (!UHS_START) {
@@ -147,7 +147,7 @@ bool Sd2Card::usbStartup() {
// the USB library to monitor for such events. This function also takes care
// of initializing the USB library for the first time.
void Sd2Card::idle() {
void DiskIODriver_USBFlash::idle() {
usb.Task();
const uint8_t task_state = usb.getUsbTaskState();
@@ -258,16 +258,16 @@ void Sd2Card::idle() {
// Marlin calls this function to check whether an USB drive is inserted.
// This is equivalent to polling the SD_DETECT when using SD cards.
bool Sd2Card::isInserted() {
bool DiskIODriver_USBFlash::isInserted() {
return state == MEDIA_READY;
}
bool Sd2Card::isReady() {
return state > DO_STARTUP;
bool DiskIODriver_USBFlash::isReady() {
return state > DO_STARTUP && usb.getUsbTaskState() == UHS_STATE(RUNNING);
}
// Marlin calls this to initialize an SD card once it is inserted.
bool Sd2Card::init(const uint8_t, const pin_t) {
bool DiskIODriver_USBFlash::init(const uint8_t, const pin_t) {
if (!isInserted()) return false;
#if USB_DEBUG >= 1
@@ -286,7 +286,7 @@ bool Sd2Card::init(const uint8_t, const pin_t) {
}
// Returns the capacity of the card in blocks.
uint32_t Sd2Card::cardSize() {
uint32_t DiskIODriver_USBFlash::cardSize() {
if (!isInserted()) return false;
#if USB_DEBUG < 3
const uint32_t
@@ -295,7 +295,7 @@ uint32_t Sd2Card::cardSize() {
return lun0_capacity;
}
bool Sd2Card::readBlock(uint32_t block, uint8_t *dst) {
bool DiskIODriver_USBFlash::readBlock(uint32_t block, uint8_t *dst) {
if (!isInserted()) return false;
#if USB_DEBUG >= 3
if (block >= lun0_capacity) {
@@ -309,7 +309,7 @@ bool Sd2Card::readBlock(uint32_t block, uint8_t *dst) {
return bulk.Read(0, block, 512, 1, dst) == 0;
}
bool Sd2Card::writeBlock(uint32_t block, const uint8_t *src) {
bool DiskIODriver_USBFlash::writeBlock(uint32_t block, const uint8_t *src) {
if (!isInserted()) return false;
#if USB_DEBUG >= 3
if (block >= lun0_capacity) {