aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-02-17 14:00:57 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-02-17 14:00:57 +0000
commit0b9f09be24512c7d9c0af453ebadc3307ca90f25 (patch)
treeb16b4b11eb97785faf573ea06e86c9162029394b /os/hal/include
parent51deb0fa262ce7b5519cdef88717312419022480 (diff)
downloadChibiOS-0b9f09be24512c7d9c0af453ebadc3307ca90f25.tar.gz
ChibiOS-0b9f09be24512c7d9c0af453ebadc3307ca90f25.tar.bz2
ChibiOS-0b9f09be24512c7d9c0af453ebadc3307ca90f25.zip
Fixed bug 3605053.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5224 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/adc.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index 7c67e20d1..d7f918da3 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -228,18 +228,21 @@ typedef enum {
/* Invokes the callback passing the 2nd half of the buffer.*/ \
size_t half = (adcp)->depth / 2; \
size_t half_index = half * (adcp)->grpp->num_channels; \
- (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, half); \
+ (adcp)->grpp->end_cb(adcp, (adcp)->samples + half_index, (adcp)->depth - half); \
} \
else { \
/* Invokes the callback passing the whole buffer.*/ \
(adcp)->grpp->end_cb(adcp, (adcp)->samples, (adcp)->depth); \
} \
- if ((adcp)->state == ADC_COMPLETE) \
+ if ((adcp)->state == ADC_COMPLETE) { \
(adcp)->state = ADC_READY; \
+ (adcp)->grpp = NULL; \
+ } \
} \
- else \
+ else { \
(adcp)->state = ADC_READY; \
- (adcp)->grpp = NULL; \
+ (adcp)->grpp = NULL; \
+ } \
_adc_wakeup_isr(adcp); \
} \
}