Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/stm32: implement periph_gpio_ll_switch_dir #20805

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
maribu committed Aug 8, 2024
commit af61cf40e361b4948539c0031c33a0e265ebaf66
4 changes: 4 additions & 0 deletions tests/periph/gpio_ll/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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]);
Expand Down