aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/ADCv2
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-08-26 08:41:04 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-08-26 08:41:04 +0000
commit3262155f7d3afa5f69ae98b4744018dec03484eb (patch)
treec9445b08e3f734f150b0120c7c2e0616b135090b /os/hal/ports/STM32/LLD/ADCv2
parent5c969f63735eae2c813969bf41ee062c47b1da1b (diff)
downloadChibiOS-3262155f7d3afa5f69ae98b4744018dec03484eb.tar.gz
ChibiOS-3262155f7d3afa5f69ae98b4744018dec03484eb.tar.bz2
ChibiOS-3262155f7d3afa5f69ae98b4744018dec03484eb.zip
Added automatic number of channels initialization for ADCv2.
Implemented IRQ hooks for ADC drivers. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9741 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32/LLD/ADCv2')
-rw-r--r--os/hal/ports/STM32/LLD/ADCv2/hal_adc_lld.c11
1 files changed, 10 insertions, 1 deletions
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;