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:
2026-10-02 09:10:10 +02:00
co-authored by Claude Opus 5.5
parent b293197ace
commit ae0726b7f9
14 changed files with 810 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include <vector>
#include "service.h"
namespace roro {
class ServiceManager {
public:
void add(Service& service);
// Starts services in the order added; each gets its first tick on the next tick() call.
void startAll(uint32_t nowMs);
// Stops services in reverse order.
void stopAll();
// Ticks every service whose interval has elapsed. Missed intervals are not replayed.
void tick(uint32_t nowMs);
private:
struct Entry {
Service* service;
uint32_t lastTickMs;
bool due;
};
std::vector<Entry> entries_;
bool running_ = false;
};
} // namespace roro