File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
samples/boards/st/power_mgmt/blinky/src Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 99#include <zephyr/devicetree.h>
1010#include <zephyr/drivers/gpio.h>
1111#include <zephyr/sys/printk.h>
12+ #include <zephyr/pm/device_runtime.h>
1213
1314/* define SLEEP_TIME_MS higher than <st,counter-value> in ms */
1415#if DT_PROP (DT_NODELABEL (stm32_lp_tick_source ), st_counter_value )
1718#define SLEEP_TIME_MS 2000
1819#endif
1920
21+ #define STM32_GPIO_PM_ENABLE (node_id ) \
22+ pm_device_runtime_enable(DEVICE_DT_GET(node_id));
23+
2024static const struct gpio_dt_spec led =
2125 GPIO_DT_SPEC_GET (DT_ALIAS (led0 ), gpios );
2226
@@ -26,6 +30,11 @@ int main(void)
2630
2731 __ASSERT_NO_MSG (gpio_is_ready_dt (& led ));
2832
33+ /* Enable device runtime PM on each GPIO port.
34+ * GPIO configuration is lost but it may result in lower power consumption.
35+ */
36+ DT_FOREACH_STATUS_OKAY (st_stm32_gpio , STM32_GPIO_PM_ENABLE )
37+
2938 printk ("Device ready\n" );
3039
3140 while (true) {
You can’t perform that action at this time.
0 commit comments