From e6f559e70b09847e988ddb81bbf1dfb13b590b24 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 18 Jun 2012 18:08:30 +0000 Subject: [PATCH] Fixed bug 3534767. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_2.4.x@4304 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/adc.h | 14 ++++++++------ readme.txt | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 54fc8a9f0..8bd51c0a4 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -217,7 +217,8 @@ typedef enum { if ((adcp)->depth > 1) { \ /* Invokes the callback passing the 2nd half of the buffer.*/ \ size_t half = (adcp)->depth / 2; \ - (adcp)->grpp->end_cb(adcp, (adcp)->samples + half, half); \ + size_t half_index = half * (adcp)->grpp->num_channels; \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, half); \ } \ else { \ /* Invokes the callback passing the whole buffer.*/ \ @@ -233,7 +234,8 @@ typedef enum { if ((adcp)->depth > 1) { \ /* Invokes the callback passing the 2nd half of the buffer.*/ \ size_t half = (adcp)->depth / 2; \ - (adcp)->grpp->end_cb(adcp, (adcp)->samples + half, half); \ + size_t half_index = half * (adcp)->grpp->num_channels; \ + (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, half); \ } \ else { \ /* Invokes the callback passing the whole buffer.*/ \ @@ -289,13 +291,13 @@ extern "C" { void adcStart(ADCDriver *adcp, const ADCConfig *config); void adcStop(ADCDriver *adcp); void adcStartConversion(ADCDriver *adcp, + const ADCConversionGroup *grpp, + adcsample_t *samples, + size_t depth); + void adcStartConversionI(ADCDriver *adcp, const ADCConversionGroup *grpp, adcsample_t *samples, size_t depth); - void adcStartConversionI(ADCDriver *adcp, - const ADCConversionGroup *grpp, - adcsample_t *samples, - size_t depth); void adcStopConversion(ADCDriver *adcp); void adcStopConversionI(ADCDriver *adcp); #if ADC_USE_WAIT diff --git a/readme.txt b/readme.txt index 9e08f7646..da9eab739 100644 --- a/readme.txt +++ b/readme.txt @@ -84,8 +84,8 @@ - FIX: Fixed unreliable PHY initialization (bug 3534819)(backported to 2.4.2). +- FIX: Fixed wrong ADC callback buffer pointer in ADC driver (bug 3534767). - FIX: Fixed lwIP-related files missing from version 2.4.1 (bug 3533887). - - FIX: Fixed problem with arm-v6m and state checker (bug 3532591). - FIX: Fixed wrong MAC divider setting in STM32 MAC driver (bug 3531290). - FIX: Fixed wrong MCO1 divider in STM32F2/F4 HAL (bug 3531289).