diff --git a/tests/dbgpin/Makefile b/tests/dbgpin/Makefile new file mode 100644 index 0000000000..9a02af2ac2 --- /dev/null +++ b/tests/dbgpin/Makefile @@ -0,0 +1,9 @@ +include ../Makefile.tests_common + +USEMODULE += dbgpin +USEMODULE += xtimer + +DBGPIN_PINS ?= GPIO_PIN(0,0) +CFLAGS += -DDBGPIN_PINS="$(DBGPIN_PINS)" + +include $(RIOTBASE)/Makefile.include diff --git a/tests/dbgpin/main.c b/tests/dbgpin/main.c new file mode 100644 index 0000000000..589c9e860f --- /dev/null +++ b/tests/dbgpin/main.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2020 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Test for the dbgpin module + * + * @author Hauke Petersen + * + * @} + */ + +#include + +#include "dbgpin.h" +#include "xtimer.h" + +#define TICK_MS 5U + +int main(void) +{ + printf("Found %i configured debug pin(s)\n", dbgpin_count()); + + for (unsigned p = 0; p < dbgpin_count(); p++) { + printf("Testing pin %u\n", p); + dbgpin_set(p); + xtimer_msleep(TICK_MS); + dbgpin_clear(p); + xtimer_msleep(TICK_MS); + dbgpin_toggle(p); + xtimer_msleep(2 * TICK_MS); + dbgpin_toggle(p); + xtimer_msleep(TICK_MS); + dbgpin_pulse(p); + xtimer_msleep(TICK_MS); + for (unsigned i = 2; i <= 5; i++) { + dbgpin_signal(p, i); + xtimer_msleep(TICK_MS); + } + } + + puts("Test successful."); + + return 0; +} diff --git a/tests/dbgpin/tests/01-run.py b/tests/dbgpin/tests/01-run.py new file mode 100755 index 0000000000..1b1cac95f3 --- /dev/null +++ b/tests/dbgpin/tests/01-run.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import sys +from testrunner import run + + +def testfunc(child): + child.expect_exact('Test successful.') + + +if __name__ == "__main__": + sys.exit(run(testfunc))