From 0b616acbc6f59ab118bc4a9e8fa2931f1288e274 Mon Sep 17 00:00:00 2001 From: Hauke Petersen <hauke.petersen@fu-berlin.de> Date: Thu, 20 Sep 2018 18:02:24 +0200 Subject: [PATCH] tests/periph_gpio: make IRQ commands optional only include irq related shell commands in case the PERIPH_GPIO_IRQ feature is selected --- tests/periph_gpio/Makefile | 2 +- tests/periph_gpio/main.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/periph_gpio/Makefile b/tests/periph_gpio/Makefile index d85c7857fa..2af53968c7 100644 --- a/tests/periph_gpio/Makefile +++ b/tests/periph_gpio/Makefile @@ -3,7 +3,7 @@ include ../Makefile.tests_common BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-uno FEATURES_REQUIRED = periph_gpio -FEATURES_REQUIRED = periph_gpio_irq +FEATURES_OPTIONAL = periph_gpio_irq USEMODULE += shell USEMODULE += benchmark diff --git a/tests/periph_gpio/main.c b/tests/periph_gpio/main.c index 56bfd33b83..8e9e13a239 100644 --- a/tests/periph_gpio/main.c +++ b/tests/periph_gpio/main.c @@ -28,10 +28,12 @@ #define BENCH_RUNS_DEFAULT (1000UL * 1000) +#ifdef MODULE_PERIPH_GPIO_IRQ static void cb(void *arg) { printf("INT: external interrupt from pin %i\n", (int)arg); } +#endif static int init_pin(int argc, char **argv, gpio_mode_t mode) { @@ -83,6 +85,7 @@ static int init_od_pu(int argc, char **argv) return init_pin(argc, argv, GPIO_OD_PU); } +#ifdef MODULE_PERIPH_GPIO_IRQ static int init_int(int argc, char **argv) { int po, pi; @@ -148,6 +151,7 @@ static int init_int(int argc, char **argv) return 0; } +#endif static int read(int argc, char **argv) { @@ -238,7 +242,9 @@ static const shell_command_t shell_commands[] = { { "init_in_pd", "init as input with pull-down", init_in_pd }, { "init_od", "init as output (open-drain without pull resistor)", init_od }, { "init_od_pu", "init as output (open-drain with pull-up)", init_od_pu }, +#ifdef MODULE_PERIPH_GPIO_IRQ { "init_int", "init as external INT w/o pull resistor", init_int }, +#endif { "read", "read pin status", read }, { "set", "set pin to HIGH", set }, { "clear", "set pin to LOW", clear }, -- GitLab