1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/nucleo-f303re: add ADC feature

This commit is contained in:
hugues 2020-09-06 19:28:50 +02:00
parent 82ab75c2b4
commit dd52e3bdbc
3 changed files with 24 additions and 0 deletions

View File

@ -15,6 +15,7 @@ config BOARD_NUCLEO_F303RE
select CPU_MODEL_STM32F303RE
# Put defined MCU peripherals here (in alphabetical order)
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_PWM
select HAS_PERIPH_RTC

View File

@ -2,6 +2,7 @@ CPU = stm32
CPU_MODEL = stm32f303re
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -39,6 +39,28 @@
extern "C" {
#endif
/**
* @name ADC configuration
*
* Note that we do not configure all ADC channels,
* and not in the STM32F334 order. Instead, we
* just define 6 ADC channels, for the Nucleo
* Arduino header pins A0-A5
*
* @{
*/
static const adc_conf_t adc_config[] = {
{ .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 1 }, /* ADC1_IN1, fast */
{ .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 2 }, /* ADC1_IN2, fast */
{ .pin = GPIO_PIN(PORT_A, 4), .dev = 1, .chan = 1 }, /* ADC2_IN1, fast */
{ .pin = GPIO_PIN(PORT_B, 0), .dev = 2, .chan = 12 }, /* ADC3_IN12, slow */
{ .pin = GPIO_PIN(PORT_C, 1), .dev = 1, .chan = 7 }, /* ADC12_IN7, slow */
{ .pin = GPIO_PIN(PORT_C, 0), .dev = 1, .chan = 6 }, /* ADC12_IN6, slow */
};
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */
/**
* @name UART configuration
* @{