3#include <stm32g4xx_hal.h>
8#define CORE_ADC_ALLOWED_ADC1 0x0001
9#define CORE_ADC_ALLOWED_ADC2 0x0002
10#define CORE_ADC_ALLOWED_ADC3 0x0004
11#define CORE_ADC_ALLOWED_ADC4 0x0008
12#define CORE_ADC_ALLOWED_ADC5 0x0010
13#define CORE_ADC_ALLOWED_OPAMP1 0x0100
14#define CORE_ADC_ALLOWED_OPAMP2 0x0200
15#define CORE_ADC_ALLOWED_OPAMP3 0x0400
16#define CORE_ADC_ALLOWED_OPAMP4 0x0800
17#define CORE_ADC_ALLOWED_OPAMP5 0x1000
18#define CORE_ADC_ALLOWED_OPAMP6 0x2000
19#define CORE_ADC_ALLOWED_ADC_MASK 0x001f
20#define CORE_ADC_ALLOWED_OPAMP_MASK 0x3f00
26 uint16_t allowed_connections;
33 uint8_t opamp_chan_sel;
37bool core_ADC_init(ADC_TypeDef *adc);
38bool core_ADC_setup_pin(GPIO_TypeDef *port, uint32_t pin, uint8_t opamp);
39bool core_ADC_read_channel(GPIO_TypeDef *port, uint32_t pin, uint16_t *result);
40uint16_t core_ADC_read_vrefint();