git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3399 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2011-09-24 15:04:39 +00:00
parent f02cdbe2e8
commit 7d30f4c821
1 changed files with 5 additions and 6 deletions

View File

@ -188,15 +188,13 @@ void adc_lld_stop(ADCDriver *adcp) {
* @notapi * @notapi
*/ */
void adc_lld_start_conversion(ADCDriver *adcp) { void adc_lld_start_conversion(ADCDriver *adcp) {
uint32_t mode, cr2; uint32_t mode;
const ADCConversionGroup *grpp = adcp->grpp; const ADCConversionGroup *grpp = adcp->grpp;
/* DMA setup.*/ /* DMA setup.*/
mode = adcp->dmamode; mode = adcp->dmamode;
cr2 = grpp->cr2;
if (grpp->circular) { if (grpp->circular) {
mode |= STM32_DMA_CR_CIRC; mode |= STM32_DMA_CR_CIRC;
cr2 |= ADC_CR2_CONT;
} }
if (adcp->depth > 1) { if (adcp->depth > 1) {
/* If the buffer depth is greater than one then the half transfer interrupt /* If the buffer depth is greater than one then the half transfer interrupt
@ -214,7 +212,8 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
adcp->adc->SMPR1 = grpp->smpr1; /* Writing SMPRx requires ADON=0. */ adcp->adc->SMPR1 = grpp->smpr1; /* Writing SMPRx requires ADON=0. */
adcp->adc->SMPR2 = grpp->smpr2; adcp->adc->SMPR2 = grpp->smpr2;
adcp->adc->SMPR3 = grpp->smpr3; adcp->adc->SMPR3 = grpp->smpr3;
adcp->adc->CR2 = cr2 | ADC_CR2_DMA | ADC_CR2_DDS | ADC_CR2_ADON; adcp->adc->CR2 = grpp->cr2 | ADC_CR2_CONT | ADC_CR2_DMA | ADC_CR2_DDS |
ADC_CR2_ADON;
adcp->adc->SQR1 = grpp->sqr1; adcp->adc->SQR1 = grpp->sqr1;
adcp->adc->SQR2 = grpp->sqr2; adcp->adc->SQR2 = grpp->sqr2;
adcp->adc->SQR3 = grpp->sqr3; adcp->adc->SQR3 = grpp->sqr3;
@ -225,8 +224,8 @@ void adc_lld_start_conversion(ADCDriver *adcp) {
while ((adcp->adc->SR & ADC_SR_ADONS) == 0) while ((adcp->adc->SR & ADC_SR_ADONS) == 0)
; ;
/* ADC start by raising ADC_CR2_SWSTART.*/ /* ADC start by raising ADC_CR2_SWSTART.*/
adcp->adc->CR2 = cr2 | ADC_CR2_SWSTART | ADC_CR2_DMA | ADC_CR2_DDS | adcp->adc->CR2 = grpp->cr2 | ADC_CR2_SWSTART | ADC_CR2_CONT | ADC_CR2_DMA |
ADC_CR2_ADON; ADC_CR2_DDS | ADC_CR2_ADON;
} }
/** /**