aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/adc.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-18 08:52:26 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-18 08:52:26 +0000
commit3626647d7b924ca07df4197f9cde4a7965b8cbdf (patch)
tree7416c97f83adc95583930a38107552dfcb17fc40 /os/hal/include/adc.h
parentfa2cedd0d023228358539192ac4d9de3d14482dd (diff)
downloadChibiOS-3626647d7b924ca07df4197f9cde4a7965b8cbdf.tar.gz
ChibiOS-3626647d7b924ca07df4197f9cde4a7965b8cbdf.tar.bz2
ChibiOS-3626647d7b924ca07df4197f9cde4a7965b8cbdf.zip
Fixed bugs 3534767, 3534819, 3535887 and 3535938.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4293 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include/adc.h')
-rw-r--r--os/hal/include/adc.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index 8f829d386..86209a89f 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -210,7 +210,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.*/ \
@@ -226,7 +227,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.*/ \