sdcard code sanitizations

This commit is contained in:
Klaus K Wilting committed 2020-06-06 15:09:12 +02:00
1 parent 46cc027ee4
commit 5dd5c481ad
2 files changed
+10 -5

No files matched your search

+8 -5
View File
@@ -1,12 +1,12 @@
// routines for writing data to an SD-card, if present
#if (HAS_SDCARD)
// Local logging tag
static const char TAG[] = __FILE__;
#include "sdcard.h"
#ifdef HAS_SDCARD
static bool useSDCard;
File fileSDCard;
@@ -14,10 +14,13 @@ File fileSDCard;
bool sdcard_init() {
ESP_LOGI(TAG, "looking for SD-card...");
#if HAS_SDCARD == 1
pinMode(SDCARD_CS, OUTPUT);
// for usage of SD drivers on ESP32 platform see
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sdspi_host.html
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sdmmc_host.html
#if HAS_SDCARD == 1 // use SD SPI host driver
useSDCard = SD.begin(SDCARD_CS, SDCARD_MOSI, SDCARD_MISO, SDCARD_SCLK);
#elif HAS_SDCARD == 2
#elif HAS_SDCARD == 2 // use SD MMC host driver
useSDCard = SD_MMC.begin();
#endif