tests: drivers: Verify NRF GPIO driver with GPIO_NRFX_INTERRUPT=n
Verify NRF GPIO driver with NRFX interrupts disabled. Verify that driver handles properly 'get' and 'set' api methods. When calling interrupt enable driver should report 'function not implemented' error. Signed-off-by: Bartosz Miller <bartosz.miller@nordicsemi.no>
This commit is contained in:
parent
96852bc45e
commit
bb3efaa3f2
@ -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,2 +1,3 @@
|
||||
CONFIG_ZTEST=y
|
||||
CONFIG_GPIO=y
|
||||
CONFIG_GPIO_NRFX_INTERRUPT=n
|
||||
|
||||
@ -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…
Reference in New Issue
Block a user