diff --git a/cpu/nrf51/periph/adc.c b/cpu/nrf51/periph/adc.c index 6b6080b0f08bc..f84acb790b146 100644 --- a/cpu/nrf51/periph/adc.c +++ b/cpu/nrf51/periph/adc.c @@ -25,15 +25,11 @@ #include "periph/adc.h" #include "periph_conf.h" +#ifdef ADC_CONFIG /** * @brief Load the ADC configuration - * @{ */ -#ifdef ADC_CONFIG static const uint8_t adc_config[] = ADC_CONFIG; -#else -static const uint8_t adc_config[] = {}; -#endif /** * @brief Lock to prevent concurrency issues when used from different threads @@ -91,3 +87,4 @@ int adc_sample(adc_t line, adc_res_t res) return val; } +#endif /* ADC_CONFIG */ diff --git a/cpu/stm32_common/periph/dac.c b/cpu/stm32_common/periph/dac.c index d250802c9355a..da831ffaad411 100644 --- a/cpu/stm32_common/periph/dac.c +++ b/cpu/stm32_common/periph/dac.c @@ -26,6 +26,7 @@ /* only compile this, if the CPU has a DAC */ #if defined(DAC) || defined(DAC1) +#ifdef DAC_CONFIG #ifdef DAC2 #define _DAC(line) (dac_config[line].dac ? DAC2 : DAC1) @@ -34,15 +35,9 @@ #endif /** - * @brief Get the DAC configuration from the board (if configured) - * @{ + * @brief Get the DAC configuration from the board config */ -#ifdef DAC_CONFIG static const dac_conf_t dac_config[] = DAC_CONFIG; -#else -static const dac_conf_t dac_config[] = {}; -#endif -/** @} */ int8_t dac_init(dac_t line) { @@ -96,4 +91,5 @@ void dac_poweroff(dac_t line) DAC->CR &= ~(1 << (16 * dac_config[line].chan)); } +#endif /* DAC_CONFIG */ #endif /* DAC */ diff --git a/cpu/stm32f0/periph/adc.c b/cpu/stm32f0/periph/adc.c index d21b3625eb32a..d9c1d2071a73d 100644 --- a/cpu/stm32f0/periph/adc.c +++ b/cpu/stm32f0/periph/adc.c @@ -22,6 +22,8 @@ #include "mutex.h" #include "periph/adc.h" +#ifdef ADC_CONFIG + /** * @brief Maximum allowed ADC clock speed */ @@ -29,13 +31,8 @@ /** * @brief Load the ADC configuration - * @{ */ -#ifdef ADC_CONFIG static const adc_conf_t adc_config[] = ADC_CONFIG; -#else -static const adc_conf_t adc_config[] = {}; -#endif /** * @brief Allocate locks for all three available ADC device @@ -105,3 +102,5 @@ int adc_sample(adc_t line, adc_res_t res) return sample; } + +#endif /* ADC_CONFIG */ diff --git a/cpu/stm32f1/periph/adc.c b/cpu/stm32f1/periph/adc.c index b9bbc616a0b6a..e5a50798ebd73 100644 --- a/cpu/stm32f1/periph/adc.c +++ b/cpu/stm32f1/periph/adc.c @@ -24,6 +24,8 @@ #include "periph/adc.h" #include "periph_conf.h" +#ifdef ADC_CONFIG + /** * @brief Maximum allowed ADC clock speed */ @@ -31,13 +33,8 @@ /** * @brief Load the ADC configuration - * @{ */ -#ifdef ADC_CONFIG static const adc_conf_t adc_config[] = ADC_CONFIG; -#else -static const adc_conf_t adc_config[] = {}; -#endif /** * @brief Allocate locks for all three available ADC devices @@ -159,3 +156,5 @@ int adc_sample(adc_t line, adc_res_t res) return sample; } + +#endif /* ADC_CONFIG */ diff --git a/cpu/stm32f4/periph/adc.c b/cpu/stm32f4/periph/adc.c index 410cf36767455..17b4a80fab5a9 100644 --- a/cpu/stm32f4/periph/adc.c +++ b/cpu/stm32f4/periph/adc.c @@ -23,6 +23,8 @@ #include "periph/adc.h" #include "periph_conf.h" +#ifdef ADC_CONFIG + /** * @brief Maximum allowed ADC clock speed */ @@ -30,13 +32,8 @@ /** * @brief Load the ADC configuration - * @{ */ -#ifdef ADC_CONFIG static const adc_conf_t adc_config[] = ADC_CONFIG; -#else -static const adc_conf_t adc_config[] = {}; -#endif /** * @brief Allocate locks for all three available ADC devices @@ -124,3 +121,5 @@ int adc_sample(adc_t line, adc_res_t res) return sample; } + +#endif /* ADC_CONFIG */