Lightweight C library for HTML5 websockets
lws-button.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lws_button_regime
struct  lws_button_map
struct  lws_button_controller




typedef uint16_t lws_button_idx_t
typedef void(* lws_button_cb_t) (void *opaque, lws_button_idx_t idx, int state)
typedef struct lws_button_regime lws_button_regime_t
typedef struct lws_button_map lws_button_map_t
typedef struct lws_button_controller lws_button_controller_t




LWS_VISIBLE LWS_EXTERN struct lws_button_state * lws_button_controller_create (struct lws_context *ctx, const lws_button_controller_t *controller)
LWS_VISIBLE LWS_EXTERN void lws_button_controller_destroy (struct lws_button_state *bcs)
LWS_VISIBLE LWS_EXTERN lws_button_idx_t lws_button_get_bit (struct lws_button_state *bcs, const char *name)
LWS_VISIBLE LWS_EXTERN void lws_button_enable (struct lws_button_state *bcs, lws_button_idx_t _reset, lws_button_idx_t _set)

Data Structure Documentation

◆ lws_button_regime

struct lws_button_regime

Definition at line 44 of file lws-button.h.

+ Collaboration diagram for lws_button_regime:
Data Fields
uint16_t ms_min_down
uint16_t ms_min_down_longpress
uint16_t ms_up_settle
uint16_t ms_doubleclick_grace
uint16_t ms_repeat_down
uint8_t flags

when double-click classification is enabled, clicks are delayed by ms_min_down + ms_doubleclick_grace to wait and see if it will become a double-click. Set LWSBTNRGMFLAG_CLASSIFY_DOUBLECLICK to enable it or leave that bit at 0 to get faster single-click classification.

◆ lws_button_map

struct lws_button_map

Definition at line 64 of file lws-button.h.

+ Collaboration diagram for lws_button_map:
Data Fields
_lws_plat_gpio_t gpio
const char * smd_interaction_name
const lws_button_regime_t * regime

a default regime is applied if this is left NULL

◆ lws_button_controller

struct lws_button_controller

Definition at line 71 of file lws-button.h.

+ Collaboration diagram for lws_button_controller:
Data Fields
const char * smd_bc_name
const lws_gpio_ops_t * gpio_ops
const lws_button_map_t * button_map
lws_button_idx_t active_state_bitmap
uint8_t count_buttons

Macro Definition Documentation



Definition at line 33 of file lws-button.h.

Typedef Documentation

◆ lws_button_idx_t

typedef uint16_t lws_button_idx_t

Definition at line 30 of file lws-button.h.

◆ lws_button_cb_t

typedef void(* lws_button_cb_t) (void *opaque, lws_button_idx_t idx, int state)

Definition at line 35 of file lws-button.h.

◆ lws_button_regime_t

◆ lws_button_map_t

◆ lws_button_controller_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 40 of file lws-button.h.

40  {
42 };
Definition: lws-button.h:41

Function Documentation

◆ lws_button_controller_create()

LWS_VISIBLE LWS_EXTERN struct lws_button_state* lws_button_controller_create ( struct lws_context *  ctx,
const lws_button_controller_t controller 

lws_button_controller_create() - instantiate a button controller

ctxthe lws_context
controllerthe static controller definition

Instantiates a button controller from a static definition of the buttons and their smd names, and active levels, and binds it to a gpio implementation

◆ lws_button_controller_destroy()

LWS_VISIBLE LWS_EXTERN void lws_button_controller_destroy ( struct lws_button_state *  bcs)

lws_button_controller_destroy() - destroys a button controller

bcsbutton controller state previously created

Disables all buttons and then destroys and frees a previously created button controller.

◆ lws_button_get_bit()

LWS_VISIBLE LWS_EXTERN lws_button_idx_t lws_button_get_bit ( struct lws_button_state *  bcs,
const char *  name 

◆ lws_button_enable()

LWS_VISIBLE LWS_EXTERN void lws_button_enable ( struct lws_button_state *  bcs,
lws_button_idx_t  _reset,
lws_button_idx_t  _set