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:
parent
970ba8294a
commit
081c4647cd
4 changed files with 25 additions and 1 deletions
1
tests/drivers/gpio/gpio_basic_api/boards/nrf52_bsim.conf
Normal file
1
tests/drivers/gpio/gpio_basic_api/boards/nrf52_bsim.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CONFIG_SKIP_PULL_TEST=y
|
13
tests/drivers/gpio/gpio_basic_api/boards/nrf52_bsim.overlay
Normal file
13
tests/drivers/gpio/gpio_basic_api/boards/nrf52_bsim.overlay
Normal 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>;
|
||||||
|
};
|
||||||
|
};
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue