global: add ADC macros

This commit is contained in:
King Kévin 2020-12-14 13:34:52 +01:00
parent 579aed6e39
commit 25f0235192
1 changed files with 57 additions and 1 deletions

View File

@ -460,7 +460,7 @@ int32_t adds32_safe(int32_t a, int32_t b);
#define USART_IRQ(x) CAT3(NVIC_USART,x,_IRQ)
/** get interrupt service routine for USART based on USART identifier */
#define USART_ISR(x) CAT3(usart,x,_isr)
/** get channel based on ADC12_IN identifier */
/** get channel based on ADC1_IN identifier */
#define ADC_CHANNEL(x) CAT2(ADC_CHANNEL,x)
/** get SPI based on SPI identifier */
#define SPI(x) CAT2(SPI,x)
@ -480,6 +480,62 @@ int32_t adds32_safe(int32_t a, int32_t b);
#define I2C(x) CAT2(I2C,x)
/** get RCC for I²C based on I²C identifier */
#define RCC_I2C(x) CAT2(RCC_I2C,x)
/** get port based on ADC1_IN identifier */
#define ADC1_IN_PORT(x) CAT3(ADC1_IN,x,_PORT)
#define ADC1_IN0_PORT GPIOA /**< ADC1_IN0 is on PA0 */
#define ADC1_IN1_PORT GPIOA /**< ADC1_IN1 is on PA1 */
#define ADC1_IN2_PORT GPIOA /**< ADC1_IN2 is on PA2 */
#define ADC1_IN3_PORT GPIOA /**< ADC1_IN3 is on PA3 */
#define ADC1_IN4_PORT GPIOA /**< ADC1_IN4 is on PA4 */
#define ADC1_IN5_PORT GPIOA /**< ADC1_IN5 is on PA5 */
#define ADC1_IN6_PORT GPIOA /**< ADC1_IN6 is on PA6 */
#define ADC1_IN7_PORT GPIOA /**< ADC1_IN7 is on PA7 */
#define ADC1_IN8_PORT GPIOB /**< ADC1_IN8 is on PB0 */
#define ADC1_IN9_PORT GPIOB /**< ADC1_IN9 is on PB1 */
#define ADC1_IN10_PORT GPIOC /**< ADC1_IN10 is on PC0 */
#define ADC1_IN11_PORT GPIOC /**< ADC1_IN11 is on PC1 */
#define ADC1_IN12_PORT GPIOC /**< ADC1_IN12 is on PC2 */
#define ADC1_IN13_PORT GPIOC /**< ADC1_IN13 is on PC3 */
#define ADC1_IN14_PORT GPIOC /**< ADC1_IN14 is on PC4 */
#define ADC1_IN15_PORT GPIOC /**< ADC1_IN15 is on PC5 */
/** get pin based on ADC1_IN identifier */
#define ADC1_IN_PIN(x) CAT3(ADC1_IN,x,_PIN)
#define ADC1_IN0_PIN GPIO0 /**< ADC1_IN0 is on PA0 */
#define ADC1_IN1_PIN GPIO1 /**< ADC1_IN1 is on PA1 */
#define ADC1_IN2_PIN GPIO2 /**< ADC1_IN2 is on PA2 */
#define ADC1_IN3_PIN GPIO3 /**< ADC1_IN3 is on PA3 */
#define ADC1_IN4_PIN GPIO4 /**< ADC1_IN4 is on PA4 */
#define ADC1_IN5_PIN GPIO5 /**< ADC1_IN5 is on PA5 */
#define ADC1_IN6_PIN GPIO6 /**< ADC1_IN6 is on PA6 */
#define ADC1_IN7_PIN GPIO7 /**< ADC1_IN7 is on PA7 */
#define ADC1_IN8_PIN GPIO0 /**< ADC1_IN8 is on PB0 */
#define ADC1_IN9_PIN GPIO1 /**< ADC1_IN9 is on PB1 */
#define ADC1_IN10_PIN GPIO0 /**< ADC1_IN10 is on PC0 */
#define ADC1_IN11_PIN GPIO1 /**< ADC1_IN11 is on PC1 */
#define ADC1_IN12_PIN GPIO2 /**< ADC1_IN12 is on PC2 */
#define ADC1_IN13_PIN GPIO3 /**< ADC1_IN13 is on PC3 */
#define ADC1_IN14_PIN GPIO4 /**< ADC1_IN14 is on PC4 */
#define ADC1_IN15_PIN GPIO5 /**< ADC1_IN15 is on PC5 */
/** get RCC based on ADC1_IN identifier */
#define RCC_ADC1_IN(x) CAT2(RCC_ADC1_IN,x)
#define RCC_ADC1_IN0 RCC_GPIOA /**< ADC1_IN0 is on PA0 */
#define RCC_ADC1_IN1 RCC_GPIOA /**< ADC1_IN1 is on PA1 */
#define RCC_ADC1_IN2 RCC_GPIOA /**< ADC1_IN2 is on PA2 */
#define RCC_ADC1_IN3 RCC_GPIOA /**< ADC1_IN3 is on PA3 */
#define RCC_ADC1_IN4 RCC_GPIOA /**< ADC1_IN4 is on PA4 */
#define RCC_ADC1_IN5 RCC_GPIOA /**< ADC1_IN5 is on PA5 */
#define RCC_ADC1_IN6 RCC_GPIOA /**< ADC1_IN6 is on PA6 */
#define RCC_ADC1_IN7 RCC_GPIOA /**< ADC1_IN7 is on PA7 */
#define RCC_ADC1_IN8 RCC_GPIOB /**< ADC1_IN8 is on PB0 */
#define RCC_ADC1_IN9 RCC_GPIOB /**< ADC1_IN9 is on PB1 */
#define RCC_ADC1_IN10 RCC_GPIOC /**< ADC1_IN10 is on PC0 */
#define RCC_ADC1_IN11 RCC_GPIOC /**< ADC1_IN11 is on PC1 */
#define RCC_ADC1_IN12 RCC_GPIOC /**< ADC1_IN12 is on PC2 */
#define RCC_ADC1_IN13 RCC_GPIOC /**< ADC1_IN13 is on PC3 */
#define RCC_ADC1_IN14 RCC_GPIOC /**< ADC1_IN14 is on PC4 */
#define RCC_ADC1_IN15 RCC_GPIOC /**< ADC1_IN15 is on PC5 */
/** get channel based on ADC1_IN identifier */
#define ADC_CHANNEL(x) CAT2(ADC_CHANNEL,x)
/** @} */
/** @defgroup board_led board LED GPIO