Skip to content

Commit 2b8929b

Browse files
nordic-baburlubos
authored andcommitted
tests: benchmarks: idle: fix pm comp test.
Fix test to reach s2ram by explicit pm_device_runtime_enable/get/put calls. Signed-off-by: Bartlomiej Buczek <[email protected]>
1 parent 6d9e2df commit 2b8929b

File tree

1 file changed

+12
-3
lines changed
  • tests/benchmarks/multicore/idle_comp/src

1 file changed

+12
-3
lines changed

tests/benchmarks/multicore/idle_comp/src/main.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <zephyr/drivers/comparator.h>
88
#include <zephyr/drivers/gpio.h>
99
#include <zephyr/kernel.h>
10+
#include <zephyr/pm/device_runtime.h>
1011

1112
static const struct device *test_dev = DEVICE_DT_GET(DT_ALIAS(test_comp));
1213
static const struct gpio_dt_spec test_pin = GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), test_gpios);
@@ -24,21 +25,29 @@ int main(void)
2425

2526
gpio_pin_configure_dt(&test_pin, GPIO_OUTPUT_INACTIVE);
2627

28+
pm_device_runtime_enable(test_dev);
29+
pm_device_runtime_get(test_dev);
30+
2731
rc = comparator_set_trigger_callback(test_dev, test_callback, NULL);
2832
__ASSERT_NO_MSG(rc == 0);
2933

3034
rc = comparator_set_trigger(test_dev, COMPARATOR_TRIGGER_BOTH_EDGES);
3135
__ASSERT_NO_MSG(rc == 0);
32-
k_msleep(1000);
3336

3437
while (1) {
3538
counter = 0;
39+
k_msleep(200);
3640
gpio_pin_set_dt(&test_pin, 1);
37-
k_msleep(1000);
41+
k_msleep(400);
3842
__ASSERT_NO_MSG(counter == 1);
3943
gpio_pin_set_dt(&test_pin, 0);
40-
k_msleep(1000);
44+
k_msleep(400);
4145
__ASSERT_NO_MSG(counter == 2);
46+
pm_device_runtime_put(test_dev);
47+
k_msleep(1000);
48+
49+
pm_device_runtime_get(test_dev);
50+
k_msleep(1);
4251
}
4352
return 0;
4453
}

0 commit comments

Comments
 (0)