CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
ViewStack.cpp File Reference

View-stack implementation with recursive mutex. More...

#include "cdc_ui/ViewStack.h"
#include "cdc_core/EventBus.h"
#include "cdc_hal/IDisplay.h"
#include "cdc_log.h"

Go to the source code of this file.

Namespaces

namespace  cdc
namespace  cdc::ui
 Centralized key-code constants for cdc_views.

Functions

static hal::RefreshMode cdc::ui::strongerRefresh (hal::RefreshMode a, hal::RefreshMode b)
 Returns the stronger of two refresh modes.
static void cdc::ui::resetTextState (hal::IDisplay *display)
 Reset the shared GFX text state to the defaults before a view renders.

Variables

static const char * TAG = "ViewStack"

Detailed Description

View-stack implementation with recursive mutex.

The ViewStack is touched from multiple FreeRTOS contexts (UI task, USB CTAP-HID task, BLE callback task) so the underlying storage needs a synchronization primitive. The public API is reentrant: view callbacks fired from inside dispatchKey/dispatchLongPress/dispatchTick legitimately call back into push/pop/showModal/hideModal on the same task. A FreeRTOS recursive mutex is therefore required - a plain mutex would self-deadlock the UI task as soon as the first key is dispatched.

Definition in file ViewStack.cpp.

Variable Documentation

◆ TAG

const char* TAG = "ViewStack"
static

Definition at line 19 of file ViewStack.cpp.