RGB Sunglasses Animation Extension API fw-v3.8.1-1-geacf2f0
rgbx ABI + C++ wrapper for sandboxed .llext animations
Loading...
Searching...
No Matches
rgbx_v2.h File Reference

RGBX v2 memoryless WebAssembly guest ABI. More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define RGBX_V2_ABI_VERSION   2u
 RGBX WebAssembly ABI version described by this header.
 
#define RGBX_V2_WIDTH   40u
 Fixed display width in pixels.
 
#define RGBX_V2_HEIGHT   12u
 Fixed display height in pixels.
 
#define RGBX_V2_PIXEL_COUNT   (RGBX_V2_WIDTH * RGBX_V2_HEIGHT)
 Total number of pixels in one complete frame.
 
#define RGBX_V2_PIXELS_PER_SPAN   8u
 Number of consecutive pixels emitted by either span import.
 
#define RGBX_V2_MAX_PARAMS   16u
 Maximum number of numeric parameter slots.
 
#define RGBX_V2_MAX_STRING_PARAMS   4u
 Maximum number of string parameter slots.
 
#define RGBX_V2_STRING_PARAM_SIZE   32u
 Storage bytes per string slot, including the NUL terminator.
 
#define RGBX_V2_AUDIO_BAND_COUNT   4u
 Number of coarse Q16 audio-energy bands.
 
#define RGBX_V2_AUDIO_DISPLAY_BUCKET_COUNT   20u
 Number of fine-grained Q16 audio display buckets.
 
#define RGBX_V2_IMU_AXIS_COUNT   3u
 Number of axes in each IMU vector.
 
#define RGBX_V2_DIAGNOSTIC_COUNT   4u
 Maximum numeric diagnostics emitted by one tick.
 
#define RGBX_V2_MODULE_MAX_BYTES   2048u
 Maximum Wasm payload bytes in the released memoryless profile.
 
#define RGBX_V2_MAX_FUNCTIONS   8u
 Maximum functions, imported plus defined, in one module.
 
#define RGBX_V2_MAX_GLOBALS   8u
 Maximum globals a module may define.
 
#define RGBX_V2_MAX_LOCALS_PER_FUNCTION   32u
 Maximum locals declared by one function body.
 
#define RGBX_V2_MIN_IMPORTS   2u
 Fewest host imports a module may declare.
 
#define RGBX_V2_MAX_IMPORTS   5u
 Most host imports a module may declare.
 
#define RGBX_V2_MAX_PARAM_CALLS_PER_TICK   16u
 Maximum rgbx_v2_param_u32() calls admitted in one tick.
 
#define RGBX_V2_MAX_INPUT_CALLS_PER_TICK   64u
 Maximum rgbx_v2_input_u32() calls admitted in one tick.
 
#define RGBX_V2_SPAN_CALLS_PER_TICK   (RGBX_V2_PIXEL_COUNT / RGBX_V2_PIXELS_PER_SPAN)
 Span calls that cover one complete frame exactly once.
 
#define RGBX_V2_SECTION_ALLOWED_MASK   0x04ceu
 Bitmask of WebAssembly section ids the profile admits.
 
#define RGBX_V2_SECTION_REQUIRED_MASK   0x048eu
 Bitmask of WebAssembly section ids every module must carry.
 
#define RGBX_V2_CAPABILITY_BUTTONS   (1u << 0)
 Permission bit for pressed-button snapshots.
 
#define RGBX_V2_CAPABILITY_IMU   (1u << 1)
 Permission bit for accelerometer and gyroscope snapshots.
 
#define RGBX_V2_CAPABILITY_AUDIO   (1u << 2)
 Permission bit for audio energies and beat snapshots.
 
#define RGBX_V2_CAPABILITY_ALL    (RGBX_V2_CAPABILITY_BUTTONS | RGBX_V2_CAPABILITY_IMU | RGBX_V2_CAPABILITY_AUDIO)
 Mask of every sensor capability defined by RGBX v2.
 
#define RGBX_V2_EXTERN_C   extern "C"
 C-linkage declaration helper used by the flat guest ABI.
 
#define RGBX_V2_IMPORT(name)
 Host-parser no-op form of RGBX_V2_IMPORT().
 
#define RGBX_V2_EXPORT(name)
 Host-parser no-op form of RGBX_V2_EXPORT().
 

Enumerations

enum  rgbx_v2_input_kind {
  RGBX_V2_INPUT_AUDIO_BAND_Q16 = 0 , RGBX_V2_INPUT_AUDIO_DISPLAY_Q16 = 1 , RGBX_V2_INPUT_AUDIO_BEAT_MASK = 2 , RGBX_V2_INPUT_BUTTONS_PRESSED = 3 ,
  RGBX_V2_INPUT_ACCEL_MILLI = 4 , RGBX_V2_INPUT_GYRO_MILLI = 5 , RGBX_V2_INPUT_STRING_LENGTH = 6 , RGBX_V2_INPUT_STRING_BYTE_SUM = 7
}
 Selector passed to rgbx_v2_input_u32(). More...
 

Functions

RGBX_V2_EXTERN_C uint32_t rgbx_v2_param_u32 (uint32_t id) RGBX_V2_IMPORT("param_u32")
 Read one numeric parameter from the immutable tick snapshot.
 
RGBX_V2_EXTERN_C uint32_t rgbx_v2_input_u32 (uint32_t kind, uint32_t index) RGBX_V2_IMPORT("input_u32")
 Read one sensor, button, or bounded string-summary value.
 
RGBX_V2_EXTERN_C void rgbx_v2_set_good_moment (uint32_t value) RGBX_V2_IMPORT("set_good_moment")
 Publish this frame's shuffle-safe boundary signal.
 
RGBX_V2_EXTERN_C void rgbx_v2_debug_u32 (uint32_t tag, uint32_t value) RGBX_V2_IMPORT("debug_u32")
 Append one bounded numeric diagnostic to the current frame.
 
RGBX_V2_EXTERN_C void rgbx_v2_set_span8 (uint32_t first_pixel, uint32_t color0, uint32_t color1, uint32_t color2, uint32_t color3, uint32_t color4, uint32_t color5, uint32_t color6, uint32_t color7) RGBX_V2_IMPORT("set_span8")
 Emit eight consecutive native RGB24 colors.
 
RGBX_V2_EXTERN_C void rgbx_v2_set_luma_span8 (uint32_t first_pixel, uint32_t foreground, uint32_t background, uint32_t luma0, uint32_t luma1, uint32_t luma2, uint32_t luma3, uint32_t luma4, uint32_t luma5, uint32_t luma6, uint32_t luma7) RGBX_V2_IMPORT("set_luma_span8")
 Emit eight luma values interpolated between two RGB24 colors.
 

Detailed Description

RGBX v2 memoryless WebAssembly guest ABI.

SPDX-License-Identifier: MIT Copyright (c) 2026 Stuart Alldritt

This header describes guest imports and export annotations only. It exposes no Zephyr types, native pointers, WASI, libc, filesystem, network, or BLE surface. The firmware independently validates the compiled module before it links any import.

Macro Definition Documentation

◆ RGBX_V2_MAX_GLOBALS

#define RGBX_V2_MAX_GLOBALS   8u

Maximum globals a module may define.

Imported globals are refused.

Enumeration Type Documentation

◆ rgbx_v2_input_kind

Selector passed to rgbx_v2_input_u32().

Enumerator
RGBX_V2_INPUT_AUDIO_BAND_Q16 

Q16 energy; index 0..3.

RGBX_V2_INPUT_AUDIO_DISPLAY_Q16 

Q16 display energy; index 0..19.

RGBX_V2_INPUT_AUDIO_BEAT_MASK 

Beat bit mask; index must be zero.

RGBX_V2_INPUT_BUTTONS_PRESSED 

Pressed-button mask; index must be zero.

RGBX_V2_INPUT_ACCEL_MILLI 

Signed accelerometer axis; index 0..2.

RGBX_V2_INPUT_GYRO_MILLI 

Signed gyroscope axis; index 0..2.

RGBX_V2_INPUT_STRING_LENGTH 

String length; string slot 0..3.

RGBX_V2_INPUT_STRING_BYTE_SUM 

Unsigned byte sum; string slot 0..3.

Function Documentation

◆ rgbx_v2_debug_u32()

RGBX_V2_EXTERN_C void rgbx_v2_debug_u32 ( uint32_t tag,
uint32_t value )

Append one bounded numeric diagnostic to the current frame.

Parameters
tagGuest-defined numeric tag.
valueGuest-defined numeric value.

◆ rgbx_v2_input_u32()

RGBX_V2_EXTERN_C uint32_t rgbx_v2_input_u32 ( uint32_t kind,
uint32_t index )

Read one sensor, button, or bounded string-summary value.

Parameters
kindOne rgbx_v2_input_kind value.
indexKind-specific index documented by rgbx_v2_input_kind.
Returns
Snapshot bits; signed IMU values preserve their i32 representation.

◆ rgbx_v2_param_u32()

RGBX_V2_EXTERN_C uint32_t rgbx_v2_param_u32 ( uint32_t id)

Read one numeric parameter from the immutable tick snapshot.

Parameters
idNumeric parameter slot, from zero through 15.
Returns
Parameter bits as an unsigned 32-bit value.

◆ rgbx_v2_set_good_moment()

RGBX_V2_EXTERN_C void rgbx_v2_set_good_moment ( uint32_t value)

Publish this frame's shuffle-safe boundary signal.

Parameters
valueZero or one; exactly one call is required when imported.

◆ rgbx_v2_set_luma_span8()

RGBX_V2_EXTERN_C void rgbx_v2_set_luma_span8 ( uint32_t first_pixel,
uint32_t foreground,
uint32_t background,
uint32_t luma0,
uint32_t luma1,
uint32_t luma2,
uint32_t luma3,
uint32_t luma4,
uint32_t luma5,
uint32_t luma6,
uint32_t luma7 )

Emit eight luma values interpolated between two RGB24 colors.

Parameters
first_pixelOrdered linear offset: 0, 8, ..., 472.
foregroundForeground 0x00RRGGBB color selected at luma 255.
backgroundBackground 0x00RRGGBB color selected at luma zero.
luma0First luma in the closed range 0..255.
luma1Second luma in the closed range 0..255.
luma2Third luma in the closed range 0..255.
luma3Fourth luma in the closed range 0..255.
luma4Fifth luma in the closed range 0..255.
luma5Sixth luma in the closed range 0..255.
luma6Seventh luma in the closed range 0..255.
luma7Eighth luma in the closed range 0..255.

◆ rgbx_v2_set_span8()

RGBX_V2_EXTERN_C void rgbx_v2_set_span8 ( uint32_t first_pixel,
uint32_t color0,
uint32_t color1,
uint32_t color2,
uint32_t color3,
uint32_t color4,
uint32_t color5,
uint32_t color6,
uint32_t color7 )

Emit eight consecutive native RGB24 colors.

Parameters
first_pixelOrdered linear offset: 0, 8, ..., 472.
color0First 0x00RRGGBB color.
color1Second 0x00RRGGBB color.
color2Third 0x00RRGGBB color.
color3Fourth 0x00RRGGBB color.
color4Fifth 0x00RRGGBB color.
color5Sixth 0x00RRGGBB color.
color6Seventh 0x00RRGGBB color.
color7Eighth 0x00RRGGBB color.