diff --git a/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h b/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h index bffd31f0d8a23b..35e45a8aef4223 100644 --- a/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h +++ b/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h @@ -32,7 +32,7 @@ #define APP_LIGHT_BUTTON CYBSP_USER_BTN1 #define APP_FUNCTION_BUTTON CYBSP_USER_BTN2 -#define APP_BUTTON_DEBOUNCE_PERIOD_MS 200 +#define APP_BUTTON_MIN_ASSERT_TIME_MS 30 #define APP_BUTTON_PRESSED 0 #define APP_BUTTON_RELEASED 1 diff --git a/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp b/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp index 56c088b46ad83d..7d65fc4134625e 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp @@ -38,7 +38,7 @@ void ButtonHandler::Init(void) for (uint8_t i = 0; i < kButtonCount; i++) { buttonTimers[i] = xTimerCreate("BtnTmr", // Just a text name, not used by the RTOS kernel - APP_BUTTON_DEBOUNCE_PERIOD_MS, // timer period + APP_BUTTON_MIN_ASSERT_TIME_MS, // timer period false, // no timer reload (==one-shot) (void *) (int) i, // init timer id = button index TimerCallback // timer callback handler (all buttons use @@ -90,7 +90,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) { // Get the button index of the expired timer and call button event helper. uint32_t timerId; - uint8_t buttonevent = 0; + uint8_t buttonevent = 1; timerId = (uint32_t) pvTimerGetTimerID(xTimer); switch (timerId) @@ -106,7 +106,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) break; } - if (buttonevent) + if (!buttonevent) { GetAppTask().ButtonEventHandler(timerId, APP_BUTTON_PRESSED); } diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h b/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h index bffd31f0d8a23b..35e45a8aef4223 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h +++ b/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h @@ -32,7 +32,7 @@ #define APP_LIGHT_BUTTON CYBSP_USER_BTN1 #define APP_FUNCTION_BUTTON CYBSP_USER_BTN2 -#define APP_BUTTON_DEBOUNCE_PERIOD_MS 200 +#define APP_BUTTON_MIN_ASSERT_TIME_MS 30 #define APP_BUTTON_PRESSED 0 #define APP_BUTTON_RELEASED 1 diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp index 56c088b46ad83d..7d65fc4134625e 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp @@ -38,7 +38,7 @@ void ButtonHandler::Init(void) for (uint8_t i = 0; i < kButtonCount; i++) { buttonTimers[i] = xTimerCreate("BtnTmr", // Just a text name, not used by the RTOS kernel - APP_BUTTON_DEBOUNCE_PERIOD_MS, // timer period + APP_BUTTON_MIN_ASSERT_TIME_MS, // timer period false, // no timer reload (==one-shot) (void *) (int) i, // init timer id = button index TimerCallback // timer callback handler (all buttons use @@ -90,7 +90,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) { // Get the button index of the expired timer and call button event helper. uint32_t timerId; - uint8_t buttonevent = 0; + uint8_t buttonevent = 1; timerId = (uint32_t) pvTimerGetTimerID(xTimer); switch (timerId) @@ -106,7 +106,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) break; } - if (buttonevent) + if (!buttonevent) { GetAppTask().ButtonEventHandler(timerId, APP_BUTTON_PRESSED); } diff --git a/examples/lighting-app/infineon/psoc6/include/AppConfig.h b/examples/lighting-app/infineon/psoc6/include/AppConfig.h index b199aaf7a1b4d5..21b9e9467263fa 100644 --- a/examples/lighting-app/infineon/psoc6/include/AppConfig.h +++ b/examples/lighting-app/infineon/psoc6/include/AppConfig.h @@ -31,7 +31,7 @@ #define APP_LIGHT_BUTTON CYBSP_USER_BTN1 #define APP_FUNCTION_BUTTON CYBSP_USER_BTN2 -#define APP_BUTTON_DEBOUNCE_PERIOD_MS 200 +#define APP_BUTTON_MIN_ASSERT_TIME_MS 30 #define APP_BUTTON_PRESSED 0 #define APP_BUTTON_RELEASED 1 diff --git a/examples/lighting-app/infineon/psoc6/src/ButtonHandler.cpp b/examples/lighting-app/infineon/psoc6/src/ButtonHandler.cpp index e4a0d483d20c69..a722ea001e4fa6 100644 --- a/examples/lighting-app/infineon/psoc6/src/ButtonHandler.cpp +++ b/examples/lighting-app/infineon/psoc6/src/ButtonHandler.cpp @@ -37,7 +37,7 @@ void ButtonHandler::Init(void) for (uint8_t i = 0; i < kButtonCount; i++) { buttonTimers[i] = xTimerCreate("BtnTmr", // Just a text name, not used by the RTOS kernel - APP_BUTTON_DEBOUNCE_PERIOD_MS, // timer period + APP_BUTTON_MIN_ASSERT_TIME_MS, // timer period false, // no timer reload (==one-shot) (void *) (int) i, // init timer id = button index TimerCallback // timer callback handler (all buttons use @@ -88,8 +88,8 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) { // Get the button index of the expired timer and call button event helper. uint32_t timerId; - uint8_t buttonevent = 0; - timerId = (uint32_t) pvTimerGetTimerID(xTimer); + uint8_t buttonevent; + timerId = (uint32_t) pvTimerGetTimerID(xTimer); if (timerId) { buttonevent = cyhal_gpio_read(APP_FUNCTION_BUTTON); @@ -98,7 +98,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) { buttonevent = cyhal_gpio_read(APP_LIGHT_BUTTON); } - if (buttonevent) + if (!buttonevent) { GetAppTask().ButtonEventHandler(timerId, APP_BUTTON_PRESSED); } diff --git a/examples/lock-app/infineon/psoc6/include/AppConfig.h b/examples/lock-app/infineon/psoc6/include/AppConfig.h index 5e9c988a389a8f..f20ca007a5a3fc 100644 --- a/examples/lock-app/infineon/psoc6/include/AppConfig.h +++ b/examples/lock-app/infineon/psoc6/include/AppConfig.h @@ -31,7 +31,7 @@ #define APP_LOCK_BUTTON CYBSP_USER_BTN1 #define APP_FUNCTION_BUTTON CYBSP_USER_BTN2 -#define APP_BUTTON_DEBOUNCE_PERIOD_MS 200 +#define APP_BUTTON_MIN_ASSERT_TIME_MS 30 #define APP_BUTTON_PRESSED 0 #define APP_BUTTON_RELEASED 1 diff --git a/examples/lock-app/infineon/psoc6/src/ButtonHandler.cpp b/examples/lock-app/infineon/psoc6/src/ButtonHandler.cpp index 20a7c6bce7d1c0..2eea4c760a20f9 100644 --- a/examples/lock-app/infineon/psoc6/src/ButtonHandler.cpp +++ b/examples/lock-app/infineon/psoc6/src/ButtonHandler.cpp @@ -36,7 +36,7 @@ void ButtonHandler::Init(void) for (uint8_t i = 0; i < kButtonCount; i++) { buttonTimers[i] = xTimerCreate("BtnTmr", // Just a text name, not used by the RTOS kernel - APP_BUTTON_DEBOUNCE_PERIOD_MS, // timer period + APP_BUTTON_MIN_ASSERT_TIME_MS, // timer period false, // no timer reload (==one-shot) (void *) (int) i, // init timer id = button index TimerCallback // timer callback handler (all buttons use @@ -87,8 +87,8 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) { // Get the button index of the expired timer and call button event helper. uint32_t timerId; - uint8_t buttonevent = 0; - timerId = (uint32_t) pvTimerGetTimerID(xTimer); + uint8_t buttonevent; + timerId = (uint32_t) pvTimerGetTimerID(xTimer); if (timerId) { buttonevent = cyhal_gpio_read(APP_FUNCTION_BUTTON); @@ -98,7 +98,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) buttonevent = cyhal_gpio_read(APP_LOCK_BUTTON); } - if (buttonevent) + if (!buttonevent) { GetAppTask().ButtonEventHandler(timerId, APP_BUTTON_PRESSED); }