Docs menu

Developer Integration

95_UserEvents.c — Developer Hooks

Connect generated controls to GPIO, tasks, queues, networking and product behavior safely.

Simulate UI, then integrate application logic

Simulate the generated UI before connecting hardware. In firmware, native LVGL callbacks call FG_On_* hooks in 95_UserEvents.c; use runtime setters to publish application state back to the UI. Copy exact declarations from generated 95_UserEvents.h and 90_Studio_Export.h rather than guessing names or signatures.

95_UserEvents.h is regenerated. Keep durable application policy in developer modules and version control, keep callbacks non-blocking, and follow the display-lock convention when calling UI APIs from other tasks. Sim generates notification/no-op hooks and never runs your custom C.

Why 95_UserEvents exists

Regeneration retains compatible active custom hook bodies, refreshes placeholders and adds missing hooks. Removed or renamed hooks are deleted, including their custom bodies; incompatible bodies can be replaced. The hook header is regenerated. Version-control your independent project, keep durable logic in developer modules and compare/reconcile later exports explicitly. A fresh Hosted ZIP cannot merge edits from an older local ZIP.

Safe integration patterns

  • Set GPIO or enqueue a small command from a lightweight callback.
  • Send sensor, motor or relay work to a FreeRTOS task.
  • Call application services for networking, storage or state changes.
  • Keep long-running I/O and blocking work out of LVGL event callbacks.

Optional Fi Icon click hooks

A Standard Fi Icon with click OFF generates no hook. Click ON generates one collision-safe FG_On_<Name>_Clicked(void) hook in 95_UserEvents. The Studio component name—not the selected Fi asset—controls the hook name. Presentation setters in 96 are silent and never invoke UserEvents.

c
void FG_On_Settings_Shortcut_Clicked(void)
{
    FG_Show_Settings_Screen();       /* Open another screen. */
}

void FG_On_Pump_Relay_Clicked(void)
{
    app_queue_relay_toggle();        /* Queue GPIO or relay work. */
}

void FG_On_Refresh_Cloud_Clicked(void)
{
    app_queue_network_refresh();     /* Start network work asynchronously. */
}

void FG_On_Info_Clicked(void)
{
    app_show_info_dialog();          /* Show an application dialog. */
}

Illustrative GPIO hook

c
void FG_On_PumpToggle_Toggled(bool enabled)
{
    gpio_set_level(PUMP_GPIO, enabled);
}