aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-26 13:11:31 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-26 13:11:31 +0000
commit6c6bc48fd6ce57afebf20a4c513770af15100c84 (patch)
tree51eceacfdbf6f170920af5c30901c0ede447c20e /os/hal
parent58f95054b30907efe3135cbe5022c24c31efbe2d (diff)
downloadChibiOS-6c6bc48fd6ce57afebf20a4c513770af15100c84.tar.gz
ChibiOS-6c6bc48fd6ce57afebf20a4c513770af15100c84.tar.bz2
ChibiOS-6c6bc48fd6ce57afebf20a4c513770af15100c84.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4238 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/platforms/STM32F0xx/adc_lld.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32F0xx/adc_lld.c b/os/hal/platforms/STM32F0xx/adc_lld.c
index 95e0ddf77..51905c3d4 100644
--- a/os/hal/platforms/STM32F0xx/adc_lld.c
+++ b/os/hal/platforms/STM32F0xx/adc_lld.c
@@ -151,6 +151,14 @@ void adc_lld_init(void) {
disabled.*/
nvicEnableVector(ADC1_COMP_IRQn,
CORTEX_PRIORITY_MASK(STM32_ADC_IRQ_PRIORITY));
+
+ /* Calibration procedure.*/
+ rccEnableADC1(FALSE);
+ chDbgAssert(ADC1->CR == 0, "adc_lld_init(), #1", "invalid register state");
+ ADC1->CR |= ADC_CR_ADCAL;
+ while (ADC1->CR & ADC_CR_ADCAL)
+ ;
+ rccDisableADC1(FALSE);
}
/**