diff options
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv1/hal_adc_lld.c | 4 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv2/hal_adc_lld.c | 11 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c | 3 | ||||
-rw-r--r-- | testhal/STM32/STM32F4xx/ADC/main.c | 4 | ||||
-rw-r--r-- | testhal/STM32/STM32F7xx/GPT-ADC/main.c | 2 |
5 files changed, 20 insertions, 4 deletions
diff --git a/os/hal/ports/STM32/LLD/ADCv1/hal_adc_lld.c b/os/hal/ports/STM32/LLD/ADCv1/hal_adc_lld.c index 3fd005a49..55d0d2d44 100644 --- a/os/hal/ports/STM32/LLD/ADCv1/hal_adc_lld.c +++ b/os/hal/ports/STM32/LLD/ADCv1/hal_adc_lld.c @@ -114,6 +114,10 @@ OSAL_IRQ_HANDLER(STM32_ADC1_HANDLER) { adc_lld_serve_interrupt(&ADCD1);
+#if defined(STM32_ADC_ADC1_IRQ_HOOK)
+ STM32_ADC_ADC1_IRQ_HOOK
+#endif
+
OSAL_IRQ_EPILOGUE();
}
#endif
diff --git a/os/hal/ports/STM32/LLD/ADCv2/hal_adc_lld.c b/os/hal/ports/STM32/LLD/ADCv2/hal_adc_lld.c index e25f2b5c8..b2e651eb2 100644 --- a/os/hal/ports/STM32/LLD/ADCv2/hal_adc_lld.c +++ b/os/hal/ports/STM32/LLD/ADCv2/hal_adc_lld.c @@ -125,6 +125,9 @@ OSAL_IRQ_HANDLER(STM32_ADC_HANDLER) { _adc_isr_error_code(&ADCD1, ADC_ERR_OVERFLOW);
}
/* TODO: Add here analog watchdog handling.*/
+#if defined(STM32_ADC_ADC1_IRQ_HOOK)
+ STM32_ADC_ADC1_IRQ_HOOK
+#endif
#endif /* STM32_ADC_USE_ADC1 */
#if STM32_ADC_USE_ADC2
@@ -139,6 +142,9 @@ OSAL_IRQ_HANDLER(STM32_ADC_HANDLER) { _adc_isr_error_code(&ADCD2, ADC_ERR_OVERFLOW);
}
/* TODO: Add here analog watchdog handling.*/
+#if defined(STM32_ADC_ADC2_IRQ_HOOK)
+ STM32_ADC_ADC2_IRQ_HOOK
+#endif
#endif /* STM32_ADC_USE_ADC2 */
#if STM32_ADC_USE_ADC3
@@ -153,6 +159,9 @@ OSAL_IRQ_HANDLER(STM32_ADC_HANDLER) { _adc_isr_error_code(&ADCD3, ADC_ERR_OVERFLOW);
}
/* TODO: Add here analog watchdog handling.*/
+#if defined(STM32_ADC_ADC3_IRQ_HOOK)
+ STM32_ADC_ADC3_IRQ_HOOK
+#endif
#endif /* STM32_ADC_USE_ADC3 */
OSAL_IRQ_EPILOGUE();
@@ -341,7 +350,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) { adcp->adc->SR = 0;
adcp->adc->SMPR1 = grpp->smpr1;
adcp->adc->SMPR2 = grpp->smpr2;
- adcp->adc->SQR1 = grpp->sqr1;
+ adcp->adc->SQR1 = grpp->sqr1 | ADC_SQR1_NUM_CH(grpp->num_channels);
adcp->adc->SQR2 = grpp->sqr2;
adcp->adc->SQR3 = grpp->sqr3;
diff --git a/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c b/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c index a9f3240f1..664a05a66 100644 --- a/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c +++ b/os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c @@ -313,6 +313,9 @@ static void adc_lld_serve_interrupt(ADCDriver *adcp, uint32_t isr) { /* Analog watchdog error.*/
_adc_isr_error_code(adcp, ADC_ERR_AWD3);
}
+#if defined(STM32_ADC_IRQ_HOOK)
+ STM32_ADC_IRQ_HOOK
+#endif
}
}
diff --git a/testhal/STM32/STM32F4xx/ADC/main.c b/testhal/STM32/STM32F4xx/ADC/main.c index 00fdd29d7..e452a3e38 100644 --- a/testhal/STM32/STM32F4xx/ADC/main.c +++ b/testhal/STM32/STM32F4xx/ADC/main.c @@ -61,7 +61,7 @@ static const ADCConversionGroup adcgrpcfg1 = { ADC_CR2_SWSTART, /* CR2 */
ADC_SMPR1_SMP_AN11(ADC_SAMPLE_3),
0, /* SMPR2 */
- ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS),
+ 0, /* SQR1 */
0, /* SQR2 */
ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11)
};
@@ -81,7 +81,7 @@ static const ADCConversionGroup adcgrpcfg2 = { ADC_SMPR1_SMP_AN12(ADC_SAMPLE_56) | ADC_SMPR1_SMP_AN11(ADC_SAMPLE_56) |
ADC_SMPR1_SMP_SENSOR(ADC_SAMPLE_144) | ADC_SMPR1_SMP_VREF(ADC_SAMPLE_144),
0, /* SMPR2 */
- ADC_SQR1_NUM_CH(ADC_GRP2_NUM_CHANNELS),
+ 0, /* SQR1 */
ADC_SQR2_SQ8_N(ADC_CHANNEL_SENSOR) | ADC_SQR2_SQ7_N(ADC_CHANNEL_VREFINT),
ADC_SQR3_SQ6_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ5_N(ADC_CHANNEL_IN11) |
ADC_SQR3_SQ4_N(ADC_CHANNEL_IN12) | ADC_SQR3_SQ3_N(ADC_CHANNEL_IN11) |
diff --git a/testhal/STM32/STM32F7xx/GPT-ADC/main.c b/testhal/STM32/STM32F7xx/GPT-ADC/main.c index b7a505152..9c36e18e4 100644 --- a/testhal/STM32/STM32F7xx/GPT-ADC/main.c +++ b/testhal/STM32/STM32F7xx/GPT-ADC/main.c @@ -103,7 +103,7 @@ static const ADCConversionGroup adcgrpcfg1 = { ADC_SMPR1_SMP_SENSOR(ADC_SAMPLE_144) |
ADC_SMPR1_SMP_VREF(ADC_SAMPLE_144), /* SMPR1 */
0, /* SMPR2 */
- ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS), /* SQR1 */
+ 0, /* SQR1 */
0, /* SQR2 */
ADC_SQR3_SQ2_N(ADC_CHANNEL_SENSOR) |
ADC_SQR3_SQ1_N(ADC_CHANNEL_VREFINT) /* SQR3 */
|