User Input#

Functions

int usrinp_init(struct lm_gpio *debug_button, usrinp_get_state_t f_get_state)#

Initialize user input handling.

Parameters:
  • debug_button[in] Pointer to the GPIO structure for the debug button.

  • f_get_state[in] Function pointer to get the state of a user input.

Returns:

0 on success, negative error code on failure.

int usrinp_raise(usrinp_t type)#

Raise a user input event.

Parameters:

type[in] The type of user input.

Returns:

0 on success, negative error code on failure.

void usrinp_register_event_cb(usrinp_t type, usrinp_event_cb_t cb, void *cb_ctx)#

Register a callback for a user input event.

Parameters:
  • type[in] The type of user input.

  • cb[in] The callback function to register.

  • cb_ctx[in] The context for the callback.

Enums

enum usrinp_t#

Values:

enumerator USRINP_DEBUG_BUTTON#

Debug button input

enumerator USRINP_EMERGENCY_STOP#

Emergency stop input

enumerator USRINP_USB_CONNECT#

USB connection input

enum usrinp_event_t#

Values:

enumerator USRINP_EVENT_UNKNOWN#

Unknown event

enumerator USRINP_EVENT_CONNECTED#

Input connected (pressed)

enumerator USRINP_EVENT_DISCONNECTED#

Input disconnected (released)