From 1e1cbf719ba00b3db395962e0097a62ea2073398 Mon Sep 17 00:00:00 2001 From: Vincent-FK Date: Mon, 5 Apr 2021 15:44:42 +0200 Subject: [PATCH] substracting the activated mask when a mapping is found regardless of already activated or not --- gpio_mapping.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gpio_mapping.c b/gpio_mapping.c index 7d4caab..53f336e 100755 --- a/gpio_mapping.c +++ b/gpio_mapping.c @@ -134,10 +134,7 @@ static void apply_mapping(mapping_list_t *list, uint32_t gpio_mask) #endif // DEBUG_GPIO if (mapping->activated == false) { - /* Mapping is not yet active, subtract the matching GPIOs from - * the current GPIO mask and activate it - */ - gpio_mask ^= mapping->gpio_mask; + /* Activate mapping */ mapping->activated = true; if (mapping->type == MAPPING_KEY) { @@ -152,6 +149,11 @@ static void apply_mapping(mapping_list_t *list, uint32_t gpio_mask) system(mapping->value.command); } } + + /* Subtract the matching GPIOs from + * the current GPIO mask and activate it + */ + gpio_mask ^= mapping->gpio_mask; } else if (mapping->activated) { /* Non-matching activated mapping, deactivate it */