From f20ecc78178fc8cdfa682e100398c240224dbb4a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 15 Dec 2018 17:50:05 +0000 Subject: HAL callbacks rework. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12470 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- testhal/STM32/STM32L4xx/ADC/Makefile | 2 +- .../STM32L4xx-ADC (OpenOCD, Flash and Run).launch | 104 ++++++++++----------- testhal/STM32/STM32L4xx/ADC/main.c | 11 +-- 3 files changed, 58 insertions(+), 59 deletions(-) (limited to 'testhal/STM32/STM32L4xx') diff --git a/testhal/STM32/STM32L4xx/ADC/Makefile b/testhal/STM32/STM32L4xx/ADC/Makefile index 402c1ce74..8c74815fd 100644 --- a/testhal/STM32/STM32L4xx/ADC/Makefile +++ b/testhal/STM32/STM32L4xx/ADC/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). diff --git a/testhal/STM32/STM32L4xx/ADC/debug/STM32L4xx-ADC (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32L4xx/ADC/debug/STM32L4xx-ADC (OpenOCD, Flash and Run).launch index 89c0ca557..f752b6269 100644 --- a/testhal/STM32/STM32L4xx/ADC/debug/STM32L4xx-ADC (OpenOCD, Flash and Run).launch +++ b/testhal/STM32/STM32L4xx/ADC/debug/STM32L4xx-ADC (OpenOCD, Flash and Run).launch @@ -1,52 +1,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testhal/STM32/STM32L4xx/ADC/main.c b/testhal/STM32/STM32L4xx/ADC/main.c index 95b211f58..e86cefa2a 100644 --- a/testhal/STM32/STM32L4xx/ADC/main.c +++ b/testhal/STM32/STM32L4xx/ADC/main.c @@ -30,14 +30,13 @@ static adcsample_t samples2[ADC_GRP2_NUM_CHANNELS * ADC_GRP2_BUF_DEPTH]; * ADC streaming callback. */ size_t nx = 0, ny = 0; -static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n) { +static void adccallback(ADCDriver *adcp) { - (void)adcp; - if (samples2 == buffer) { - nx += n; + if (adcIsBufferComplete(adcp)) { + nx += 1; } else { - ny += n; + ny += 1; } } @@ -161,7 +160,7 @@ int main(void) { * Normal main() thread activity, in this demo it does nothing. */ while (true) { - if (palReadPad(GPIOC, GPIOC_BUTTON)) { + if (!palReadPad(GPIOC, GPIOC_BUTTON)) { adcStopConversion(&ADCD1); } chThdSleepMilliseconds(500); -- cgit v1.2.3