mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-07-30 15:01:59 +08:00

* Update WebSocket library * Update SSDP library * Update TFT_eSPI library * Update EspLuaEngine library * Update SDFat library * Change to pioarduino * Make ESP3DMessageFIFO and ESP3DMessage more thread safe * Fix sanity checks for BT * Add some C6 support * Refactor ethernet code * Split Ethernet Sta / WiFi sta ESP Commands and settings * Simplify wait and wdtFeed code * Set C3 with 4MB by default in platformio.ini * Apply Disable brown out only on ESP32 to avoid crash e.g:ESP32S3 * Add missing entries in platformio.ini
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
// Example to wipe all data from an already formatted SD.
|
|
#error wipe is not supported in SdFat V2. Use bool format(print_t* pr = nullptr).
|
|
#include <SPI.h>
|
|
#include "SdFat.h"
|
|
const int chipSelect = SS;
|
|
|
|
SdFat sd;
|
|
|
|
void setup() {
|
|
int c;
|
|
Serial.begin(9600);
|
|
// Wait for USB Serial
|
|
while (!Serial) {
|
|
yield();
|
|
}
|
|
Serial.println("Type 'Y' to wipe all data.");
|
|
while (!Serial.available()) {
|
|
yield();
|
|
}
|
|
c = Serial.read();
|
|
if (c != 'Y') {
|
|
sd.errorHalt("Quitting, you did not type 'Y'.");
|
|
}
|
|
// Initialize at the highest speed supported by the board that is
|
|
// not over 50 MHz. Try a lower speed if SPI errors occur.
|
|
if (!sd.begin(chipSelect, SD_SCK_MHZ(50))) {
|
|
sd.initErrorHalt();
|
|
}
|
|
// Use wipe() for no dot progress indicator.
|
|
if (!sd.wipe(&Serial)) {
|
|
sd.errorHalt("Wipe failed.");
|
|
}
|
|
// Must reinitialize after wipe.
|
|
// Initialize at the highest speed supported by the board that is
|
|
// not over 50 MHz. Try a lower speed if SPI errors occur.
|
|
if (!sd.begin(chipSelect, SD_SCK_MHZ(50))) {
|
|
sd.errorHalt("Second init failed.");
|
|
}
|
|
Serial.println("Done");
|
|
}
|
|
|
|
void loop() {
|
|
} |