Skip to content

Commit 890a87b

Browse files
committed
Support no default CS pin for espressif S3 devkit
1 parent 50e8153 commit 890a87b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Wippersnapper_Boards.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,10 @@
283283
#warning "Board type not identified within Wippersnapper_Boards.h!"
284284
#endif
285285

286+
#ifndef SD_CS_PIN
287+
#warning \
288+
"SD_CS_PIN not defined! Double check board definition in Wippersnapper_Boards.h as user will be forced to specify in config.json"
289+
#define SD_CS_PIN SD_CS_CFG_NOT_FOUND // No default CS pin
290+
#endif
291+
286292
#endif // ADAFRUIT_WIPPERSNAPPER_BOARDS_H

src/provisioning/sdcard/ws_sdcard.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
otherwise.
2323
*/
2424
bool ws_sdcard::InitSdCard(uint8_t pin_cs) {
25+
if (pin_cs == SD_CS_CFG_NOT_FOUND) {
26+
WS_DEBUG_PRINT("[SD] Init Error: CS pin is undefined. Add \"sd_cs_pin\" to "
27+
"exportedFromDevice section of config.json file.");
28+
return false;
29+
}
2530
WsV2.pin_sd_cs = pin_cs;
2631
#ifdef SD_USE_SPI_1
2732
SdSpiConfig _sd_spi_cfg(pin_cs, DEDICATED_SPI, SPI_SD_CLOCK, &SPI1);

0 commit comments

Comments
 (0)