summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/pin_defs_stmhal.h
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/pin_defs_stmhal.h')
-rw-r--r--stmhal/pin_defs_stmhal.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/stmhal/pin_defs_stmhal.h b/stmhal/pin_defs_stmhal.h
index 2b6d9da0e7..05b62532db 100644
--- a/stmhal/pin_defs_stmhal.h
+++ b/stmhal/pin_defs_stmhal.h
@@ -45,7 +45,8 @@ enum {
AF_FN_I2C,
AF_FN_USART,
AF_FN_UART = AF_FN_USART,
- AF_FN_SPI
+ AF_FN_SPI,
+ AF_FN_I2S,
};
enum {
@@ -77,20 +78,43 @@ enum {
AF_PIN_TYPE_SPI_MISO,
AF_PIN_TYPE_SPI_SCK,
AF_PIN_TYPE_SPI_NSS,
+
+ AF_PIN_TYPE_I2S_CK = 0,
+ AF_PIN_TYPE_I2S_MCK,
+ AF_PIN_TYPE_I2S_SD,
+ AF_PIN_TYPE_I2S_WS,
+ AF_PIN_TYPE_I2S_EXTSD,
};
+// The HAL uses a slightly different naming than we chose, so we provide
+// some #defines to massage things. Also I2S and SPI share the same
+// peripheral.
+
+#define GPIO_AF5_I2S2 GPIO_AF5_SPI2
+#define GPIO_AF5_I2S3 GPIO_AF5_I2S3ext
+#define GPIO_AF6_I2S2 GPIO_AF6_I2S2ext
+#define GPIO_AF6_I2S3 GPIO_AF6_SPI3
+#define GPIO_AF7_I2S2 GPIO_AF7_SPI2
+#define GPIO_AF7_I2S3 GPIO_AF7_I2S3ext
+
+#define I2S2 SPI2
+#define I2S3 SPI3
+
enum {
PIN_ADC1 = (1 << 0),
PIN_ADC2 = (1 << 1),
PIN_ADC3 = (1 << 2),
};
+// Note that SPI and I2S are really the same peripheral as far as the HAL
+// is concerned, so there is no I2S_TypeDef.
#define PIN_DEFS_PORT_AF_UNION \
TIM_TypeDef *TIM; \
I2C_TypeDef *I2C; \
USART_TypeDef *USART; \
USART_TypeDef *UART; \
- SPI_TypeDef *SPI;
+ SPI_TypeDef *SPI;\
+ SPI_TypeDef *I2S;
typedef GPIO_TypeDef pin_gpio_t;