Merge pull request #15849 from benpicco/cpu/stm32f7-adc
cpu/stm32: add periph_adc for STM32F7
This commit is contained in:
commit
49a3592f92
@ -15,6 +15,7 @@ config BOARD_NUCLEO_F767ZI
|
||||
select CPU_MODEL_STM32F767ZI
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
select HAS_PERIPH_ADC
|
||||
select HAS_PERIPH_DMA
|
||||
select HAS_PERIPH_I2C
|
||||
select HAS_PERIPH_RTC
|
||||
|
||||
@ -2,6 +2,7 @@ CPU = stm32
|
||||
CPU_MODEL = stm32f767zi
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_adc
|
||||
FEATURES_PROVIDED += periph_dma
|
||||
FEATURES_PROVIDED += periph_eth
|
||||
FEATURES_PROVIDED += periph_i2c
|
||||
|
||||
@ -185,7 +185,28 @@ static const eth_conf_t eth_config = {
|
||||
};
|
||||
|
||||
#define ETH_DMA_ISR isr_dma2_stream0
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name ADC configuration
|
||||
*
|
||||
* Note that we do not configure all ADC channels,
|
||||
* and not in the STM32F767ZI order. Instead, we
|
||||
* just define 6 ADC channels, for the Nucleo
|
||||
* Arduino header pins A0-A5
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
static const adc_conf_t adc_config[] = {
|
||||
{GPIO_PIN(PORT_A, 3), 0, 0},
|
||||
{GPIO_PIN(PORT_C, 0), 0, 1},
|
||||
{GPIO_PIN(PORT_C, 3), 0, 4},
|
||||
{GPIO_PIN(PORT_F, 3), 0, 8},
|
||||
{GPIO_PIN(PORT_F, 5), 0, 11},
|
||||
{GPIO_PIN(PORT_F, 10), 0, 10},
|
||||
};
|
||||
|
||||
#define ADC_NUMOF ARRAY_SIZE(adc_config)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -32,6 +32,20 @@ extern "C" {
|
||||
*/
|
||||
#define STM32_BOOTLOADER_ADDR (0x1FF00000)
|
||||
|
||||
/**
|
||||
* @brief Override the ADC resolution configuration
|
||||
* @{
|
||||
*/
|
||||
#define HAVE_ADC_RES_T
|
||||
typedef enum {
|
||||
ADC_RES_6BIT = 0x03000000, /**< ADC resolution: 6 bit */
|
||||
ADC_RES_8BIT = 0x02000000, /**< ADC resolution: 8 bit */
|
||||
ADC_RES_10BIT = 0x01000000, /**< ADC resolution: 10 bit */
|
||||
ADC_RES_12BIT = 0x00000000, /**< ADC resolution: 12 bit */
|
||||
ADC_RES_14BIT = 1, /**< ADC resolution: 14 bit (not supported) */
|
||||
ADC_RES_16BIT = 2 /**< ADC resolution: 16 bit (not supported)*/
|
||||
} adc_res_t;
|
||||
/** @} */
|
||||
#endif /* ndef DOXYGEN */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -11,7 +11,11 @@ endif
|
||||
|
||||
# Select the specific implementation for `periph_adc`
|
||||
ifneq (,$(filter periph_adc,$(USEMODULE)))
|
||||
SRC += adc_$(CPU_FAM).c
|
||||
ifneq (,$(filter $(CPU_FAM),f4 f7))
|
||||
SRC += adc_f4_f7.c
|
||||
else
|
||||
SRC += adc_$(CPU_FAM).c
|
||||
endif
|
||||
endif
|
||||
|
||||
# Select the correct implementation for `periph_gpio`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user