libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::UiEventQueue Class Reference

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

Detailed Description

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.

#include <UiEventQueue.h>

Public Member Functions

struct __attribute__ ((packed)) Event
 
 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 ()
 

Static Public Attributes

static constexpr uint16_t invalidButtonId = UINT16_MAX
 
static constexpr uint16_t invalidEncoderId = UINT16_MAX
 
static constexpr uint16_t invalidPotId = UINT16_MAX
 

Constructor & Destructor Documentation

◆ UiEventQueue()

daisy::UiEventQueue::UiEventQueue ( )
inline

◆ ~UiEventQueue()

daisy::UiEventQueue::~UiEventQueue ( )
inline

Member Function Documentation

◆ __attribute__()

struct daisy::UiEventQueue::__attribute__ ( (packed )
inline

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.

◆ AddButtonPressed()

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

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

◆ AddButtonReleased()

void daisy::UiEventQueue::AddButtonReleased ( uint16_t  buttonID)
inline

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

◆ AddEncoderActivityChanged()

void daisy::UiEventQueue::AddEncoderActivityChanged ( uint16_t  encoderId,
bool  isActive 
)
inline

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

◆ AddEncoderTurned()

void daisy::UiEventQueue::AddEncoderTurned ( uint16_t  encoderID,
int16_t  increments,
uint16_t  stepsPerRev 
)
inline

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

◆ AddPotActivityChanged()

void daisy::UiEventQueue::AddPotActivityChanged ( uint16_t  potId,
bool  isActive 
)
inline

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

◆ AddPotMoved()

void daisy::UiEventQueue::AddPotMoved ( uint16_t  potId,
float  newPosition 
)
inline

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

◆ GetAndRemoveNextEvent()

Event daisy::UiEventQueue::GetAndRemoveNextEvent ( )
inline

Removes and returns an event from the queue.

◆ IsQueueEmpty()

bool daisy::UiEventQueue::IsQueueEmpty ( )
inline

Returns true, if the queue is empty.

Member Data Documentation

◆ invalidButtonId

constexpr uint16_t daisy::UiEventQueue::invalidButtonId = UINT16_MAX
staticconstexpr

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

◆ invalidEncoderId

constexpr uint16_t daisy::UiEventQueue::invalidEncoderId = UINT16_MAX
staticconstexpr

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

◆ invalidPotId

constexpr uint16_t daisy::UiEventQueue::invalidPotId = UINT16_MAX
staticconstexpr

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


The documentation for this class was generated from the following file: