提交 0041396f 编写于 作者: D Damien George

stm32/pin: In pin AF object, remove union of periph ptr types.

The individual union members (like SPI, I2C) are never used, only the
generic "reg" entry is.  And the union names can clash with macro
definitions in the HAL so better to remove them.
上级 f1073e74
......@@ -14,7 +14,7 @@
.fn = AF_FN_ ## af_fn, \
.unit = (af_unit), \
.type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \
.af_fn = (af_ptr) \
.reg = (af_ptr) \
}
#define PIN(p_port, p_pin, p_af, p_adc_num, p_adc_channel) \
......
......@@ -39,12 +39,7 @@ typedef struct {
uint8_t fn;
uint8_t unit;
uint8_t type;
union {
void *reg;
PIN_DEFS_PORT_AF_UNION
};
void *reg; // The peripheral associated with this AF
} pin_af_obj_t;
typedef struct {
......
......@@ -115,17 +115,5 @@ enum {
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.
// 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; \
void *SDMMC; \
typedef GPIO_TypeDef pin_gpio_t;
......@@ -15,7 +15,7 @@
.fn = AF_FN_ ## af_fn, \
.unit = (af_unit), \
.type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \
.af_fn = (af_ptr) \
.reg = (af_ptr) \
}
#define PIN(p_port, p_pin, p_num_af, p_af, p_adc_num, p_adc_channel) \
......
......@@ -40,10 +40,4 @@ enum {
AF_PIN_TYPE_UART_RTS,
};
#define PIN_DEFS_PORT_AF_UNION \
FTM_TypeDef *FTM; \
I2C_TypeDef *I2C; \
UART_TypeDef *UART; \
SPI_TypeDef *SPI;
typedef GPIO_TypeDef pin_gpio_t;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册