From fd2f5acbb33e1333b0b04ff41325a78a145de90b Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Sat, 18 Apr 2020 13:28:23 +0200 Subject: [PATCH] fix: gpio pins and modes --- controller.ini | 14 +++++++------- drivers/gpio.c | 1 + runners/test.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/controller.ini b/controller.ini index 24624c7..dd1b389 100644 --- a/controller.ini +++ b/controller.ini @@ -15,12 +15,12 @@ inverted = 0 [relay-2] driver = gpio -pin = 0 +pin = 5 inverted = 1 [relay-3] driver = gpio -pin = 2 +pin = 4 inverted = 1 [relay-4] @@ -30,25 +30,25 @@ inverted = 1 [relay-5] driver = gpio -pin = 15 +pin = 2 inverted = 1 [relay-6] driver = gpio -pin = 16 +pin = 1 inverted = 1 [relay-7] driver = gpio -pin = 1 +pin = 0 inverted = 1 [relay-8] driver = gpio -pin = 4 +pin = 16 inverted = 1 [relay-9] driver = gpio -pin = 5 +pin = 15 inverted = 1 diff --git a/drivers/gpio.c b/drivers/gpio.c index 0fd78b9..833d9f7 100644 --- a/drivers/gpio.c +++ b/drivers/gpio.c @@ -10,5 +10,6 @@ driver_gpio_set(int pin, int value) // disable "unused parameter" warning (happens when using wiring_debug) (void)pin; (void)value; + pinMode(pin, OUTPUT); digitalWrite(pin, value); } diff --git a/runners/test.c b/runners/test.c index 00c3e07..216637e 100644 --- a/runners/test.c +++ b/runners/test.c @@ -9,9 +9,9 @@ void runner_test(controller_t *controller) { // from x down to 0 to turn all relays off in the end - for(int test_run = 2; test_run >= 0; --test_run) + for(uint_fast8_t i = 0; i < controller->relay_count; ++i) { - for(uint_fast8_t i = 0; i < controller->relay_count; ++i) + for(int test_run = 2; test_run >= 0; --test_run) { int is_active = test_run % 2; if(global_config.relay_configs[i].inverted)