stm32/sdcard: Support boards with no SD card detect pin.
If MICROPY_HW_SDCARD_DETECT_PIN is not defined then the SD card will always be detected as present.
This commit is contained in:
parent
3117fde407
commit
305f537bf9
@ -175,7 +175,9 @@ void sdcard_init(void) {
|
|||||||
|
|
||||||
// configure the SD card detect pin
|
// configure the SD card detect pin
|
||||||
// we do this here so we can detect if the SD card is inserted before powering it on
|
// we do this here so we can detect if the SD card is inserted before powering it on
|
||||||
|
#if defined(MICROPY_HW_SDCARD_DETECT_PIN)
|
||||||
mp_hal_pin_config(MICROPY_HW_SDCARD_DETECT_PIN, MP_HAL_PIN_MODE_INPUT, MICROPY_HW_SDCARD_DETECT_PULL, 0);
|
mp_hal_pin_config(MICROPY_HW_SDCARD_DETECT_PIN, MP_HAL_PIN_MODE_INPUT, MICROPY_HW_SDCARD_DETECT_PULL, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void sdmmc_msp_init(void) {
|
STATIC void sdmmc_msp_init(void) {
|
||||||
@ -231,7 +233,11 @@ bool sdcard_is_present(void) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(MICROPY_HW_SDCARD_DETECT_PIN)
|
||||||
return HAL_GPIO_ReadPin(MICROPY_HW_SDCARD_DETECT_PIN->gpio, MICROPY_HW_SDCARD_DETECT_PIN->pin_mask) == MICROPY_HW_SDCARD_DETECT_PRESENT;
|
return HAL_GPIO_ReadPin(MICROPY_HW_SDCARD_DETECT_PIN->gpio, MICROPY_HW_SDCARD_DETECT_PIN->pin_mask) == MICROPY_HW_SDCARD_DETECT_PRESENT;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MICROPY_HW_ENABLE_SDCARD
|
#if MICROPY_HW_ENABLE_SDCARD
|
||||||
|
Loading…
x
Reference in New Issue
Block a user