rework SD card logging

This commit is contained in:
cyberman54 committed 2022-02-26 17:30:23 +01:00
1 parent 2a6a7d001b
commit 42aa481c70
3 files changed
+230 -127

No files matched your search

+7 -21
View File
@@ -6,11 +6,15 @@
#include "globals.h"
#include <stdio.h>
#include <SPI.h>
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#define MOUNT_POINT "/sdcard"
#if HAS_SDCARD == 1
#include <SD.h>
#include "driver/sdspi_host.h"
#elif HAS_SDCARD == 2
#include <SD_MMC.h>
#include "driver/sdmmc_host.h"
#else
#error HAS_SDCARD unknown card reader value, must be either 1 or 2
#endif
@@ -35,25 +39,6 @@
#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 clientId
#define SDCARD_FILE_HEADER "timestamp,wifi,ble"
@@ -62,6 +47,7 @@
#endif
bool sdcard_init(bool create = true);
void sdcard_flush(void);
void sdcard_close(void);
void sdcardWriteData(uint16_t, uint16_t, uint16_t = 0);