FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.

Topics - techtoys

Pages: [1]
1
Hi

By inspecting source code generated from ESD I can see that explicit casting is available for some cases but not the other. Example with .c source code generated by ESD:

(1)
//Explicit casting is available for context
Code: [Select]
Ft_Esd_Layout_Stretch__Generated.c:: Ft_Esd_Layout_Stretch__Initializer(Ft_Esd_Layout_Stretch *context){
Ft_Esd_Widget__Initializer((Ft_Esd_Widget *)context);
}

(2)
//No explicit casting for context_1
Code: [Select]
Ft_Esd_SpinBox__Generated.c:: Ft_Esd_SpinBox_Update(Ft_Esd_SpinBox *context){
//...
if (if_1)
{
 Ft_Esd_PushButton * context_1 = &context->Push_Up;
 Ft_Esd_Layout_Linear * parent_1 = &context->Horizontal_Layout;
 Ft_Esd_Widget_InsertTop(context_1, parent_1);
}else{
//...
}
}

All __Generated.c source files are generated by ESD with some .widget files as blueprints. So I am thinking if there is any "switch" or some sort to control explicit casting v.s. implicit casting.

Asking this question because I am working on a project to port Eclipse project output for ESP32 and Arduino. ESP32-IDF in pure C has no problem. A python program developed to convert Eclipse output to ESP32-based project is working, because ESD and ESP32 are both using pure C.

However I am hitting a wall with Arduino in C++, which requires strict syntaxes with explicit casting. Modification by putting explicit casting like snippet below will get the project compiled successfully. But it would not be a friendly package if we need to do it manually for every project.

Code: [Select]
Ft_Esd_Widget_InsertTop((Ft_Esd_Widget*)context_1, (Ft_Esd_Widget*)parent_1);
ESD is a nice software that opens up node-based visual programming for embedded GUI development. I am fascinated by its features and the possibility of extending this software to MCUs next to FT9xx. I also believe its influence can be much more profound than just using it for FT9xx (FT9xx MCU series is good but ESD can be much more). The success of porting ESP32 has proven my thinking.

So I wish to see if the same task to Arduino can be done. I am almost there. With manual modification manually and patches applying an Eclipse output from ESD can work with Arduino (Teensy in particular).

The next phase is to get project conversion done in an elegant and automatic manner.

Wish to see if there is somebody sharing my thinking and like to provide any insight.

2
Hi

Studying how to update a ESD label with value returned from a temperature sensor. My version of ESD is 4.5 beta 2.
Project modified from a basic example : WidgetOpacity as the starting point. I have changed the font size of the ESD Label "Widget Opacity" with an Input Logic Interface. Screen shot of ESD UI attached for reference.

My target is to update the font size with a temperature sensor reading, from 16 to 34.
From ESD simulation the Font size is fixed, because I have not supplied the function to update the reading yet. However, project compiled OK and running good.

Now an Eclipse project is generated with MainPage__Generated.c created with full listing at the end of this post.
I can see that ESD_Label_Font__Property() is changed as follows:

Code: [Select]
ft_int16_t MainPage_ESD_Label_Font__Property(void *c)
{
MainPage *context = (MainPage *)c;
void *owner = context->Owner;
return context->temp_sensor(owner);
}

I think the key is to get context->temp_sensor(owner) updated for whatever period I need via an API.
Under #ifdef ESD_SIMULATION...#endif there are two function prototypes:

Code: [Select]
int MainPage__Get_temp_sensor__ESD(void *context) { return ((MainPage__ESD *)context)->temp_sensor; }
void MainPage__Set_temp_sensor__ESD(void *context, int value) { ((MainPage__ESD *)context)->temp_sensor = value; }

These two functions are not present beyond ESD_SIMULATION.

My question:

Is MainPage__Set_temp_sensor__ESD() the API I need to supply in order to update the font size? Where is the right place to put API to update the temperature reading?

From ESD user guide there are not many examples.


Code: [Select]
//File name: MainPage__Generated.c

#include "MainPage.h"

extern void Ft_Esd_Noop(void *context);
int MainPage_temp_sensor__Default(void *context) { return 16L; }

static ft_int16_t MainPage_ESD_Label_Font__Property(void *context);
static const char * MainPage_ESD_Label_Text__Property(void *context) { return "Widget Opacity"; }
static ft_int16_t MainPage_ESD_Slider_Min__Property(void *context) { return 16; }
static ft_int16_t MainPage_ESD_Slider_Max__Property(void *context) { return 34; }
static ft_uint8_t MainPage_ESD_Gauge_Alpha__Property(void *context);
static ft_uint8_t MainPage_ESD_Clock_Alpha__Property(void *context);
static ft_int16_t MainPage_ESD_Slider_1_Max__Property(void *context) { return 255; }

static Ft_Esd_WidgetSlots s_MainPage__Slots = {
(void(*)(void *))Ft_Esd_Widget_Initialize,
(void(*)(void *))Ft_Esd_Widget_Start,
(void(*)(void *))Ft_Esd_Widget_Enable,
(void(*)(void *))Ft_Esd_Widget_Update,
(void(*)(void *))Ft_Esd_Widget_Render,
(void(*)(void *))Ft_Esd_Widget_Idle,
(void(*)(void *))Ft_Esd_Widget_Disable,
(void(*)(void *))MainPage_End,
};


void MainPage__Fixed_Position__Initializer(MainPage *context)
{
Ft_Esd_Layout_Fixed *object = &context->Fixed_Position;
Ft_Esd_Layout_Fixed__Initializer(object);
object->Owner = context;
object->Widget.Active = 1;
object->Widget.LocalX = 0;
object->Widget.LocalY = 0;
object->Widget.LocalWidth = 50;
object->Widget.LocalHeight = 50;
Ft_Esd_Widget_InsertBottom((Ft_Esd_Widget *)object, (Ft_Esd_Widget *)context);
}

void MainPage__ESD_Label__Initializer(MainPage *context)
{
Ft_Esd_Label *object = &context->ESD_Label;
Ft_Esd_Label__Initializer(object);
object->Owner = context;
object->Widget.Active = 1;
object->Widget.LocalX = 10;
object->Widget.LocalY = 12;
object->Widget.LocalWidth = 330;
object->Widget.LocalHeight = 44;
object->Font = MainPage_ESD_Label_Font__Property;
object->Text = MainPage_ESD_Label_Text__Property;
Ft_Esd_Widget_InsertBottom((Ft_Esd_Widget *)object, (Ft_Esd_Widget *)&context->Fixed_Position);
}

void MainPage__ESD_Slider__Initializer(MainPage *context)
{
Ft_Esd_Slider *object = &context->ESD_Slider;
Ft_Esd_Slider__Initializer(object);
object->Owner = context;
object->Widget.Active = 1;
object->Widget.LocalX = 40;
object->Widget.LocalY = 164;
object->Widget.LocalWidth = 300;
object->Widget.LocalHeight = 40;
object->Value = 16;
object->Min = MainPage_ESD_Slider_Min__Property;
object->Max = MainPage_ESD_Slider_Max__Property;
Ft_Esd_Widget_InsertBottom((Ft_Esd_Widget *)object, (Ft_Esd_Widget *)&context->Fixed_Position);
}

void MainPage__ESD_Gauge__Initializer(MainPage *context)
{
Ft_Esd_Gauge *object = &context->ESD_Gauge;
Ft_Esd_Gauge__Initializer(object);
object->Owner = context;
object->Widget.Active = 1;
object->Widget.LocalX = 75;
object->Widget.LocalY = 217;
object->Widget.LocalWidth = 186;
object->Widget.LocalHeight = 155;
object->Alpha = MainPage_ESD_Gauge_Alpha__Property;
Ft_Esd_Widget_InsertBottom((Ft_Esd_Widget *)object, (Ft_Esd_Widget *)&context->Fixed_Position);
}

void MainPage__ESD_Clock__Initializer(MainPage *context)
{
Ft_Esd_Clock *object = &context->ESD_Clock;
Ft_Esd_Clock__Initializer(object);
object->Owner = context;
object->Widget.Active = 1;
object->Widget.LocalX = 211;
object->Widget.LocalY = 73;
object->Widget.LocalWidth = 90;
object->Widget.LocalHeight = 82;
object->Alpha = MainPage_ESD_Clock_Alpha__Property;
Ft_Esd_Widget_InsertBottom((Ft_Esd_Widget *)object, (Ft_Esd_Widget *)&context->Fixed_Position);
}

void MainPage__ESD_Slider_1__Initializer(MainPage *context)
{
Ft_Esd_Slider *object = &context->ESD_Slider_1;
Ft_Esd_Slider__Initializer(object);
object->Owner = context;
object->Widget.Active = 1;
object->Widget.LocalX = 20;
object->Widget.LocalY = 404;
object->Widget.LocalWidth = 418;
object->Widget.LocalHeight = 42;
object->Value = 255;
object->Max = MainPage_ESD_Slider_1_Max__Property;
Ft_Esd_Widget_InsertBottom((Ft_Esd_Widget *)object, (Ft_Esd_Widget *)&context->Fixed_Position);
}

void MainPage__Initializer(MainPage *context)
{
Ft_Esd_Widget__Initializer((Ft_Esd_Widget *)context);
context->Widget.ClassId = MainPage_CLASSID;
context->Widget.Slots = &s_MainPage__Slots;
context->Widget.LocalX = 0;
context->Widget.LocalY = 0;
context->Widget.LocalWidth = 400;
context->Widget.LocalHeight = 300;
context->temp_sensor = MainPage_temp_sensor__Default;
MainPage__Fixed_Position__Initializer(context);
MainPage__ESD_Label__Initializer(context);
MainPage__ESD_Slider__Initializer(context);
MainPage__ESD_Gauge__Initializer(context);
MainPage__ESD_Clock__Initializer(context);
MainPage__ESD_Slider_1__Initializer(context);
}

void MainPage_End(MainPage *context)
{
void *owner = context->Owner;
Ft_Esd_Widget_End((Ft_Esd_Widget *)context);
Ft_Esd_Widget_Detach((Ft_Esd_Widget *)&context->Fixed_Position);
Ft_Esd_Widget_Detach((Ft_Esd_Widget *)&context->ESD_Label);
Ft_Esd_Widget_Detach((Ft_Esd_Widget *)&context->ESD_Slider);
Ft_Esd_Widget_Detach((Ft_Esd_Widget *)&context->ESD_Gauge);
Ft_Esd_Widget_Detach((Ft_Esd_Widget *)&context->ESD_Clock);
Ft_Esd_Widget_Detach((Ft_Esd_Widget *)&context->ESD_Slider_1);
}

ft_int16_t MainPage_ESD_Label_Font__Property(void *c)
{
MainPage *context = (MainPage *)c;
void *owner = context->Owner;
return context->temp_sensor(owner);
}

ft_uint8_t MainPage_ESD_Gauge_Alpha__Property(void *c)
{
MainPage *context = (MainPage *)c;
void *owner = context->Owner;
return context->ESD_Slider_1.Value;
}

ft_uint8_t MainPage_ESD_Clock_Alpha__Property(void *c)
{
MainPage *context = (MainPage *)c;
void *owner = context->Owner;
return context->ESD_Slider.Value;
}

#ifdef ESD_SIMULATION
#include <stdlib.h>

typedef struct
{
MainPage Instance;
int temp_sensor;
} MainPage__ESD;

int MainPage__Get_temp_sensor__ESD(void *context) { return ((MainPage__ESD *)context)->temp_sensor; }
void MainPage__Set_temp_sensor__ESD(void *context, int value) { ((MainPage__ESD *)context)->temp_sensor = value; }

void *MainPage__Create__ESD()
{
MainPage__ESD *context = (MainPage__ESD *)malloc(sizeof(MainPage__ESD));
MainPage__Initializer(&context->Instance);
context->Instance.Owner = context;
context->temp_sensor = 16L;
context->Instance.temp_sensor = MainPage__Get_temp_sensor__ESD;
return context;
}

void MainPage__Destroy__ESD(void *context)
{
free(context);
}


#endif /* ESD_SIMULATION */

//end of file


Thank you.




3
Studying how EVE Screen Designer 4.5 works and found a datatype mismatch in FT_Esd_Dl.c.

This file is stored at ./EVE Screen Designer/Libraries/FT_Esd_Framework/

Data type for FT_Esd_BitmapHandleUse[] declared as ft_bool_t.

However, browsing down the source code at line #251 an assignment to 2 is declared.

Code: [Select]
if ((handle < FT_ESD_BITMAPHANDLE_NB) && (handle != FT_ESD_SCRATCHHANDLE)) // When valid and not using scratch handle
{
Ft_Esd_BitmapHandleUse[handle] = 2; // In use
}

This leads to compile error for some other toolchain.

4
Hi

I am trying to port ESD to ESP32 Wifi SoC in addition to FT9xx MCUs. The HAL part is working with a new directory ESP32 in FT_Eve_Hal/Hdr and FT_Eve_Hal/Src with relevant .c and .h files. New compiling directive added to FT_Platform.h as ESP32_PLATFORM, together with a new LCD model of 480*854.

Toolchain is the development framework base on Cygwin GCC in Eclipse IDE. I also tested Cross GCC and it shows to be working too. Language in pure C.

Now I am proceeding further with FT_Esd_Framework by copying all .c and .h files to project and get them compiled.

There is a problem with Ft_Esd_WidgetSlots structure in Ft_Esd_Widget.h. This structure is initialized in almost each of the .c files under /FT_Esd_Framework with individual function pointers. For example, in Ft_Esd_Layout_Tag.c this structure is initialized as follows:

Code: [Select]
static Ft_Esd_WidgetSlots s_Ft_Esd_Layout_Tag__Slots = {
(void(*)(void *))Ft_Esd_Widget_Initialize,
(void(*)(void *))Ft_Esd_Widget_Start,
(void(*)(void *))Ft_Esd_Widget_Enable,
(void(*)(void *))Ft_Esd_Widget_Update,
(void(*)(void *))Ft_Esd_Layout_Tag_Render,
(void(*)(void *))Ft_Esd_Widget_Idle,
(void(*)(void *))Ft_Esd_Widget_Disable,
(void(*)(void *))Ft_Esd_Widget_End,
};

With official Bridgetek FT9xx GCC, this intialization is giving warning as
Code: [Select]
missing braces around initializer [-Wmissing-braces] Ft_Esd_FixedPointNumericLabel__Generated.c /WidgetOpacity/FT_Esd_Widgets line 26 C/C++ Problem

This is a warning but not error.

Unfortunately, the same code with Cygwin GCC/Cross GCC is giving an error with the same message
Code: [Select]
missing braces around initializer [-Wmissing-braces]
Because Ft_Esd_WidgetSlots is a structure composed of a union of an array of 8 elements, should it be 3 braces in initialization like code snippet below instead of a single brace pair ?

Code: [Select]
static Ft_Esd_WidgetSlots s_Ft_Esd_Layout_Display__Slots = {{{
(void(*)(void *))Ft_Esd_Widget_Initialize,
(void(*)(void *))Ft_Esd_Widget_Start,
(void(*)(void *))Ft_Esd_Widget_Enable,
(void(*)(void *))Ft_Esd_Layout_Display_Update,
(void(*)(void *))Ft_Esd_Layout_Display_Render,
(void(*)(void *))Ft_Esd_Layout_Display_Idle,
(void(*)(void *))Ft_Esd_Widget_Disable,
(void(*)(void *))Ft_Esd_Widget_End,
}}};
I tried three braces with my toolchain and it works OK. Does anybody know why is it so? Is it something with compile options to change it?

Hope it is "legal" to port the ESD to a third party MCU as I notice only FT9xx series MCUs are supported for now. But I do realize that porting guide for ESD 4.5 is on the way. I am not sure if my question here worth an answer.

John

5
Discussion - Software / EVE Screen Editor - Flash Storage Options
« on: April 05, 2019, 05:39:49 PM »
Hi

Testing EVE Screen Editor (BT815) with  different storage options, Embedded and Flash options. Msvc_Emulator under MS Visual Studio works 100% OK for Embedded option but the same image is not displayed when I changed it to Flash options.

Is Flash options supported for Msvc Emulator? Do I need to change code manually in Coprocessor list to make it work? I also notice that for both Embedded and Flash options the generated coprocessor list is the same, listed below:

BITMAP_HANDLE(0)
CMD_SETBITMAP(0, RGB565, 240, 423)
BEGIN(BITMAPS)
VERTEX2II(0, 0, 0, 0)
END()

When Embedded options is selected a constant array is generated in .h file. However, for Flash options there is nothing generated to represent the data array. Any suggestion?

John

6
Hi

I am starting to design a custom PCB for my application with BT815. My host is a SoC with SPI access. A Serial Flash will be onboard for storage of graphic assets (png, wav, video etc). I can see that there is a <Program Flash> utility in EVE Asset Builder to program a Serial Flash via FT4222. From schematic of VM810C a FT4222HQ is onboard that wired to QSPI of BT816. My questions are:

1) If I don't want to include FT4222 on each of my final design PCB (to save BOM cost), is a SPI/QSPI MUX required? Or needing a jumper set to select between FT4222 vs my host?
2) Is the protocol to program a serial flash wired up to BT81x open so that I can include it in my firmware?

John

7
Discussion - Software / FT813 Touch screen response
« on: March 28, 2019, 08:39:00 AM »
Hi

I am porting a new LCD display to FT813 with a CTP controller FT6206 from FocalTech. This controller works with FT813 native hardware wiring to RST, INT, SCL and SDA directly between FT813 and FT6206. CMD_SKETCH() is working but I find sometimes the firmware doesn't detect a finger lift. That means a touch is reported properly with REG_TOUCH_TAG returning the tag number (in my case it is 2). One moment when the finger is lifted REG_TOUCH_TAG returns 0 which is OK, but the other time it just stays 2. This implies the hardware fails to detect a finger release. I have to touch on some other area of the CTP to force REG_TOUCH_TAG return to 0. Is there any method to improve the sensitivity? Is this issue common to other displays (with other CTP controllers)?


Here is my source code for your reference:

Code: [Select]
#include <FT81xImpluino.h> //this is a custom module for FT81x for Arduino

void setup()
{
  Serial.begin(115200);
  FT81xImpl.begin();

  FT81xImpl.DLStart(); //new display list
  FT81xImpl.Clear(1, 1, 1);
  FT81xImpl.Begin(BITMAPS);
  FT81xImpl.Tag(2);
  FT81xImpl.Cmd_Button(84, 30, 300, 200, 31, 0, "Button");
 
  FT81xImpl.Cmd_Track(84, 30, 300, 200, 2);
  FT81xImpl.End();
 
  FT81xImpl.DLEnd();   //equivalent swap()
  FT81xImpl.Finish();  //equivalent wait fifo buffer empty and clean up
}

void loop()
{
  int finger = Gpu_Hal_Rd8(phost, REG_TOUCH_TAG); //low level register read
  Serial.printf("Finger %d\n", finger); //print out REG_TOUCH_TAG continuously
}


Thanks to anyone supporting this.

John

8
Discussion - Software / Partial screen update with FT813
« on: March 16, 2019, 03:09:13 PM »
Hi

Is there any method to do a partial update to LCD screen driven by FT813?
Testing with Msvc_Emulator with a very simple feature. Code snippet is shown below:

Code: [Select]
//Display list to draw something at the top
Gpu_CoCmd_Dlstart(phost);
FuncA_display_object(); //function to display something on top of the screen
App_WrCoCmd_Buffer(phost, END());
App_WrCoCmd_Buffer(phost, DISPLAY());
Gpu_CoCmd_Swap(phost);
App_Flush_Co_Buffer(phost);
Gpu_Hal_WaitCmdfifo_empty(phost);

//2nd display list to draw some other contents a the bottom.
Gpu_CoCmd_Dlstart(phost);
App_WrCoCmd_Buffer(phost, SCISSOR_XY((DispWidth / 2) - 14, (DispHeight - 75)));
App_WrCoCmd_Buffer(phost, SCISSOR_SIZE(32, 32));
App_WrCoCmd_Buffer(phost, CLEAR_COLOR_RGB(255,255, 1));
App_WrCoCmd_Buffer(phost, CLEAR(1, 1, 1));
FuncB_display_object(); //function to display other contents at the bottom of the screen
App_WrCoCmd_Buffer(phost, END());
App_WrCoCmd_Buffer(phost, DISPLAY());
Gpu_CoCmd_Swap(phost);
App_Flush_Co_Buffer(phost);
Gpu_Hal_WaitCmdfifo_empty(phost);

The mindset to run FuncA_display_object() and FuncB_display_object() within a single display list with one swap is not allowed for my case. With code above I can see only the bottom content because the second display list is refreshing the whole screen. I did try to use scissor but this macro only restrict the area to draw in the second display list, the rest of the area including the top part has been erased completely.

Is it something related to SAVE_CONTEXT() & RESTORE_CONTEXT()? and Can somebody help in this ?

Thanks in advance.

John


9
Discussion - Hardware / BT81x to support 1366*768 LCD?
« on: January 16, 2019, 09:26:21 AM »
It is stated on datasheet of BT81x that the max PLL frequency reaches 72MHz. Regarding this I wish to ask if BT81x can support a LCD of 1366*768 with pixel clock typ. @ 70MHz?

Attached jpg is a screen shot from the LCD's datasheet on timing data.


10
Hi

I am trying to export a project from ESD 4.5. Browsing all .h files but find no c++ option is available. This is just a simple directive

#ifdef __cplusplus
extern "C" {
#endif

....
#ifdef __cplusplus
}
#endif

to enable an exported project to be compiled in C++ compiler. Is there any option to add this in ESD 4.x?

John

Pages: [1]