summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-03-30 17:52:20 +1100
committerDamien George <damien.p.george@gmail.com>2017-03-30 17:52:20 +1100
commit43defc9e98d27d370d1aa728c24ca48377ca6f66 (patch)
tree03cca2ab25c119f4f5ee9b5eac748e33a11c52c8
parent29dd92c82a6ea07f8d4f71c5c6d18c45ccefde39 (diff)
downloadmicropython-43defc9e98d27d370d1aa728c24ca48377ca6f66.tar.gz
micropython-43defc9e98d27d370d1aa728c24ca48377ca6f66.zip
stmhal: Support SDMMC alternate functions in pin generation.
-rwxr-xr-xstmhal/boards/make-pins.py4
-rw-r--r--stmhal/pin_defs_stmhal.h12
2 files changed, 14 insertions, 2 deletions
diff --git a/stmhal/boards/make-pins.py b/stmhal/boards/make-pins.py
index b33c92edc3..371ac77dd8 100755
--- a/stmhal/boards/make-pins.py
+++ b/stmhal/boards/make-pins.py
@@ -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):
diff --git a/stmhal/pin_defs_stmhal.h b/stmhal/pin_defs_stmhal.h
index 80c967016d..d6a2ef4242 100644
--- a/stmhal/pin_defs_stmhal.h
+++ b/stmhal/pin_defs_stmhal.h
@@ -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;