Embedded SDK
Embedded SDK
Touchscreen management

Introduction

This chapter describes briefly how NBGL manages the touchscreen events and how to receive and process these events.

Touchscreen management

The low-level entry point of NBGL for Touchscreen management is nbgl_touchHandler(). This function is supposed to be called periodically by the main scheduler to provide the current state and position of the finger on the Touchscreen.

The position is always useful when the state field of nbgl_touchStatePosition_t is PRESSED, and also useful when the new state is RELEASED.

From a high-level perspective, every object can declare itself as "client" of touchscreen events.

The low-level events are:

  • TOUCHED corresponding to an object touched and released at least SHORT_TOUCH_DURATION ms later but less than LONG_TOUCH_DURATION ms
  • LONG_TOUCHED corresponding to an object touched and released at least LONG_TOUCH_DURATION ms later.
  • TOUCHING corresponding to an object that is currently touched
  • OUT_OF_TOUCH corresponding to an object that was touched but that has lost the focus (the finger has moved)
  • TOUCH_RELEASED corresponding to an object that was touched and where the finger has been released.

Typically, nbgl_touchHandler() shall be called when SEPROXYHAL_TAG_FINGER_EVENT message is received by Bolos UX task or by Application's main task.