aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/STM32L1xx/adc_lld.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/STM32L1xx/adc_lld.h')
-rw-r--r--os/hal/ports/STM32/STM32L1xx/adc_lld.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/os/hal/ports/STM32/STM32L1xx/adc_lld.h b/os/hal/ports/STM32/STM32L1xx/adc_lld.h
index aa8e1ddef..758cd918d 100644
--- a/os/hal/ports/STM32/STM32L1xx/adc_lld.h
+++ b/os/hal/ports/STM32/STM32L1xx/adc_lld.h
@@ -175,6 +175,20 @@
#define STM32_DMA_REQUIRED
#endif
+/**
+ * * @brief ADC frequency.
+ * */
+/* ADC clock related settings and checks.*/
+#if STM32_ADC_ADCPRE == ADC_CCR_ADCPRE_DIV1
+#define STM32_ADCCLK STM32_HSICLK
+#elif STM32_ADC_ADCPRE == ADC_CCR_ADCPRE_DIV2
+#define STM32_ADCCLK (STM32_HSICLK / 2)
+#elif STM32_ADC_ADCPRE == ADC_CCR_ADCPRE_DIV4
+#define STM32_ADCCLK (STM32_HSICLK / 4)
+#else
+#error "invalid STM32_ADC_ADCPRE value specified"
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/