mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Add optional power supply enable pin for SD card
This commit is contained in:
parent
290627739e
commit
f03dd96a47
@ -71,7 +71,9 @@ void jsfsReportError(const char *msg, FRESULT res) {
|
||||
}
|
||||
|
||||
bool jsfsInit() {
|
||||
|
||||
#ifdef SD_POWER_PIN
|
||||
jshPinOutput(SD_POWER_PIN, 1);
|
||||
#endif
|
||||
#ifndef LINUX
|
||||
if (!fat_initialised) {
|
||||
#ifndef USE_FLASHFS
|
||||
|
||||
@ -521,6 +521,9 @@ void jswrap_pb_setLCDPower(bool isOn) {
|
||||
"generate" : "jswrap_pb_init"
|
||||
}*/
|
||||
void jswrap_pb_init() {
|
||||
#ifdef SD_POWER_PIN
|
||||
jshPinOutput(SD_POWER_PIN, 1); // Power supply enable for the SD card is also used for the ES8388 audio codec
|
||||
#endif
|
||||
#ifdef USE_AUDIO_CODEC
|
||||
// Initialise audio
|
||||
STM32_I2S_Init();
|
||||
|
||||
@ -446,6 +446,8 @@ if "LCD" in board.devices:
|
||||
codeOutDevicePins("LCD","LCD");
|
||||
|
||||
if "SD" in board.devices:
|
||||
if "pin_cd" in board.devices["SD"]: codeOutDevicePin("SD", "pin_cd", "SD_DETECT_PIN")
|
||||
if "pin_pwr" in board.devices["SD"]: codeOutDevicePin("SD", "pin_pwr", "SD_POWER_PIN")
|
||||
if not "pin_d3" in board.devices["SD"]: # NOT SDIO - normal SD
|
||||
if "pin_cs" in board.devices["SD"]: codeOutDevicePin("SD", "pin_cs", "SD_CS_PIN")
|
||||
if "pin_di" in board.devices["SD"]: codeOutDevicePin("SD", "pin_di", "SD_DI_PIN")
|
||||
|
||||
@ -2622,6 +2622,10 @@ bool jshSleep(JsSysTime timeUntilWake) {
|
||||
#endif
|
||||
#endif // USB
|
||||
|
||||
#ifdef SD_POWER_PIN
|
||||
jshPinOutput(SD_POWER_PIN, 0); // Turn off the power supply for the SD card (and the ES8388 audio codec)
|
||||
#endif
|
||||
|
||||
if (timeUntilWake!=JSSYSTIME_MAX) { // set alarm
|
||||
unsigned int ticks = (unsigned int)(timeUntilWake/jshGetTimeForSecond()); // ensure we round down and leave a little time
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user