Hi!
Could it be that it is not possible to use any font in the FT81x controller?
I imported a 7 segment font using the FTDI Screen editor in two different sizes, and used the created binh files as import source, which worked fine as long as I am in the debugger, where I am just doing soft restarts of the device. As soon as I do a cold restart, only garbage is displayed. If I am using a different font, that has been supplied by our distributor, the font is shown fine independant of the type of system restart.
What are the requirements towards the used font?
In the below example I reduced the number of fonts to just one, which is loaded two times to make the sample simpler.
#define RAM_DSEG7MODERN_REGULAR 0
#define RAM_DSEG7MODERN_REGULAR2 61708 //uncompressed size of the font
const unsigned char DSEG7Modern_Regular[] = {
#include "Segment7Standard.h"
}; //load picture in flash
begin();
uint32_t stride_u32;
uint32_t width_u32;
uint32_t height_u32;
int t;
//Font 1
cmd_inflate(RAM_DSEG7MODERN_REGULAR); //41
loadimage(DSEG7Modern_Regular,sizeof(DSEG7Modern_Regular));
stride_u32= rd32(RAM_DSEG7MODERN_REGULAR + 132);
width_u32 = rd32(RAM_DSEG7MODERN_REGULAR + 136);
height_u32=rd32(RAM_DSEG7MODERN_REGULAR + 140);
cmd(BITMAP_HANDLE(1));
//Siehe AN014, P20: RAM_G - (num chars * (stride * height) + 148
// 0 - (32 (12 * 54 ) + 148
t = (RAM_DSEG7MODERN_REGULAR - (32 * stride_u32 * height_u32) + 148);
cmd(BITMAP_SOURCE(t));
//Format, stride, height
cmd(BITMAP_LAYOUT(L2, stride_u32, height_u32));
//NEAREST, BORDER, BORDER, width, height
cmd(BITMAP_SIZE(NEAREST, BORDER, BORDER, width_u32, height_u32));
cmd_setfont(1, RAM_DSEG7MODERN_REGULAR);
//Font 2
cmd_inflate(RAM_DSEG7MODERN_REGULAR2); //41
loadimage(DSEG7Modern_Regular,sizeof(DSEG7Modern_Regular));
stride_u32= rd32(RAM_DSEG7MODERN_REGULAR2 + 132);
width_u32 = rd32(RAM_DSEG7MODERN_REGULAR2 + 136);
height_u32=rd32(RAM_DSEG7MODERN_REGULAR2 + 140);
cmd(BITMAP_HANDLE(2));
//Siehe AN014, P20: RAM_G - (num chars * (stride * height) + 148
// 0 - (32 (12 * 54 ) + 148
t = (RAM_DSEG7MODERN_REGULAR2 - (32 * stride_u32 * height_u32) + 148);
cmd(BITMAP_SOURCE(t));
//Format, stride, height
cmd(BITMAP_LAYOUT(L2, stride_u32, height_u32));
//NEAREST, BORDER, BORDER, width, height
cmd(BITMAP_SIZE(NEAREST, BORDER, BORDER, width_u32, height_u32));
cmd_setfont(2, RAM_DSEG7MODERN_REGULAR2);
uint32_t timestamp_u32 = SYSTEMGetSystics();
while(1000 < SYSTEMGetSysticsDiff(timestamp_u32));
while(1)
{
cmd(CLEAR(1,1,1));
cmd(COLOR_RGB(255,255,255));
cmd_text(98,160,1,0,"Text");
cmd_number(124,270,1,0,42);
cmd_text(98,320,2,0,"Text");
cmd(DISPLAY());
swap();
copro_idle();
}//end of while