stm32/sdcard: Get SDMMC alt func macro names working with F4,F7,H7 MCUs.

This commit is contained in:
Damien George 2018-07-30 15:33:33 +10:00
parent aec6fa9160
commit 90fc7c5cfa

View File

@ -60,6 +60,12 @@
#define SDMMC_IRQn SDMMC1_IRQn
#define SDMMC_TX_DMA dma_SDIO_0_TX
#define SDMMC_RX_DMA dma_SDIO_0_RX
#define STATIC_AF_SDMMC_CK STATIC_AF_SDMMC1_CK
#define STATIC_AF_SDMMC_CMD STATIC_AF_SDMMC1_CMD
#define STATIC_AF_SDMMC_D0 STATIC_AF_SDMMC1_D0
#define STATIC_AF_SDMMC_D1 STATIC_AF_SDMMC1_D1
#define STATIC_AF_SDMMC_D2 STATIC_AF_SDMMC1_D2
#define STATIC_AF_SDMMC_D3 STATIC_AF_SDMMC1_D3
#endif
// The F7 & L4 series calls the peripheral SDMMC rather than SDIO, so provide some
@ -101,6 +107,12 @@
#define SDMMC_TX_DMA dma_SDIO_0_TX
#define SDMMC_RX_DMA dma_SDIO_0_RX
#define SDIO_USE_GPDMA 1
#define STATIC_AF_SDMMC_CK STATIC_AF_SDIO_CK
#define STATIC_AF_SDMMC_CMD STATIC_AF_SDIO_CMD
#define STATIC_AF_SDMMC_D0 STATIC_AF_SDIO_D0
#define STATIC_AF_SDMMC_D1 STATIC_AF_SDIO_D1
#define STATIC_AF_SDMMC_D2 STATIC_AF_SDIO_D2
#define STATIC_AF_SDMMC_D3 STATIC_AF_SDIO_D3
#endif
@ -150,12 +162,12 @@ void sdcard_init(void) {
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC2_D3, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC2_D3);
#else
// Default SDIO/SDMMC1 config
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D0, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDIO_D0);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D1, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDIO_D1);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D2, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDIO_D2);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D3, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDIO_D3);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_CK, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDIO_CK);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_CMD, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDIO_CMD);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D0, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC_D0);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D1, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC_D1);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D2, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC_D2);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_D3, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC_D3);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_CK, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC_CK);
mp_hal_pin_config_alt_static(MICROPY_HW_SDMMC_CMD, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC_CMD);
#endif
// configure the SD card detect pin