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.
pull/1/head
Damien George 2018-04-11 16:14:58 +10:00
parent f1073e747d
commit 0041396f05
5 changed files with 3 additions and 26 deletions

View File

@ -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) \

View File

@ -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 {

View File

@ -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;

View File

@ -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) \

View File

@ -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;