Docs menu

Developer Integration

UserEvents and Developer Ownership

Genuine-user hooks and regeneration-safe ownership reconciliation in 95_UserEvents.c.

Genuine-user contract

UserEvents represent genuine interaction. Construction, hydration and programmatic FG_Set_* calls do not emit callbacks. Keep hooks short and delegate GPIO, relay, sensor, networking and blocking work to developer-owned services or tasks.

From ForgeUI UI to physical hardware

text
FORGEUI UI
  → genuine generated UserEvent
  → developer-owned code
  → PHYSICAL HARDWARE
c
void FG_On_LED1_Toggle_Changed(bool checked)
{
    hardware_example_01_set_led1(checked);
}

void FG_On_LED2_Toggle_Changed(bool checked)
{
    hardware_example_01_set_led2(checked);
}

These Example 01 callbacks are genuine touchscreen events. Their developer-owned bodies delegate to the developer-owned hardware module; they do not manipulate private generated LVGL objects. Programmatic setters remain silent and cannot masquerade as user input.

Regeneration-safe reconciliation

Example 01 ownership pattern

LayerOwner
Editable UI, generated LVGL and public Runtime SDKForgeUI
Genuine UserEvent declarations and generated call sitesForgeUI contract
Preserved UserEvent bodiesDeveloper-owned behavior
GPIO configuration, debounce and output drivingDeveloper-owned hardware module

In the live Example 01 workflow, regeneration replaces 90_Studio_Export.* while preserving matching customised 95_UserEvents.c bodies. The exporter retains 96_Hardware_Example_01.c in CMake only while the required Example 01 APIs and UserEvents exist. This keeps hardware behavior outside generated LVGL and prevents ordinary regeneration from dropping the developer module.