1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

tests/periph/gpio_ll: add delays to test_switch_dir()

In all other tests we added a delay after writing to the output buffer
of GPIO A before expected the input buffer of GPIO B (connected to A)
to reflect the change, but not in test_switch_dir().

This adds the delay here as well to make the test more robust in regard
to GPIO peripherals that react not as fast as the CPU can query them.
This commit is contained in:
Marian Buschsieweke 2024-08-02 19:52:33 +02:00
parent a6b459eff3
commit af61cf40e3
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6

View File

@ -933,8 +933,10 @@ static void test_switch_dir(void)
expect(test_passed);
gpio_ll_clear(port_out, mask_out);
ztimer_sleep(ZTIMER_USEC, US_PER_MS);
test_passed = (0 == (gpio_ll_read(port_in) & mask_in));
gpio_ll_set(port_out, mask_out);
ztimer_sleep(ZTIMER_USEC, US_PER_MS);
test_passed = test_passed && (gpio_ll_read(port_in) & mask_in);
printf_optional("Pin behaves as output after switched to output mode: %s\n",
noyes[test_passed]);
@ -965,8 +967,10 @@ static void test_switch_dir(void)
expect(0 == gpio_ll_init(port_in, PIN_IN_0, gpio_ll_out));
gpio_ll_clear(port_in, mask_in);
ztimer_sleep(ZTIMER_USEC, US_PER_MS);
test_passed = (0 == (gpio_ll_read(port_out) & mask_out));
gpio_ll_set(port_in, mask_in);
ztimer_sleep(ZTIMER_USEC, US_PER_MS);
test_passed = test_passed && (gpio_ll_read(port_out) & mask_out);
printf_optional("Pin behaves as input after switched back to input mode: %s\n",
noyes[test_passed]);