From 18104391d749561f0d1dd86dc2a1946eff783cdc Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 8 Dec 2023 07:39:24 +0100 Subject: [PATCH] improve the docs --- docs/user-manual/index.rst | 5 +++++ lwbtn/src/include/lwbtn/lwbtn_opt.h | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/user-manual/index.rst b/docs/user-manual/index.rst index dc6069a..bd0e54e 100644 --- a/docs/user-manual/index.rst +++ b/docs/user-manual/index.rst @@ -42,6 +42,7 @@ On-Press event Onpress event is the first in a row when input is detected active. With nature of embedded systems and various buttons connected to devices, it is necessary to filter out potential noise to ignore unintential multiple presses. This is done by checking line to be at stable level for at least some minimum time, normally called *debounce time*, usually it takes around ``20ms``. +See :c:macro:`LWBTN_CFG_TIME_DEBOUNCE_PRESS` configuration option to set debounce time. .. figure:: ../static/images/btn-events-press.svg :align: center @@ -60,6 +61,10 @@ Onrelease event is triggered immediately when input goes from active to inactive On-Release event trigger +Optionally, user can also enable debounce for release event. +In this case, **onrelease** is triggered after line is in steady inactive mode for at least minimum defined time. +See :c:macro:`LWBTN_CFG_TIME_DEBOUNCE_RELEASE` configuration option to set debounce time. + On-Click event ^^^^^^^^^^^^^^ diff --git a/lwbtn/src/include/lwbtn/lwbtn_opt.h b/lwbtn/src/include/lwbtn/lwbtn_opt.h index 2df50be..5f3dbd7 100644 --- a/lwbtn/src/include/lwbtn/lwbtn_opt.h +++ b/lwbtn/src/include/lwbtn/lwbtn_opt.h @@ -230,9 +230,9 @@ extern "C" { * This can be executed immediately after last click has been detected, * or after standard timeout (unless next on-press has already been detected, * then it is send to application just before valid next press event). - * Configuration can be changed \ref LWBTN_CFG_CLICK_MAX_CONSECUTIVE_SEND_IMMEDIATELY + * Configuration can be changed with \ref LWBTN_CFG_CLICK_MAX_CONSECUTIVE_SEND_IMMEDIATELY macro * - * \sa LWBTN_CFG_CLICK_MAX_CONSECUTIVE_DYNAMIC + * \sa LWBTN_CFG_CLICK_MAX_CONSECUTIVE_DYNAMIC, LWBTN_CFG_CLICK_MAX_CONSECUTIVE_SEND_IMMEDIATELY */ #ifndef LWBTN_CFG_CLICK_MAX_CONSECUTIVE #define LWBTN_CFG_CLICK_MAX_CONSECUTIVE 3 @@ -286,10 +286,23 @@ extern "C" { #define LWBTN_CFG_CLICK_MAX_CONSECUTIVE_SEND_IMMEDIATELY 1 #endif +/** + * \brief Get button state options + * \name LWBTN_CFG_GET_STATE_MODE_GROUP + * \anchor LWBTN_CFG_GET_STATE_MODE_GROUP + * \{ + * + * Configuration option for \ref LWBTN_CFG_GET_STATE_MODE configuration + */ + #define LWBTN_GET_STATE_MODE_CALLBACK 0 /*!< Callback-only state mode */ #define LWBTN_GET_STATE_MODE_MANUAL 1 /*!< Manual-only state mode */ #define LWBTN_GET_STATE_MODE_CALLBACK_OR_MANUAL 2 /*!< Callback or manual state mode */ +/** + * \} + */ + /** * \brief Sets the mode how new button state is acquired. * @@ -302,7 +315,7 @@ extern "C" { * It enables API to manually set the state with approapriate function call. * Button state is checked with the callback at least until manual state API function is called. * - * This allows multiple build configurations for various button types + * This allows multiple build configurations for various button types */ #ifndef LWBTN_CFG_GET_STATE_MODE #define LWBTN_CFG_GET_STATE_MODE LWBTN_GET_STATE_MODE_CALLBACK