Skip to content

Commit

Permalink
sdcard code sanitizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus K Wilting committed Jun 6, 2020
1 parent 46cc027 commit 5dd5c48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions include/sdcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#endif
#endif

#ifdef HAS_SDS011
#include "sds011read.h"
#endif

#ifndef SDCARD_CS
#define SDCARD_CS SS
Expand Down
13 changes: 8 additions & 5 deletions src/sdcard.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
// 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;

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

Expand Down

0 comments on commit 5dd5c48

Please sign in to comment.