Running Sparklet over RTOS
In case an RTOS is used, create a high priority task for Sparklet with required stack size. Running it at high priority will keep the UI responsive. For example, in FreeRTOS, a task for Sparklet with the given stack size and priority can be configured like the following in the FSP configuration:
![]()
Stack Configuration with property
This creates the example snippet automatically as follows while code generation.
1static StaticTask_t sparklet_thread_memory;
2static uint8_t sparklet_thread_stack[6120] BSP_PLACE_IN_SECTION(BSP_UNINIT_SECTION_PREFIX ".stack.sparklet_thread")
3BSP_ALIGN_VARIABLE(BSP_STACK_ALIGNMENT);
4
5TaskHandle_t sparklet_thread;
6
7sparklet_thread = xTaskCreateStatic
8
9 (sparklet_thread_func,
10
11 (const char*) "Sparklet Thread", 6120 / 4, // In words, not bytes
12
13 (void*) &sparklet_thread_parameters, //pvParameters
14
15 8,
16
17 (StackType_t*) &sparklet_thread_stack,
18
19 (StaticTask_t*) &sparklet_thread_memory
20
21 );
The function sparklet_thread_func would have the following functions to run the sparklet.
1sgui_pre_init ();
2sparklet_main();
The function sparklet_main() should include all core APIs and the following is an example snippet:
1void sparklet_main()
2{
3 shal_init_signal();
4 sgui_init ();
5 sgui_event_manager_init ();
6 rs_exec_init ();
7 sgui_screens_init ();
8 sgui_sparklet_enable(1);
9 while (1)
10 {
11 sgui_process ();
12 rs_exec_process();
13 }
14}