Public Access
Add core runtime: event bus, services, app lifecycle
lib/core is hardware-independent and unit-tested on the host: - EventBus: fixed-size thread-safe queue, delivered on the UI task by dispatch(); drops newest when full and counts drops - Service / ServiceManager: cooperative ticking at per-service intervals, no catch-up bursts, safe across millis() wraparound - App / AppManager: one foreground App, Home always to Launcher, Back offered to the App first, hidden Apps, redraw requests - KeyEvent: logical keys for the upcoming input layer Firmware main loop now ticks services and dispatches events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace roro {
|
||||
|
||||
// Logical keys, already translated from the physical keyboard (Fn combos, Esc position, etc.).
|
||||
enum class Key : uint8_t {
|
||||
Char, // a printable character in `ch` (Unicode code point, accents already composed)
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right,
|
||||
Select,
|
||||
Back,
|
||||
Home,
|
||||
Tab,
|
||||
Delete,
|
||||
};
|
||||
|
||||
struct KeyEvent {
|
||||
Key key = Key::Char;
|
||||
uint32_t ch = 0;
|
||||
bool shift = false;
|
||||
bool ctrl = false;
|
||||
bool alt = false;
|
||||
|
||||
static KeyEvent of(Key key) {
|
||||
KeyEvent e;
|
||||
e.key = key;
|
||||
return e;
|
||||
}
|
||||
|
||||
static KeyEvent character(uint32_t codePoint) {
|
||||
KeyEvent e;
|
||||
e.ch = codePoint;
|
||||
return e;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace roro
|
||||
Reference in New Issue
Block a user