tests: gpio_basic_api: use GPIO flags from DT
When configuring in/out pins for callback tests, pass the GPIO flags coming from the in/out-gpios respective nodes. Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
This commit is contained in:
parent
f95c10d548
commit
8a4ec8e024
@ -43,12 +43,12 @@ static int init_callback(const struct device *dev,
|
||||
}
|
||||
if (rc == 0) {
|
||||
/* 1. set PIN_OUT */
|
||||
rc = gpio_pin_configure(dev, PIN_OUT, GPIO_OUTPUT_LOW);
|
||||
rc = gpio_pin_configure(dev, PIN_OUT, (GPIO_OUTPUT_LOW | PIN_OUT_FLAGS));
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
/* 2. configure PIN_IN callback, but don't enable */
|
||||
rc = gpio_pin_configure(dev, PIN_IN, GPIO_INPUT);
|
||||
rc = gpio_pin_configure(dev, PIN_IN, (GPIO_INPUT | PIN_IN_FLAGS));
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
|
||||
@ -40,7 +40,7 @@ static int test_callback(int mode)
|
||||
gpio_pin_interrupt_configure(dev, PIN_OUT, GPIO_INT_DISABLE);
|
||||
|
||||
/* 1. set PIN_OUT to logical initial state inactive */
|
||||
uint32_t out_flags = GPIO_OUTPUT_LOW;
|
||||
uint32_t out_flags = GPIO_OUTPUT_LOW | PIN_OUT_FLAGS;
|
||||
|
||||
if ((mode & GPIO_INT_LOW_0) != 0) {
|
||||
out_flags = GPIO_OUTPUT_HIGH | GPIO_ACTIVE_LOW;
|
||||
@ -54,7 +54,7 @@ static int test_callback(int mode)
|
||||
}
|
||||
|
||||
/* 2. configure PIN_IN callback and trigger condition */
|
||||
rc = gpio_pin_configure(dev, PIN_IN, GPIO_INPUT);
|
||||
rc = gpio_pin_configure(dev, PIN_IN, (GPIO_INPUT | PIN_IN_FLAGS));
|
||||
if (rc != 0) {
|
||||
TC_ERROR("config PIN_IN fail: %d\n", rc);
|
||||
goto err_exit;
|
||||
|
||||
@ -25,7 +25,9 @@
|
||||
#define DEV_IN DT_GPIO_CTLR(DT_INST(0, test_gpio_basic_api), in_gpios)
|
||||
#define DEV DEV_OUT /* DEV_OUT should equal DEV_IN, we test for this */
|
||||
#define PIN_OUT DT_GPIO_PIN(DT_INST(0, test_gpio_basic_api), out_gpios)
|
||||
#define PIN_OUT_FLAGS DT_GPIO_FLAGS(DT_INST(0, test_gpio_basic_api), out_gpios)
|
||||
#define PIN_IN DT_GPIO_PIN(DT_INST(0, test_gpio_basic_api), in_gpios)
|
||||
#define PIN_IN_FLAGS DT_GPIO_FLAGS(DT_INST(0, test_gpio_basic_api), in_gpios)
|
||||
|
||||
#elif DT_NODE_HAS_STATUS(DT_ALIAS(gpio_0), okay)
|
||||
#define DEV DT_GPIO_CTLR(DT_ALIAS(gpio_0))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user