test gpio_basic_api: Enable for nrf52_bsim

Add DT and kconfig overlays for the nrf52_bsim so this test can be run
in this board too.
This simulated board supports short-circuiting pins
either programmatically or thru configuration files,
but it does not support a pull in an input being able to drag
a non driven output, so we need to skip the pull test.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-06-30 16:32:00 +02:00 committed by Carles Cufí
commit 081c4647cd
4 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1 @@
CONFIG_SKIP_PULL_TEST=y

View file

@ -0,0 +1,13 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
resources {
compatible = "test-gpio-basic-api";
out-gpios = <&gpio1 1 0>;
in-gpios = <&gpio1 2 0>;
};
};

View file

@ -14,6 +14,8 @@
#include "device_imx.h" #include "device_imx.h"
#elif defined(CONFIG_BOARD_MIMXRT1050_EVK) #elif defined(CONFIG_BOARD_MIMXRT1050_EVK)
#include <fsl_iomuxc.h> #include <fsl_iomuxc.h>
#elif defined(CONFIG_BOARD_NRF52_BSIM)
#include <NRF_GPIO.h>
#endif #endif
static void board_setup(void) static void board_setup(void)
@ -87,6 +89,14 @@ static void board_setup(void)
zassert_true(device_is_ready(dev), "GPIO dev is not ready"); zassert_true(device_is_ready(dev), "GPIO dev is not ready");
int rc = gpio_add_callback(dev, &gpio_emul_callback); int rc = gpio_add_callback(dev, &gpio_emul_callback);
__ASSERT(rc == 0, "gpio_add_callback() failed: %d", rc); __ASSERT(rc == 0, "gpio_add_callback() failed: %d", rc);
#elif defined(CONFIG_BOARD_NRF52_BSIM)
static bool done;
if (!done) {
done = true;
/* This functions allows to programmatically short-circuit SOC GPIO pins */
nrf_gpio_backend_register_short(1, PIN_OUT, 1, PIN_IN);
}
#endif #endif
} }

View file

@ -13,6 +13,6 @@ tests:
filter: dt_compat_enabled("test-gpio-basic-api") filter: dt_compat_enabled("test-gpio-basic-api")
drivers.gpio.nrf_sense_edge: drivers.gpio.nrf_sense_edge:
platform_allow: nrf52840dk_nrf52840 platform_allow: nrf52840dk_nrf52840 nrf52_bsim
extra_args: "DTC_OVERLAY_FILE=boards/nrf52840dk_nrf52840.overlay;\ extra_args: "DTC_OVERLAY_FILE=boards/nrf52840dk_nrf52840.overlay;\
boards/nrf52840dk_nrf52840_sense_edge.overlay" boards/nrf52840dk_nrf52840_sense_edge.overlay"