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

boards/nucleo-f207zg: add ADC support

This commit is contained in:
krzysztof-cabaj 2022-11-03 16:20:56 -04:00
parent b61a203053
commit cfd0183f60
3 changed files with 35 additions and 7 deletions

View File

@ -15,6 +15,7 @@ config BOARD_NUCLEO_F207ZG
select CPU_MODEL_STM32F207ZG select CPU_MODEL_STM32F207ZG
# Put defined MCU peripherals here (in alphabetical order) # Put defined MCU peripherals here (in alphabetical order)
select HAS_PERIPH_ADC
select HAS_PERIPH_DMA select HAS_PERIPH_DMA
select HAS_PERIPH_ETH select HAS_PERIPH_ETH
select HAS_PERIPH_I2C select HAS_PERIPH_I2C

View File

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

View File

@ -228,20 +228,46 @@ static const spi_conf_t spi_config[] = {
/** @} */ /** @} */
/** /**
* @name ADC configuration * @brief ADC configuration
* *
* We need to define the following fields: * Note that we do not configure all ADC channels,
* PIN, device (ADCx), channel * and not in the STM32F207ZG order. Instead, we
* just define 6 ADC channels, for the Nucleo
* Arduino header pins A0-A5 and the internal VBAT channel.
*
* To find appropriate device and channel find in the
* board manual, table showing pin assignments and
* information about ADC - a text similar to ADC[X]_IN[Y],
* where:
* [X] - describes used device - indexed from 0,
* for example ADC1_IN10 is device 0,
* [Y] - describes used channel - indexed from 1,
* for example ADC1_IN10 is channel 10
*
* For Nucleo-F207ZG this information is in board manual,
* Table 13, page 37.
* @{ * @{
*/ */
static const adc_conf_t adc_config[] = { static const adc_conf_t adc_config[] = {
{GPIO_PIN(PORT_A, 3), 0, 3}, { .pin = GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 3 }, /* ADC123_IN3 */
{GPIO_PIN(PORT_C, 0), 1, 0}, { .pin = GPIO_PIN(PORT_C, 0), .dev = 0, .chan = 10 }, /* ADC123_IN10 */
{GPIO_UNDEF, 0, 18}, /* VBAT */ { .pin = GPIO_PIN(PORT_C, 3), .dev = 0, .chan = 13 }, /* ADC123_IN13 */
{ .pin = GPIO_PIN(PORT_F, 3), .dev = 2, .chan = 9 }, /* ADC3_IN9 */
{ .pin = GPIO_PIN(PORT_F, 5), .dev = 2, .chan = 15 }, /* ADC3_IN15 */
{ .pin = GPIO_PIN(PORT_F, 10), .dev = 2, .chan = 8 }, /* ADC3_IN8 */
{ .pin = GPIO_UNDEF, .dev = 0, .chan = 18 }, /* VBAT */
}; };
#define VBAT_ADC ADC_LINE(2) /**< VBAT ADC line */ /**
* @brief VBAT ADC line
*/
#define VBAT_ADC ADC_LINE(6)
/**
* @brief Number of ADC devices
*/
#define ADC_NUMOF ARRAY_SIZE(adc_config) #define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */ /** @} */
/** /**