Skip to content

daisy::UiEventQueue

Module: LIBDAISY / UI

A queue that holds user input events in the UI system. More...

#include <UiEventQueue.h>

Public Functions

Name
struct attribute((packed) )
UiEventQueue()
~UiEventQueue()
void AddButtonPressed(uint16_t buttonID, uint16_t numSuccessivePresses, bool isRetriggering =false)
void AddButtonReleased(uint16_t buttonID)
void AddEncoderTurned(uint16_t encoderID, int16_t increments, uint16_t stepsPerRev)
void AddEncoderActivityChanged(uint16_t encoderId, bool isActive)
void AddPotMoved(uint16_t potId, float newPosition)
void AddPotActivityChanged(uint16_t potId, bool isActive)
Event GetAndRemoveNextEvent()
bool IsQueueEmpty()

Public Attributes

Name
constexpr uint16_t invalidButtonId
constexpr uint16_t invalidEncoderId
constexpr uint16_t invalidPotId

Detailed Description

class daisy::UiEventQueue;

A queue that holds user input events in the UI system.

Author: jelliesen

A queue that holds user interface events such as button presses or encoder turns. The queue can be filled from hardware drivers and read from a UI object. Access to the queue is protected by a ScopedIrqBlocker - that means it's safe to add events from interrupt handlers.

Public Functions Documentation

function attribute

inline struct __attribute__(
    (packed) 
)

An event in the queue

The type of event

An invalid event. Returned to indicate that no events are left in the queue.

A button was pressed.

A button was released.

An encoder was turned.

The user has started or stopped turning an encoder.

A potentiometer was moved.

The user has started or stopped moving a potentiometer.

Used to indicate if a control is currently being used.

The control is not in use at the moment.

The control is actively used at the moment.

The type of event that this Event object represents.

The unique ID of the button that was pressed.

The number of successive button presses (e.g. double click).

True if the event was generated because a button was retriggered automatically while being held down.

The unique ID of the button that was released.

The unique ID of the encoder that was turned.

The number of increments detected.

The total number of increments per revolution.

The unique ID of the encoder that is affected.

The new activity type.

The unique ID of the pot that was moved.

The new position of the pot.

The unique ID of the pot that is affected.

The new activity type.


function UiEventQueue

inline UiEventQueue()

function ~UiEventQueue

inline ~UiEventQueue()

function AddButtonPressed

inline void AddButtonPressed(
    uint16_t buttonID,
    uint16_t numSuccessivePresses,
    bool isRetriggering =false
)

Adds a Event::EventType::buttonPressed event to the queue.


function AddButtonReleased

inline void AddButtonReleased(
    uint16_t buttonID
)

Adds a Event::EventType::buttonReleased event to the queue.


function AddEncoderTurned

inline void AddEncoderTurned(
    uint16_t encoderID,
    int16_t increments,
    uint16_t stepsPerRev
)

Adds a Event::EventType::encoderTurned event to the queue.


function AddEncoderActivityChanged

inline void AddEncoderActivityChanged(
    uint16_t encoderId,
    bool isActive
)

Adds a Event::EventType::encoderActivityChanged event to the queue.


function AddPotMoved

inline void AddPotMoved(
    uint16_t potId,
    float newPosition
)

Adds a Event::EventType::potMoved event to the queue.


function AddPotActivityChanged

inline void AddPotActivityChanged(
    uint16_t potId,
    bool isActive
)

Adds a Event::EventType::potActivityChanged event to the queue.


function GetAndRemoveNextEvent

inline Event GetAndRemoveNextEvent()

Removes and returns an event from the queue.


function IsQueueEmpty

inline bool IsQueueEmpty()

Returns true, if the queue is empty.


Public Attributes Documentation

variable invalidButtonId

static constexpr uint16_t invalidButtonId = UINT16_MAX;

A button ID used to indicate an invalid or non existing button.

variable invalidEncoderId

static constexpr uint16_t invalidEncoderId = UINT16_MAX;

An encoder ID used to indicate an invalid or non existing encoder.

variable invalidPotId

static constexpr uint16_t invalidPotId = UINT16_MAX;

A potentiometer ID used to indicate an invalid or non existing potentiometer.


Updated on 2024-01-03 at 19:41:01 +0000