Thank you for the link. I am following suggestion by pauljiao. It is working. I like it more because ESD_FUNCTION() macro is available and I can simulate the result under the UI of Screen Designer. My user function looks like this:
#ifndef api_font_resizer__H
#define api_font_resizer__H
#include "Ft_Esd.h"
ESD_FUNCTION(api_font_resizer, Type=uint16_t)
uint16_t api_font_resizer();
#endif
In MainPage__Generated.c :
ft_int16_t MainPage_ESD_Label_Font__Property(void *c)
{
MainPage *context = (MainPage *)c;
void *owner = context->Owner;
return api_font_resizer();
}
I am trying to structure the project with FreeRTOS, with all GUI related functions run in a task and all modelling tasks allocated to another. So it is like running in 2 threads.
The main thread listing:
#include "FT_Platform.h"
#include "freertos/FreeRTOS.h"
#include "Ft_Esd_App.h"
#include "api_font_resizer.h"
uint16_t api_font_resizer(){
static uint16_t msec=0, size= 16;
if(msec++ ==300){ //this is not 300msec. Timing should be adjusted.
if (size++ ==34){
size = 16;
}
msec=0;
}
return size;
}
void setup() {
xTaskCreatePinnedToCore(guiTask,"GuiTask",10000,NULL,1,NULL,1);
}
static uint32_t test_loop_counter=0;
void loop() {
vTaskDelay( 5000 / portTICK_PERIOD_MS ); //delay for 5 sec.
printf("Test loop counter: %d/n", test_loop_counter++);
}
Listing of Ft_Esd_App.h:
#ifndef COMPONENTS_FTDI_FT_ESD_FRAMEWORK_FT_ESD_APP_H_
#define COMPONENTS_FTDI_FT_ESD_FRAMEWORK_FT_ESD_APP_H_
#include "Ft_Esd.h"
ft_int32_t Ft_main(ft_int32_t argc, ft_char8_t *argv[]);
#include "freertos/FreeRTOS.h"
void guiTask(void *pvParameters)
{
Ft_main(0, 0);
}
#endif
It is working demonstrated by a looping "Widget Opacity" font size from 16 <-> 34, and a serial printout Test loop counter %d in parallel.
But it seems to me that ESD as a graphical framework shall have an interface for this out-of-the-box instead of a user function. I mean, if a user wants to migrate an old LED-based design to a modern GUI with EVE, he may want to keep existing code for the critical part unchanged (e.g. motor control, sensor sampling intact). Migration task is to change only a value displayed on 7 segments LED board to a 5" LCD controlled by EVE. Rewriting the major part of software to place it under MainPage__Generated.c or user_functions.c should be avoided.
I can see from Logic Interface that there are several tools available such as Signal, Slot, Input, & Variable. With Variable it can be Public, Read-only, and Private. So, did I miss anything from the user guide to update Variable or Slot with standard API subscription?