diff --git a/samples/subsys/display/lvgl/Kconfig b/samples/subsys/display/lvgl/Kconfig new file mode 100644 index 00000000000..e86f91cd7b7 --- /dev/null +++ b/samples/subsys/display/lvgl/Kconfig @@ -0,0 +1,12 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" + +mainmenu "LVGL Sample" + +config RESET_COUNTER_SW0 + bool "Reset counter when sw0 is pressed" + depends on $(dt_alias_enabled,sw0) + select GPIO + default y diff --git a/samples/subsys/display/lvgl/src/main.c b/samples/subsys/display/lvgl/src/main.c index 9f704eb4423..9b9dfe3a64e 100644 --- a/samples/subsys/display/lvgl/src/main.c +++ b/samples/subsys/display/lvgl/src/main.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(app); static uint32_t count; -#ifdef CONFIG_GPIO +#ifdef CONFIG_RESET_COUNTER_SW0 static struct gpio_dt_spec button_gpio = GPIO_DT_SPEC_GET_OR( DT_ALIAS(sw0), gpios, {0}); static struct gpio_callback button_callback; @@ -35,7 +35,7 @@ static void button_isr_callback(const struct device *port, count = 0; } -#endif /* CONFIG_GPIO */ +#endif /* CONFIG_RESET_COUNTER_SW0 */ #ifdef CONFIG_LV_Z_ENCODER_INPUT static const struct device *lvgl_encoder = @@ -67,7 +67,7 @@ int main(void) return 0; } -#ifdef CONFIG_GPIO +#ifdef CONFIG_RESET_COUNTER_SW0 if (gpio_is_ready_dt(&button_gpio)) { int err; @@ -93,7 +93,7 @@ int main(void) return 0; } } -#endif /* CONFIG_GPIO */ +#endif /* CONFIG_RESET_COUNTER_SW0 */ #ifdef CONFIG_LV_Z_ENCODER_INPUT lv_obj_t *arc;