SDMMC fix (PR #665, activating pullups)
This commit is contained in:
parent
49f169ce22
commit
cf87950e27
@ -35,6 +35,25 @@
|
||||
#define SDCARD_SCLK SCK
|
||||
#endif
|
||||
|
||||
// Default config for SDMMC_HOST_DEFAULT (4-bit bus width, slot 1)
|
||||
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sdmmc_host.html
|
||||
|
||||
#ifndef SDCARD_DATA0
|
||||
#define SDCARD_DATA0 2
|
||||
#endif
|
||||
|
||||
#ifndef SDCARD_DATA1
|
||||
#define SDCARD_DATA1 4
|
||||
#endif
|
||||
|
||||
#ifndef SDCARD_DATA2
|
||||
#define SDCARD_DATA2 12
|
||||
#endif
|
||||
|
||||
#ifndef SDCARD_DATA3
|
||||
#define SDCARD_DATA3 13
|
||||
#endif
|
||||
|
||||
#define SDCARD_FILE_NAME "/paxcount.%02d"
|
||||
#define SDCARD_FILE_HEADER "date, time, wifi, bluet"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
|
||||
|
||||
// enable only if you want to store a local paxcount table on the device
|
||||
#define HAS_SDCARD 1 // this board has an SD-card-reader/writer
|
||||
#define HAS_SDCARD 2 // // this board has a SDMMC card-reader/writer
|
||||
|
||||
#define HAS_DISPLAY 1
|
||||
#define HAS_LED (25) // green on board LED
|
||||
|
@ -22,11 +22,12 @@ bool sdcard_init() {
|
||||
|
||||
#if HAS_SDCARD == 1 // use SD SPI host driver
|
||||
useSDCard = SD.begin(SDCARD_CS, SDCARD_MOSI, SDCARD_MISO, SDCARD_SCLK);
|
||||
//SPI.begin(SDCARD_SCLK, SDCARD_MSO, SDCARD_MOSI, SDCARD_CS);
|
||||
//delay(10);
|
||||
//useSDCard = SD.begin(SDCARD_CS, SPI, 40000000, "/sd");
|
||||
|
||||
#elif HAS_SDCARD == 2 // use SD MMC host driver
|
||||
// enable internal pullups of sd-data lines
|
||||
gpio_set_pull_mode(gpio_num_t(SDCARD_DATA0), GPIO_PULLUP_ONLY);
|
||||
gpio_set_pull_mode(gpio_num_t(SDCARD_DATA1), GPIO_PULLUP_ONLY);
|
||||
gpio_set_pull_mode(gpio_num_t(SDCARD_DATA2), GPIO_PULLUP_ONLY);
|
||||
gpio_set_pull_mode(gpio_num_t(SDCARD_DATA3), GPIO_PULLUP_ONLY);
|
||||
useSDCard = SD_MMC.begin();
|
||||
#endif
|
||||
|
||||
@ -38,7 +39,8 @@ bool sdcard_init() {
|
||||
return useSDCard;
|
||||
}
|
||||
|
||||
void sdcardWriteData(uint16_t noWifi, uint16_t noBle, __attribute__((unused)) uint16_t noBleCWA) {
|
||||
void sdcardWriteData(uint16_t noWifi, uint16_t noBle,
|
||||
__attribute__((unused)) uint16_t noBleCWA) {
|
||||
static int counterWrites = 0;
|
||||
char tempBuffer[12 + 1];
|
||||
time_t t = now();
|
||||
|
Loading…
Reference in New Issue
Block a user