From 79a83573081040e36e9ebf50a6568822f22c4118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Tue, 16 Mar 2021 12:18:55 +0100 Subject: [PATCH] application: minor, slight voltage reading improvement --- application.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application.c b/application.c index b18fed5..1342602 100644 --- a/application.c +++ b/application.c @@ -347,6 +347,7 @@ static void command_types(void* argument) puts(" "); gpio_clear(GPIO_PORT(SIGNAL_PD_PIN), GPIO_PIN(SIGNAL_PD_PIN)); // pull down signal + sleep_us(10); // wait a tiny bit for voltage to settle voltages = measure_voltages(); // measure pulled down voltages gpio_set(GPIO_PORT(SIGNAL_PD_PIN), GPIO_PIN(SIGNAL_PD_PIN)); // remove pull-down voltages[2] *= 2.0; // pulling creates a voltage divider (to ground) @@ -364,6 +365,7 @@ static void command_types(void* argument) puts(" "); gpio_clear(GPIO_PORT(SIGNAL_PU_PIN), GPIO_PIN(SIGNAL_PU_PIN)); // pull up signal + sleep_us(10); // wait a tiny bit for voltage to settle voltages = measure_voltages(); // measure pulled up voltages gpio_set(GPIO_PORT(SIGNAL_PU_PIN), GPIO_PIN(SIGNAL_PU_PIN)); // remove pull-up voltages[2] = voltages[2] * 2.0 - voltages[1]; // pulling creates a voltage divider (to target)