Configuration

This is the default configuration of the middleware. When any of the settings shall be modified, it shall be done in dedicated application config lwbtn_opts.h file.

Note

Check Getting started for guidelines on how to create and use configuration file.

group LWBTN_OPT

Default configuration setup.

Defines

LWBTN_CFG_USE_KEEPALIVE

Enables 1 or disables 0 periodic keep alive events.

Default keep alive period is set with LWBTN_CFG_TIME_KEEPALIVE_PERIOD macro

LWBTN_CFG_TIME_DEBOUNCE

Minimum debounce time in units of milliseconds.

This is the time input shall have stable level to detect valid onpress event

LWBTN_CFG_TIME_DEBOUNCE_RUNTIME

Enables 1 or disables 0 runtime settable time debounce.

When enabled, additional field is added to button structure

LWBTN_CFG_TIME_CLICK_MIN

Minimum active input time for valid click event, in milliseconds.

Input shall be pressed at least this amount of time to even consider the potential valid click event. Set the value to 0 to disable this feature

LWBTN_CFG_TIME_CLICK_MIN_RUNTIME

Enables 1 or disables 0 runtime settable min time for click.

When enabled, additional field is added to button structure

LWBTN_CFG_TIME_CLICK_MAX

Maximum active input time for valid click event, in milliseconds.

Input shall be pressed at most this amount of time to still trigger valid click. Set to -1 to allow any time triggering click event.

LWBTN_CFG_TIME_CLICK_MAX_RUNTIME

Enables 1 or disables 0 runtime settable max time for click.

When enabled, additional field is added to button structure

LWBTN_CFG_TIME_CLICK_MULTI_MAX

Maximum allowed time between last on-release and next valid on-press, to still allow multi-click events, in milliseconds.

This value is also used as a timeout length. It sends onclick event if there is no further presses by the application.

LWBTN_CFG_TIME_CLICK_MULTI_MAX_RUNTIME

Enables 1 or disables 0 runtime settable max time for multi click.

When enabled, additional field is added to button structure

LWBTN_CFG_CLICK_MAX_CONSECUTIVE

Maximum number of allowed consecutive click events, before structure gets reset to default value.

LWBTN_CFG_CLICK_MAX_CONSECUTIVE_RUNTIME

Enables 1 or disables 0 runtime settable max consecutive clicks.

When enabled, additional field is added to button structure

LWBTN_CFG_TIME_KEEPALIVE_PERIOD

Keep-alive event period, in milliseconds.

LWBTN_CFG_TIME_KEEPALIVE_PERIOD_RUNTIME

Enables 1 or disables 0 runtime settable keep alive period.

When enabled, additional field is added to button structure

LWBTN_CFG_CLICK_MAX_CONSECUTIVE_SEND_IMMEDIATELY

Enables 1 or disables 0 immediate onclick event after on-release event, if number of consecutive clicks reaches max value.

When this mode is disabled, onclick is sent in one of 2 cases:

  • An on-click timeout occurred

  • Next on-press event occurred before timeout expired

LWBTN_GET_STATE_MODE_CALLBACK

Callback-only state mode

LWBTN_GET_STATE_MODE_MANUAL

Manual-only state mode

LWBTN_GET_STATE_MODE_CALLBACK_OR_MANUAL

Callback or manual state mode

LWBTN_CFG_GET_STATE_MODE

Sets the mode how new button state is acquired.

Different modes are availale, set with the level number:

  • LWBTN_GET_STATE_MODE_CALLBACK: State of the button is checked through get state callback function (default mode, legacy)

  • LWBTN_GET_STATE_MODE_MANUAL: Only manual state set is enabled. Application must set the button state with API functions. Callback API is not used.

  • LWBTN_GET_STATE_MODE_CALLBACK_OR_MANUAL: State of the button is checked through get state callback function (by default). 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