Skip to content

Commit 2aed417

Browse files
committed
Enable 1bit SDMMC for Olimex ESP32-EVB
Fixes: #495 (comment) 2612
1 parent 91d02cc commit 2aed417

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

libraries/SD_MMC/src/SD_MMC.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SDMMCFS::SDMMCFS(FSImplPtr impl)
3434
: FS(impl), _card(NULL)
3535
{}
3636

37-
bool SDMMCFS::begin(const char * mountpoint)
37+
bool SDMMCFS::begin(const char * mountpoint, bool mode1bit)
3838
{
3939
if(_card) {
4040
return true;
@@ -43,7 +43,12 @@ bool SDMMCFS::begin(const char * mountpoint)
4343
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
4444
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
4545
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
46-
//host.flags = SDMMC_HOST_FLAG_1BIT; //use 1-line SD mode
46+
#ifdef BOARD_HAS_1BIT_SDMMC
47+
mode1bit = true;
48+
#endif
49+
if(mode1bit) {
50+
host.flags = SDMMC_HOST_FLAG_1BIT; //use 1-line SD mode
51+
}
4752

4853
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
4954
.format_if_mount_failed = false,

libraries/SD_MMC/src/SD_MMC.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SDMMCFS : public FS
2828

2929
public:
3030
SDMMCFS(FSImplPtr impl);
31-
bool begin(const char * mountpoint="/sdcard");
31+
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false);
3232
void end();
3333
sdcard_type_t cardType();
3434
uint64_t cardSize();

variants/esp32-evb/pins_arduino.h

+2
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ static const uint8_t MOSI = 2;
2525
static const uint8_t MISO = 15;
2626
static const uint8_t SCK = 14;
2727

28+
#define BOARD_HAS_1BIT_SDMMC
29+
2830
#endif /* Pins_Arduino_h */

0 commit comments

Comments
 (0)