diff options
| -rw-r--r-- | os/hal/ports/STM32/LLD/ADCv1/adc_lld.c | 10 | ||||
| -rw-r--r-- | testhal/STM32/STM32L0xx/ADC/main.c | 2 |
2 files changed, 8 insertions, 4 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
diff --git a/testhal/STM32/STM32L0xx/ADC/main.c b/testhal/STM32/STM32L0xx/ADC/main.c index 6c2020646..4cb541966 100644 --- a/testhal/STM32/STM32L0xx/ADC/main.c +++ b/testhal/STM32/STM32L0xx/ADC/main.c @@ -145,7 +145,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing.
*/
while (true) {
- if (palReadPad(GPIOC, GPIOC_BUTTON)) {
+ if (!palReadPad(GPIOC, GPIOC_BUTTON)) {
adcStopConversion(&ADCD1);
adcSTM32SetCCR(0);
}
|
