From f62818ea7bdd8ad5ad7540d3428ff4a4eb8251d4 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie <alexandre.abadie@inria.fr> Date: Mon, 16 Apr 2018 10:53:08 +0200 Subject: [PATCH] sys/auto_init/io1_xplained: fix gpios index --- sys/auto_init/saul/auto_init_io1_xplained.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/auto_init/saul/auto_init_io1_xplained.c b/sys/auto_init/saul/auto_init_io1_xplained.c index c002d98b62..312804939e 100644 --- a/sys/auto_init/saul/auto_init_io1_xplained.c +++ b/sys/auto_init/saul/auto_init_io1_xplained.c @@ -72,11 +72,14 @@ void auto_init_io1_xplained(void) saul_reg_add(&(saul_entries[i * 4])); /* GPIOs */ - for (unsigned j = 1; j < 4; j++) { - saul_entries[i * 4 + j].dev = &(io1_xplained_saul_gpios[j]); - saul_entries[i * 4 + j].name = io1_xplained_saul_info[i][j].name; - saul_entries[i * 4 + j].driver = &gpio_out_saul_driver; - saul_reg_add(&(saul_entries[i * 4 + j])); + for (unsigned j = 0; + j < sizeof(io1_xplained_saul_gpios) / sizeof(io1_xplained_saul_gpios[0]); + j++) { + saul_reg_t *entry = &saul_entries[i * 4 + j + 1]; + entry->dev = &(io1_xplained_saul_gpios[j]); + entry->name = io1_xplained_saul_info[i][j + 1].name; + entry->driver = &gpio_out_saul_driver; + saul_reg_add(entry); } } } -- GitLab