Skip to content

Commit

Permalink
drivers: adc: add ifdef for stm32f37x adc
Browse files Browse the repository at this point in the history
Add ifdef around some functions that don't exist for STM32F37x (ADC_V2_5)
like it is done for STM32F1x.

Signed-off-by: Guillaume Gautier <[email protected]>
  • Loading branch information
gautierg-st authored and carlescufi committed May 16, 2023
1 parent c1a6013 commit 649742f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/adc/adc_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,11 +700,11 @@ static void dma_callback(const struct device *dev, void *user_data,
LOG_DBG("dma callback");

if (channel == data->dma.channel) {
#if !defined(CONFIG_SOC_SERIES_STM32F1X)
#if !defined(CONFIG_SOC_SERIES_STM32F1X) && !defined(STM32F3X_ADC_V2_5)
if (LL_ADC_IsActiveFlag_OVR(adc) || (status >= 0)) {
#else
if (status >= 0) {
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) */
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) && !defined(STM32F3X_ADC_V2_5) */
data->samples_count = data->channel_count;
data->buffer += data->channel_count;
/* Stop the DMA engine, only to start it again when the callback returns
Expand All @@ -713,9 +713,9 @@ static void dma_callback(const struct device *dev, void *user_data,
* within adc_context_start_sampling
*/
dma_stop(data->dma.dma_dev, data->dma.channel);
#if !defined(CONFIG_SOC_SERIES_STM32F1X)
#if !defined(CONFIG_SOC_SERIES_STM32F1X) && !defined(STM32F3X_ADC_V2_5)
LL_ADC_ClearFlag_OVR(adc);
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) */
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) && !defined(STM32F3X_ADC_V2_5) */
/* No need to invalidate the cache because it's assumed that
* the address is in a non-cacheable SRAM region.
*/
Expand Down Expand Up @@ -1005,9 +1005,9 @@ static int start_read(const struct device *dev,
*/
adc_stm32_enable(adc);

#if !defined(CONFIG_SOC_SERIES_STM32F1X)
#if !defined(CONFIG_SOC_SERIES_STM32F1X) && !defined(STM32F3X_ADC_V2_5)
LL_ADC_ClearFlag_OVR(adc);
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) */
#endif /* !defined(CONFIG_SOC_SERIES_STM32F1X) && !defined(STM32F3X_ADC_V2_5) */

#if !defined(CONFIG_ADC_STM32_DMA)
#if defined(CONFIG_SOC_SERIES_STM32F2X) || \
Expand Down

0 comments on commit 649742f

Please sign in to comment.