|
RGB Sunglasses Animation Extension API fw-v3.8.1-1-geacf2f0
rgbx ABI + C++ wrapper for sandboxed .llext animations
|
SPDX-License-Identifier: MIT Copyright (c) 2026 Stuart Alldritt. More...
Go to the source code of this file.
Data Structures | |
| class | rgbx::Animation |
| Extension-side analog of the firmware's BaseAnimation. More... | |
Macros | |
| #define | RGBX_ANIMATION(ClassName, DisplayName, W, H, ...) |
| Instantiates ClassName as the extension's animation and emits the five required C exports (see rgbx_api.h). | |
SPDX-License-Identifier: MIT Copyright (c) 2026 Stuart Alldritt.
Header-only C++ convenience wrapper over the flat C extension ABI in rgbx_api.h.
Lets an extension author write a class instead of raw exports:
#include <rgbx/rgbx_animation.h>
class Plasma : public rgbx::Animation {
public:
void tick(uint32_t dt_ms) override {
fill(0, 0, 0);
setPixel(x_, 0, 255, 0, 0);
x_ = (x_ + 1) % width();
}
private:
size_t x_ = 0;
};
RGBX_ANIMATION(Plasma, "Plasma", 40, 12,
RGBX_PARAM("Speed", RGBX_PARAM_UINT32, 50),
RGBX_PARAM_STR("Label", "HI"));
Everything here compiles inside the extension: no vtables or C++ objects cross the host boundary — the RGBX_ANIMATION macro emits exactly the five flat C symbols rgbx_api.h requires, so C and C++ extensions are indistinguishable to the firmware.
Constraints (enforced where possible):
| #define RGBX_ANIMATION | ( | ClassName, | |
| DisplayName, | |||
| W, | |||
| H, | |||
| ... ) |
Instantiates ClassName as the extension's animation and emits the five required C exports (see rgbx_api.h).
Use at namespace scope in exactly one translation unit — which is naturally the only one, since an .llext is a single object file. The variadic tail is zero or more RGBX_PARAM(...) / RGBX_PARAM_STR(...) entries. With an empty tail the manifest gets param_count == 0 and params == NULL, exactly as the ABI contract requires (NULL ? NULL : x below evaluates to NULL when VA_OPT emits nothing and to the params array when it doesn't).
__cxa_pure_virtual is defined here because the vtable of any class with a pure-virtual member references it, and the sandbox links no C++ runtime; it can never actually be reached on a fully-constructed static instance.
| ClassName | The rgbx::Animation subclass to instantiate. Must be trivially destructible (static_assert'd here). |
| DisplayName | String literal shown as the animation's name in the companion app. |
| W | Framebuffer width in pixels; must match the host display (40 on proto0). |
| H | Framebuffer height in pixels (12 on proto0). |
| ... | Zero or more RGBX_PARAM() / RGBX_PARAM_STR() entries, at most RGBX_MAX_PARAMS of them. |