Commit 43defc9e authored by Damien George's avatar Damien George
Browse files

stmhal: Support SDMMC alternate functions in pin generation.

parent 29dd92c8
......@@ -14,7 +14,8 @@ SUPPORTED_FN = {
'I2S' : ['CK', 'MCK', 'SD', 'WS', 'EXTSD'],
'USART' : ['RX', 'TX', 'CTS', 'RTS', 'CK'],
'UART' : ['RX', 'TX', 'CTS', 'RTS'],
'SPI' : ['NSS', 'SCK', 'MISO', 'MOSI']
'SPI' : ['NSS', 'SCK', 'MISO', 'MOSI'],
'SDMMC' : ['CK', 'CMD', 'D0', 'D1', 'D2', 'D3'],
}
CONDITIONAL_VAR = {
......@@ -23,6 +24,7 @@ CONDITIONAL_VAR = {
'SPI' : 'MICROPY_HW_SPI{num}_SCK',
'UART' : 'MICROPY_HW_UART{num}_TX',
'USART' : 'MICROPY_HW_UART{num}_TX',
'SDMMC' : 'MICROPY_HW_SDMMC{num}_CK',
}
def parse_port_pin(name_str):
......
......@@ -48,6 +48,7 @@ enum {
AF_FN_UART = AF_FN_USART,
AF_FN_SPI,
AF_FN_I2S,
AF_FN_SDMMC,
};
enum {
......@@ -85,6 +86,13 @@ enum {
AF_PIN_TYPE_I2S_SD,
AF_PIN_TYPE_I2S_WS,
AF_PIN_TYPE_I2S_EXTSD,
AF_PIN_TYPE_SDMMC_CK = 0,
AF_PIN_TYPE_SDMMC_CMD,
AF_PIN_TYPE_SDMMC_D0,
AF_PIN_TYPE_SDMMC_D1,
AF_PIN_TYPE_SDMMC_D2,
AF_PIN_TYPE_SDMMC_D3,
};
// The HAL uses a slightly different naming than we chose, so we provide
......@@ -109,13 +117,15 @@ enum {
// Note that SPI and I2S are really the same peripheral as far as the HAL
// is concerned, so there is no I2S_TypeDef.
// We use void* for SDMMC because not all MCUs have the SDMMC_TypeDef type.
#define PIN_DEFS_PORT_AF_UNION \
TIM_TypeDef *TIM; \
I2C_TypeDef *I2C; \
USART_TypeDef *USART; \
USART_TypeDef *UART; \
SPI_TypeDef *SPI;\
SPI_TypeDef *I2S;
SPI_TypeDef *I2S; \
void *SDMMC; \
typedef GPIO_TypeDef pin_gpio_t;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment