Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/drivers/gpio/gpio_nrf/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ Nordic Semiconductor specific GPIO functions
############################################
The suite specified here tests NRF specific
GPIO pin drive strength settings.

The suite is perfomed with CONFIG_GPIO_NRFX_INTERRUPT=n
to ensure that the driver is able to properly handle
the GPIO manipulation without interrupt support.
1 change: 1 addition & 0 deletions tests/drivers/gpio/gpio_nrf/prj.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONFIG_ZTEST=y
CONFIG_GPIO=y
CONFIG_GPIO_NRFX_INTERRUPT=n
34 changes: 34 additions & 0 deletions tests/drivers/gpio/gpio_nrf/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,38 @@ ZTEST(gpio_nrf, test_gpio_high_drive_strength)
err);
}

/*
* Nordic Semiconductor specific,
* gpio manipulation with disabled NRFX interrupts
*/
ZTEST(gpio_nrf, test_gpio_manipulation_nrfx_int_disabled)
{
int response;
const struct device *port;

port = DEVICE_DT_GET(TEST_NODE);
zassert_true(device_is_ready(port), "GPIO dev is not ready");

response = gpio_pin_configure(port, TEST_PIN, GPIO_OUTPUT | GPIO_ACTIVE_HIGH);
zassert_ok(response, "Pin configuration failed: %d", response);

response = gpio_pin_set(port, TEST_PIN, 0);
zassert_ok(response, "Pin low state set failed: %d", response);

response = gpio_pin_set(port, TEST_PIN, 1);
zassert_ok(response, "Pin high state set failed: %d", response);

response = gpio_pin_toggle(port, TEST_PIN);
zassert_ok(response, "Pin toggle failed: %d", response);

response = gpio_pin_configure(port, TEST_PIN, GPIO_INPUT | GPIO_PULL_DOWN);
zassert_ok(response, "Failed to configure pin as input with pull down: %d", response);

response = gpio_pin_get(port, TEST_PIN);
zassert_equal(response, 0, "Invalid pin state: %d", response);

response = gpio_pin_interrupt_configure(port, TEST_PIN, GPIO_INT_ENABLE | GPIO_INT_HIGH_1);
zassert_equal(response, -ENOSYS);
}

ZTEST_SUITE(gpio_nrf, NULL, NULL, NULL, NULL, NULL);
Loading