From cdd629cda22e4e54c2e5103eb3597801f2826ece Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 29 Apr 2020 14:40:44 -0500 Subject: [PATCH] samples: basic: threads: Rework to not define generated macros Rather than redefining a macro which might be generated we should create a new define name that should get used in the code. Replace redefining DT_ALIAS_LED0_GPIOS_FLAGS with LED0_FLAGS and DT_ALIAS_LED1_GPIOS_FLAGS with LED1_FLAGS. Signed-off-by: Kumar Gala --- samples/basic/threads/src/main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/samples/basic/threads/src/main.c b/samples/basic/threads/src/main.c index 3403bf9c07..8e0edd3937 100644 --- a/samples/basic/threads/src/main.c +++ b/samples/basic/threads/src/main.c @@ -25,12 +25,16 @@ struct printk_data_t { K_FIFO_DEFINE(printk_fifo); -#ifndef DT_ALIAS_LED0_GPIOS_FLAGS -#define DT_ALIAS_LED0_GPIOS_FLAGS 0 +#ifdef DT_ALIAS_LED0_GPIOS_FLAGS +#define LED0_FLAGS DT_ALIAS_LED0_GPIOS_FLAGS +#else +#define LED0_FLAGS 0 #endif -#ifndef DT_ALIAS_LED1_GPIOS_FLAGS -#define DT_ALIAS_LED1_GPIOS_FLAGS 0 +#ifdef DT_ALIAS_LED1_GPIOS_FLAGS +#define LED1_FLAGS DT_ALIAS_LED1_GPIOS_FLAGS +#else +#define LED1_FLAGS 0 #endif struct led { @@ -81,7 +85,7 @@ void blink1(void) .gpio_dev_name = DT_ALIAS_LED0_GPIOS_CONTROLLER, .gpio_pin_name = DT_ALIAS_LED0_LABEL, .gpio_pin = DT_ALIAS_LED0_GPIOS_PIN, - .gpio_flags = GPIO_OUTPUT | DT_ALIAS_LED0_GPIOS_FLAGS, + .gpio_flags = GPIO_OUTPUT | LED0_FLAGS, }; blink(&led1, 100, 0); @@ -93,7 +97,7 @@ void blink2(void) .gpio_dev_name = DT_ALIAS_LED1_GPIOS_CONTROLLER, .gpio_pin_name = DT_ALIAS_LED1_LABEL, .gpio_pin = DT_ALIAS_LED1_GPIOS_PIN, - .gpio_flags = GPIO_OUTPUT | DT_ALIAS_LED1_GPIOS_FLAGS, + .gpio_flags = GPIO_OUTPUT | LED1_FLAGS, }; blink(&led2, 1000, 1);