Skip to content

Commit

Permalink
fixup! tests: Add tests for periph/gpio_ng
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed Sep 2, 2021
1 parent 9f1e9ad commit 9663d1b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/periph_gpio_ng/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@
#include "mutex.h"
#include "periph/gpio.h"
#include "periph/gpio_ng.h"
#if MODULE_PERIPH_GPIO_NG_IRQ
#include "periph/gpio_ng/irq.h"
#endif
#include "test_utils/expect.h"
#include "xtimer.h"

static const char *noyes[] = { "no", "yes" };
static gpio_port_t port_out = GPIO_PORT(PORT_OUT);
static gpio_port_t port_in = GPIO_PORT(PORT_IN);
#if MODULE_PERIPH_GPIO_NG_IRQ
static const uint64_t mutex_timeout = US_PER_MS;
#endif

static void test_gpio_ng_init(void)
{
Expand Down Expand Up @@ -267,6 +271,7 @@ static void test_input_output(void)
puts("All input/output operations worked as expected");
}

#if MODULE_PERIPH_GPIO_NG_IRQ
static void irq_edge_cb(void *mut)
{
mutex_unlock(mut);
Expand Down Expand Up @@ -419,6 +424,7 @@ static void test_irq(void)
test_irq_level();
}
}
#endif

static void print_cpu_cycles(uint32_t loops, uint32_t duration)
{
Expand Down Expand Up @@ -591,7 +597,9 @@ int main(void)
{
test_gpio_ng_init();
test_input_output();
#if MODULE_PERIPH_GPIO_NG_IRQ
test_irq();
#endif
bench();

/* if no expect() didn't blow up until now, the test is passed */
Expand Down

0 comments on commit 9663d1b

Please sign in to comment.