1
General Discussion / Re: FT813 bin compression algorithm documented?
« on: February 18, 2023, 01:39:24 PM »
Thanks!
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
/* Character 56 0x38 '8' */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
0x00, 0x00, 0x05, 0x9B, 0xA7, 0x20, 0x00, 0x00, /* :e63+. */
0x00, 0x01, 0xCF, 0xFE, 0xFF, 0xF6, 0x00, 0x00, /* `G##$###r */
0x00, 0x0D, 0xF8, 0x00, 0x04, 0xEF, 0x40, 0x00, /* 8#o ,$#, */
0x00, 0x4F, 0xC0, 0x00, 0x00, 0x4F, 0xB0, 0x00, /* ,#G ,#6 */
0x00, 0x6F, 0x90, 0x00, 0x00, 0x0F, 0xD0, 0x00, /* r#e #8 */
0x00, 0x4F, 0xC0, 0x00, 0x00, 0x1F, 0xB0, 0x00, /* ,#G `#6 */
0x00, 0x0D, 0xF8, 0x00, 0x00, 0x8F, 0x50, 0x00, /* 8#o o#: */
0x00, 0x02, 0xDF, 0xD6, 0x05, 0xF9, 0x00, 0x00, /* .8#8r :#e */
0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xA0, 0x00, 0x00, /* -#####3 */
0x00, 0x08, 0xFA, 0x38, 0xDF, 0xF9, 0x00, 0x00, /* o#3-o8##e */
0x00, 0x9F, 0x70, 0x00, 0x03, 0xDF, 0xB0, 0x00, /* e#+ -8#6 */
0x02, 0xFB, 0x00, 0x00, 0x00, 0x0D, 0xF4, 0x00, /* .#6 8#, */
0x06, 0xF8, 0x00, 0x00, 0x00, 0x08, 0xF8, 0x00, /* r#o o#o */
0x05, 0xF9, 0x00, 0x00, 0x00, 0x08, 0xF8, 0x00, /* :#e o#o */
0x01, 0xFF, 0x30, 0x00, 0x00, 0x1E, 0xF4, 0x00, /* `##- `$#, */
0x00, 0x7F, 0xF8, 0x31, 0x26, 0xDF, 0xB0, 0x00, /* +##o-`.r8#6 */
0x00, 0x05, 0xEF, 0xFF, 0xFF, 0xF8, 0x00, 0x00, /* :$######o */
0x00, 0x00, 0x03, 0x67, 0x64, 0x00, 0x00, 0x00, /* -r+r, */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* */
It gives me some extra flexibility to adjust character and line spacing. It also can load raw files to show the characters in it, as they would appear on the display, but just on the PC./*
* This example shows the use of the SETFONT2 command.
* Simpler method to load RAM font. Use the font conversion utility to convert the desired
* subset of the ASCII characters, load font data, and use cmd_setfont2 command.
* In characters.txt
* !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[|]^_`abcdefghijklmnopqrstuvwxyz{|}~
*/
void Ft813Setfont40(void)
{
/*
* The converted font file will have a starting address of
* RAM_G or 0th byte mark
*/
uint8_t FontHandle = 1;
uint16_t fontFileAddress = RAM_G + 1000;
uint16_t FontWidth = 22;
uint16_t FontHeight = 40;
Ft813DLstart();
Ft813DL(CLEAR_COLOR_RGB(0, 0, 0));
Ft813DL(CLEAR(1, 1, 1));
Ft813DL(COLOR_RGB(255, 255, 255));
Ft813LoadRawFile(fontFileAddress, "SourceCodePro-Regular.ttf_40_L4.raw"); /* Load font data */
Ft813SetFont2(1, fontFileAddress, 31);
/*
* Set ram font to font handle 1, font metric block starts at fontFileAddress(RAM_G),
* and set the starting character to the 32th character in the set.
*/
uint16_t x = 10;
for(uint8_t i = 0; i < 32; i++)
{
char str[2];
str[1] = 0;
str[0] = i + 0x20;
Ft813Text(x, 10, FontHandle, 0, str);
str[0] = i + 0x20 + 32;
Ft813Text(x, 10 + FontHeight, FontHandle, 0, str);
if (i + 0x20 + 64 < 127) /* Do not print space character (0x20) */
{
str[0] = i + 0x20 + 64;
Ft813Text(x, 10 + FontHeight * 2, FontHandle, 0, str);
}
x += FontWidth;
}
Ft813Text(10, 10 + FontHeight*4, FontHandle, 0, "0123456789 The quick brown fox jumps over the lazy dog");
Ft813Text(10, 10 + FontHeight*5, FontHandle, 0, "The quick brown fox jumps over the lazy dog");
Ft813Text(10, 10 + FontHeight*6, FontHandle, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Ft813Text(10, 10 + FontHeight*7, FontHandle, 0, "abcdefghijklmnopqrstuvwxyz");
Ft813DL(DISPLAY()); /* Display the image */
Ft813Swap(); /* Swap the current display list */
Ft813Flush_Co_Buffer(); /* Download the commands into fifo */
Ft813WaitCmdFifoEmpty(); /* Wait till coprocessor completes the operation */
}
/* Draw Text: FT81x Series Programmers Guide Section 5.41 */
void Ft813Text(int16_t x, int16_t y, int16_t font, uint16_t options, const char* s)
{
Ft813StartFunc(FT_CMD_SIZE * 3 + strlen(s) + 1);
Ft813SendCmd(CMD_TEXT); // 4294967052 = FFFFFF0C
Ft813SendCmd((((uint32_t) y << 16) | (x & 0xffff)));
Ft813SendCmd((((uint32_t) options << 16) | (uint32_t) font));
Ft813SendStr(s);
Ft813EndFunc();
}
Probably, I'm overlooking something.