diff --git a/tests/drivers/gpio/gpio_nrf/README.txt b/tests/drivers/gpio/gpio_nrf/README.txt index 6a5927b725f..c73b5ec2218 100644 --- a/tests/drivers/gpio/gpio_nrf/README.txt +++ b/tests/drivers/gpio/gpio_nrf/README.txt @@ -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. diff --git a/tests/drivers/gpio/gpio_nrf/prj.conf b/tests/drivers/gpio/gpio_nrf/prj.conf index 0e799280f51..98d49c26369 100644 --- a/tests/drivers/gpio/gpio_nrf/prj.conf +++ b/tests/drivers/gpio/gpio_nrf/prj.conf @@ -1,2 +1,3 @@ CONFIG_ZTEST=y CONFIG_GPIO=y +CONFIG_GPIO_NRFX_INTERRUPT=n diff --git a/tests/drivers/gpio/gpio_nrf/src/main.c b/tests/drivers/gpio/gpio_nrf/src/main.c index 8627e9bab1d..bdb8444bbeb 100644 --- a/tests/drivers/gpio/gpio_nrf/src/main.c +++ b/tests/drivers/gpio/gpio_nrf/src/main.c @@ -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);