aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32L4xx/ADC/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32L4xx/ADC/main.c')
-rw-r--r--testhal/STM32/STM32L4xx/ADC/main.c11
1 files changed, 5 insertions, 6 deletions
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);