aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-07-27 08:18:34 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-07-27 08:18:34 +0000
commit4a3264b5bfe5adaab913e2d987193dc91d3ea3b3 (patch)
tree40d7bbba4310789b5c7afc294dd288f01b4220df /os
parent6425481eb9383061a876f73b41d4a3bfda939e94 (diff)
downloadChibiOS-4a3264b5bfe5adaab913e2d987193dc91d3ea3b3.tar.gz
ChibiOS-4a3264b5bfe5adaab913e2d987193dc91d3ea3b3.tar.bz2
ChibiOS-4a3264b5bfe5adaab913e2d987193dc91d3ea3b3.zip
STM32L0xx ADC now working.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8111 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/LLD/ADCv1/adc_lld.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c b/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c
index 4f947f085..d8e70201a 100644
--- a/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c
+++ b/os/hal/ports/STM32/LLD/ADCv1/adc_lld.c
@@ -30,6 +30,9 @@
/* Driver local definitions. */
/*===========================================================================*/
+#define ADC1_DMA_CHANNEL \
+ STM32_DMA_GETCHANNEL(STM32_ADC_ADC1_DMA_STREAM, STM32_ADC1_DMA_CHN)
+
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
@@ -130,8 +133,9 @@ void adc_lld_init(void) {
/* Driver initialization.*/
adcObjectInit(&ADCD1);
ADCD1.adc = ADC1;
- ADCD1.dmastp = STM32_DMA1_STREAM1;
- ADCD1.dmamode = STM32_DMA_CR_PL(STM32_ADC_ADC1_DMA_PRIORITY) |
+ ADCD1.dmastp = STM32_DMA_STREAM(STM32_ADC_ADC1_DMA_STREAM);
+ ADCD1.dmamode = STM32_DMA_CR_CHSEL(ADC1_DMA_CHANNEL) |
+ STM32_DMA_CR_PL(STM32_ADC_ADC1_DMA_PRIORITY) |
STM32_DMA_CR_DIR_P2M |
STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PSIZE_HWORD |
STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE |
@@ -258,7 +262,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
#if STM32_ADC_SUPPORTS_OVERSAMPLING == TRUE
{
uint32_t cfgr2 = adcp->adc->CFGR2 & STM32_ADC_CKMODE_MASK;
- adcp->adc->CFGR1 = cfgr2 | grpp->cfgr2;
+ adcp->adc->CFGR2 = cfgr2 | grpp->cfgr2;
}
#endif