1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests: initial import of dgbpin test

This commit is contained in:
Hauke Petersen 2020-09-15 14:46:24 +02:00
parent 2d582cdd2e
commit 84660ed664
3 changed files with 74 additions and 0 deletions

9
tests/dbgpin/Makefile Normal file
View File

@ -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

53
tests/dbgpin/main.c Normal file
View File

@ -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 <hauke.petersen@fu-berlin.de>
*
* @}
*/
#include <stdio.h>
#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;
}

12
tests/dbgpin/tests/01-run.py Executable file
View File

@ -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))