aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32F0xx/adc_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-26 11:24:52 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-26 11:24:52 +0000
commit6e2f377dd5b17c3ab2836a5ae5406676275f9bb5 (patch)
treed8012df76077d3733ae01b164818f946acddb52a /os/hal/platforms/STM32F0xx/adc_lld.c
parent512b78de728dfa1fe6bacadc525c8edc1dfdb041 (diff)
downloadChibiOS-6e2f377dd5b17c3ab2836a5ae5406676275f9bb5.tar.gz
ChibiOS-6e2f377dd5b17c3ab2836a5ae5406676275f9bb5.tar.bz2
ChibiOS-6e2f377dd5b17c3ab2836a5ae5406676275f9bb5.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4235 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32F0xx/adc_lld.c')
-rw-r--r--os/hal/platforms/STM32F0xx/adc_lld.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/os/hal/platforms/STM32F0xx/adc_lld.c b/os/hal/platforms/STM32F0xx/adc_lld.c
index 751f15afd..95e0ddf77 100644
--- a/os/hal/platforms/STM32F0xx/adc_lld.c
+++ b/os/hal/platforms/STM32F0xx/adc_lld.c
@@ -174,6 +174,16 @@ void adc_lld_start(ADCDriver *adcp) {
chDbgAssert(!b, "adc_lld_start(), #1", "stream already allocated");
dmaStreamSetPeripheral(adcp->dmastp, &ADC1->DR);
rccEnableADC1(FALSE);
+#if STM32_ADCSW == STM32_ADCSW_HSI14
+ /* Clock from HSI14, no need for jitter removal.*/
+ ADC1->CFGR2 = 0x00001000;
+#else
+#if STM32_ADCPRE == STM32_ADCPRE_DIV2
+ ADC1->CFGR2 = 0x00001000 | ADC_CFGR2_JITOFFDIV2;
+#else
+ ADC1->CFGR2 = 0x00001000 | ADC_CFGR2_JITOFFDIV4;
+#endif
+#endif
}
#endif /* STM32_ADC_USE_ADC1 */
@@ -265,28 +275,6 @@ void adc_lld_stop_conversion(ADCDriver *adcp) {
adc_lld_stop_adc(adcp->adc);
}
-/**
- * @brief Enables the TSVREFE bit.
- * @details The TSVREFE bit is required in order to sample the internal
- * temperature sensor and internal reference voltage.
- * @note This is an STM32-only functionality.
- */
-void adcSTM32EnableTSVREFE(void) {
-
- ADC->CCR |= ADC_CCR_VREFEN;
-}
-
-/**
- * @brief Disables the TSVREFE bit.
- * @details The TSVREFE bit is required in order to sample the internal
- * temperature sensor and internal reference voltage.
- * @note This is an STM32-only functionality.
- */
-void adcSTM32DisableTSVREFE(void) {
-
- ADC->CCR &= ~ADC_CCR_VREFEN;
-}
-
#endif /* HAL_USE_ADC */
/** @} */