BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - BRT Community

Pages: 1 ... 6 7 [8] 9 10 ... 50
106
Discussion - EVE / Re: Disable AUDIO_L output signal
« on: March 02, 2023, 03:26:36 PM »
Hello,

One way is to play the 'silence' sound by writing 0x00 to the REG_SOUND register.

You can find details of the audio playback registers in section 4.7 of the datasheet,
https://brtchip.com/wp-content/uploads/sites/3/2022/04/DS_BT81X-1.1.pdf

Best Regards, BRT Community






107
Discussion - EVE / Re: Reading BT815 font metrics
« on: February 23, 2023, 01:10:15 PM »
Hello,

Thanks for your feedback, we will look into updating the datasheet to make this more clear.

The value listed in datasheet for “font width(max)” row refers to the maximum width value of all ASCII chars listed in the same table of the datasheet.

The font width value for font 28 ‘@’ symbol is 19, which includes the ‘@’ symbol image bitmap width (18 pixel) plus spacing to next char (1 pixel). The bitmap handler will use this value to determine the starting position of next text char in the text string.


Best Regards,
BRT Community

108
Discussion - EVE / Re: Reading BT815 font metrics
« on: February 22, 2023, 03:14:00 PM »
Hello,


I've heard back from he developer on this point:

Code: [Select]
The purpose of width in the width table is to denote the distance to move right when rendering the character.
This includes the character itself, plus the 1-pixel space between characters.
So the widest character can be 18 pixels, with a maximum "width" of 19 pixels.

As such the rom_font.pixel_width is listing the widest character, but not including the 1 pixel spacing. Where as the individual charter widths are listing the widths with the 1 pixel spacing included, as this would be the actual width of the character when displayed on screen.

Best Regards,
BRT Community

109
Discussion - EVE / Re: Simple way to draw meter
« on: February 21, 2023, 01:33:04 PM »
Hi,

Here is one small example of using some gradients along with a gauge widget.

Here is the code and a short description attached,

Code: [Select]
CLEAR_COLOR_RGB(255, 255, 255)
CLEAR(1, 1, 1)

// *** Draw the invisible circles to make the ARC in the stencil buffer ***
COLOR_MASK(0, 0, 0, 1) // Disable writes of R, G and B to the screen
STENCIL_OP(INCR, INCR) // Set the stencil to increment

COLOR_RGB(0, 0, 255)
BEGIN(POINTS)
POINT_SIZE(1600) // Draw an outer circle defining the outside of the arc
VERTEX2II(200, 200)
COLOR_RGB(0, 255, 0)
POINT_SIZE(800) // Draw an inner circle defining the inside of the arc
VERTEX2II(200, 200)
END()

// *** Draw the gradient arc ***
COLOR_MASK(1, 1, 1, 1) // Enable writes to the colors again
STENCIL_OP(KEEP, KEEP) // Stop the stencil INCR
STENCIL_FUNC(EQUAL, 1, 255) // Only draw where the stencil buffer is =1 which is our arc
SCISSOR_SIZE(100, 100) // Constrain drawing to one half of the arc
SCISSOR_XY(100, 100)
CMD_GRADIENT(200, 150, 0xFFFF00, 100, 200, 0xFF0000) // Draw a gradient from red to yellow
SCISSOR_SIZE(100, 100) // Constrain drawing to the other half of the arc
SCISSOR_XY(200, 100)
CMD_GRADIENT(200, 150, 0xFFFF00, 300, 199, 0x00AA00) // Draw a gradient from yellow to green

// *** Return the stencil and scissor to normal***
STENCIL_FUNC(ALWAYS, 1, 255)
SCISSOR_SIZE(800, 480)
SCISSOR_XY(0, 0)

// *** Draw a gauge with no background or tickmarks ***
COLOR_RGB(0, 0, 0)
CMD_GAUGE(200, 200, 107, OPT_NOBACK | OPT_NOTICKS, 4, 8, 32, 100)

Best Regards, BRT Community

110
Discussion - EVE / Re: Reading BT815 font metrics
« on: February 21, 2023, 12:45:44 PM »
Hello Rudolph,

Thankyou for your post.

I've performed a couple of quick tests and can see the font header returning a width of 18 for font 28.
I'm going to chase this up with the development team to see if they have any insight.

Best Regards,
BRT Community

111
Discussion - EVE / Re: Simple way to draw meter
« on: February 20, 2023, 04:54:11 PM »
Hi,

There are a few ways to do this, which can be
- entirely with EVE display objects (including the gauge background and the pointer)
- entirely via loading images (e.g. have a series of bitmap cells with the gauge at different positions)
- or a combination of these (e.g. image as the gauge background and use EVE shapes for the pointer)

One suggested way would be to use an image as the background of the gauge, and then to have a second bitmap of just the pointer and then rotate the pointer image.

You can also make the background using EVE shapes.

We can make a couple of small examples of these for you and post them here.

Best Regards, BRT Community





112
Discussion - EVE / Re: Simple way to draw meter
« on: February 17, 2023, 03:33:30 PM »
Hi,

Is it an arc gauge style which you wish to draw?

Best Regards,
BRT Community


113
Discussion - EVE / Re: Stencils with Fonts
« on: February 09, 2023, 04:38:40 PM »
Hi,

Glad to hear that it helped,

Here is a very rough beta of one way to do highlighting of a block of text and also to do a cursor (by highlighting one character in a similar way)

It needs more testing and optimisation before we publish it officially but hope it helps in the meantime,

The main idea is to get the widths of each character and then add them up to work out where the highlighting rectangle should begin and how wide it should be.

Then, you can draw the rectangle either using a rectangle primitive or via efficient rectangles (see the Gameduino 2 cookbook by James Bowman available on the web as a PDF)

Finally, the text can be placed on top.

The same idea can be used to re-size shapes etc. based on the text within them or if you wanted to write a string and snapshot it etc. or any other case where you need to know the character widths.

This example uses built in fonts but you can also use widths for custom fonts.

In the code, the following lines set which char has the cursor and which chars have the highlight.

   Cursor_Position = 10;

   FirstCharToHighlight = 20;   // highlight 20th-30th characters
   LastCharToHighlight = 30;

The output looks like the attached file,

Best Regards, BRT Community


 
Code: [Select]
   
#define Handle_Highlight 7
#define Handle_Cursor 8

char message[] = "Built-In Font with Highlighting";


// Variables for the built-in font properties
    uint32_t FontByte;
    uint16_t FontIndexCounter;
    uint32_t FontTableAddress = 0;
    uint32_t X = 0;
    uint32_t Y = 0;
#define BuiltInFont 30

    // ###################################################################################################################################
    // Get font properties for a built-in font
    // ###################################################################################################################################

    // ------------------------- Get font properties for a built-in font --------------------
    // This shows how to get the width and properties of internal fonts. We need to read the
    // properties from EVE as the data is not currently in the MCU

    EVE_GPU_FONT_HEADER BuiltInFont_props; // Structure defined in the header file to hold font data

    FontTableAddress = ((HAL_MemRead32(EVE_ROMFONT_TABLEADDRESS)) + ((BuiltInFont-16) * FT_GPU_FONT_TABLE_SIZE));
    // Note that font table starts at font 16
    // EVE_ROMFONT_TABLEADDRESS is equivalent to ROM_FONTROOT
    // Font Table Address = [address at ROM_FONTROOT] + ((font required - 16) * 148)

    FontIndexCounter = 0;
    while(FontIndexCounter < 128)
    {
    FontByte = HAL_MemRead8(FontTableAddress + FontIndexCounter);
    BuiltInFont_props.FontWidth[FontIndexCounter] = FontByte;
    FontIndexCounter ++;
    }
    FontByte = HAL_MemRead32(FontTableAddress + FontIndexCounter);
    BuiltInFont_props.FontBitmapFormat = FontByte;
    FontIndexCounter = FontIndexCounter + 4;

    FontByte = HAL_MemRead32(FontTableAddress + FontIndexCounter);
    BuiltInFont_props.FontLineStride = FontByte;
    FontIndexCounter = FontIndexCounter + 4;

    FontByte = HAL_MemRead32(FontTableAddress + FontIndexCounter);
    BuiltInFont_props.FontWidthInPixels = FontByte;
    FontIndexCounter = FontIndexCounter + 4;

    FontByte = HAL_MemRead32(FontTableAddress + FontIndexCounter);
    BuiltInFont_props.FontHeightInPixels = FontByte;
    FontIndexCounter = FontIndexCounter + 4;

    FontByte = HAL_MemRead32(FontTableAddress + FontIndexCounter);
    BuiltInFont_props.PointerToFontGraphicsData = FontByte;


    // ###################################################################################################################################
    // Calculate the length of the characters to highlight or to select with cursor
    // ###################################################################################################################################

uint8_t CurrentCharIndex = 0;
volatile char CurrentChar;
volatile uint8_t CurrentCharWidth;
volatile uint8_t CurrentCharHex;
uint32_t MessageSize = (sizeof(message) -1);
uint32_t TotalStringWidth = 0;

// For highlighting a block of text, here we highlight 18th-30th
uint32_t FirstCharXCoord = 0;
uint8_t FirstCharToHighlight = 0;
uint8_t LastCharToHighlight = 0;
uint32_t HighlightStringWidth = 0;
uint8_t Highlight_Enable = 0x00;

// For a cursor highlighting one character, here we select the 10th
uint8_t Cursor_Position = 0; //10
uint8_t CursorCharWidth = 0;
uint32_t CursorCharXCoord = 0;
uint8_t Cursor_Enable = 0x00;


// ######################################## Highlight ##########################################

FirstCharToHighlight = 20; // highlight 20th-30th characters
LastCharToHighlight = 30;

// --------------------- For the highlight -------------------------
// Pass in index to FirstCharToHighlight and LastCharToHighlight
// Provides output of FirstCharXCoord and HighlightStringWidth which are X coordinates to be used to draw a rectangle
CurrentCharIndex = 0;
HighlightStringWidth = 0;
TotalStringWidth = 0;
Highlight_Enable = 0xFF;

// Do not render highlight if values out of range
if((FirstCharToHighlight < 0) || (LastCharToHighlight <= FirstCharToHighlight) )
{
FirstCharXCoord = 0;
HighlightStringWidth = 0;
Highlight_Enable = 0x00;
}
else
{
// Correct any other out of range values
if(FirstCharToHighlight > (MessageSize-1))
{
FirstCharToHighlight =  (MessageSize-1);
}
if(LastCharToHighlight > (MessageSize))
{
LastCharToHighlight =  (MessageSize);
}

do
{
// Sum up the widths of the characters beginning with the first (index 0 in message)
CurrentChar = message[CurrentCharIndex];
CurrentCharHex = (uint8_t) (CurrentChar);
CurrentCharWidth = (uint8_t) BuiltInFont_props.FontWidth[CurrentCharHex];

// Record the total when we reach the START of the highlight. This becomes the width of the string up to the
// left-hand side of the FIRST character to be highlighted, allowing us to work out its coordinate
// Note that the index is 0-based and so 9 would be the 10th character.
if(CurrentCharIndex == FirstCharToHighlight)
{
FirstCharXCoord = TotalStringWidth;
}

// Record the total when we reach the END of the highlight. This becomes the width of the string up to the
// right-hand side of the LAST character to be highlighted, allowing us to work out its coordinate.
if((CurrentCharIndex >= (FirstCharToHighlight)) && (CurrentCharIndex <= (LastCharToHighlight)))
{
HighlightStringWidth += CurrentCharWidth;
}

CurrentCharIndex ++;
TotalStringWidth += CurrentCharWidth;

} while(CurrentCharIndex <= MessageSize);
}


// ######################################## Cursor ##########################################

Cursor_Position = 10;

// --------------------- For the cursor -------------------------
// Pass in index to Cursor_Position
// Provides output of CursorCharXCoord and CursorCharWidth which are X coordinates to be used to draw a rectangle
CurrentCharIndex = 0;
TotalStringWidth = 0;
Cursor_Enable = 0xFF;

// Correct any invalid inputs
if(Cursor_Position < 0)
Cursor_Position = 0;
if(Cursor_Position > MessageSize)
Cursor_Position = MessageSize;

do
{
// Sum up the widths of the characters beginning with the first (index 0 in message)
CurrentChar = message[CurrentCharIndex];
CurrentCharHex = (uint8_t) (CurrentChar);
CurrentCharWidth = (uint8_t) BuiltInFont_props.FontWidth[CurrentCharHex];

// when we reach the selected character where the cursor should go record the values to
// specify where the rectangle should begin and end
if(CurrentCharIndex == Cursor_Position)
{
CursorCharXCoord = TotalStringWidth;
CursorCharWidth = CurrentCharWidth;
}

TotalStringWidth += CurrentCharWidth;
CurrentCharIndex ++;

} while(CurrentCharIndex < MessageSize);


// ###################################################################################################################################
    // Using the font in a display list
    // ###################################################################################################################################


EVE_LIB_BeginCoProList();
EVE_CMD_DLSTART();
EVE_CLEAR_COLOR_RGB(0, 0, 0);
EVE_CLEAR(1,1,1);
EVE_COLOR_RGB(255, 255, 255);

X = 50;
Y = 100;

// ----- add a highlight -----

if(Highlight_Enable == 0xFF)
{
// Draw a rectangle using the efficient rectangles method (see Gameduino 2 cookbook), this is for the highlight
EVE_SAVE_CONTEXT(); // Save details such as current color
EVE_BEGIN(EVE_BEGIN_BITMAPS);
EVE_COLOR_RGB(0, 0, 128); // Set a blue color for the highlight
EVE_BITMAP_HANDLE(Handle_Highlight); // Set the handle
EVE_BITMAP_LAYOUT(EVE_FORMAT_L8, 1, 1); // Set an L8 bitmap 1 x 1
EVE_BLEND_FUNC(EVE_BLEND_ONE, EVE_BLEND_ZERO); // Set the blend function
// Set the size of the rectangle to be the width of the area to be highlighted and the height of the font
EVE_BITMAP_SIZE(EVE_FILTER_NEAREST, EVE_WRAP_REPEAT, EVE_WRAP_REPEAT, HighlightStringWidth, BuiltInFont_props.FontHeightInPixels);
EVE_VERTEX2F((X+FirstCharXCoord)*16, Y*16); // Place the top-left of the rectangle at the same coordinate as the character to be highlighted
EVE_RESTORE_CONTEXT(); // Restore the settings such as text colour for the next characters

// You could also use a standard rectangle here instead of the efficient rectangles
//EVE_COLOR_RGB(0, 0, 128); // Set a blue color for the highlight
//EVE_BEGIN(EVE_BEGIN_RECTS);
//EVE_VERTEX2F((X+FirstCharXCoord)*16, Y*16); // Top-left coordinate
//EVE_VERTEX2F((X+FirstCharXCoord + HighlightStringWidth)*16, (Y+BuiltInFont_props.FontHeightInPixels)*16); // Bottom right coordinate
}

// ----- add a cursor -----

if(Cursor_Enable == 0xFF)
{
// Draw a rectangle using the efficient rectangles method, this is for the cursor
// You could also use a standard rectangle here instead
EVE_SAVE_CONTEXT(); // Save details such as current color
EVE_BEGIN(EVE_BEGIN_BITMAPS);
EVE_COLOR_RGB(0, 0, 128); // Set a blue color for the highlight
EVE_BITMAP_HANDLE(Handle_Cursor); // Set the handle
EVE_BITMAP_LAYOUT(EVE_FORMAT_L8, 1, 1); // Set an L8 bitmap 1 x 1
EVE_BLEND_FUNC(EVE_BLEND_ONE, EVE_BLEND_ZERO); // Set the blend function
// Set the size of the rectangle to be the width of the current character and the height of the font
EVE_BITMAP_SIZE(EVE_FILTER_NEAREST, EVE_WRAP_REPEAT, EVE_WRAP_REPEAT, CursorCharWidth, BuiltInFont_props.FontHeightInPixels);
EVE_VERTEX2F((X+CursorCharXCoord)*16, Y*16); // Place the top-left of the rectangle at the same coordinate as the character to be highlighted
EVE_RESTORE_CONTEXT(); // Restore the settings such as text colour for the next characters
}

EVE_BLEND_FUNC(EVE_BLEND_SRC_ALPHA, EVE_BLEND_ONE_MINUS_SRC_ALPHA); // Set the blend function back to default to avoid affecting rest of screen content

EVE_COLOR_RGB(255, 255, 255); // Color white
EVE_CMD_TEXT(X, Y, BuiltInFont, 0, message); // Write the text itself

EVE_DISPLAY();
EVE_CMD_SWAP();
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();

    while(1)
    {
    }

114
Discussion - EVE / Re: Live traking on EVE4
« on: February 08, 2023, 11:22:09 AM »
Hello Elvine314,

Please advise on your previous DM so i can assist you.

Best Regards,
BRT Community

115
Discussion - EVE / Re: Stencils with Fonts
« on: February 07, 2023, 11:58:40 AM »
Hi,

For the partial characters, one way may be to reverse your operation and print text only where the stencil is a certain value. For example here the text is only visible in the grey box area where the stencil is 1.

Code: [Select]
CLEAR_COLOR_RGB(128,128,128)
CLEAR(1, 1, 1)

// increment stencil where the box is drawn
STENCIL_OP(INCR, INCR)
COLOR_A(128)
BEGIN(RECTS)
VERTEX2F(2144, 1728)
VERTEX2F(8000, 4800)
END()
// Stop the stencil incrementing
STENCIL_OP(KEEP, KEEP)

// Text only where the stencil is 1
COLOR_A(255)
STENCIL_FUNC(EQUAL, 1, 255)

CMD_TEXT(107, 144, 30, 0, "TESTS")

// return the function
STENCIL_FUNC(ALWAYS, 0, 255)

We have some explanation on using character widths for things like drawing highlighting using efficient rectangles, which are part of appnotes in development, and so we'll post some snippets from those here too.

Best Regards, BRT Community

116
Discussion - EVE / Re: Stencils with Fonts
« on: February 03, 2023, 12:21:04 PM »
Hello,

We will look into your questions,

Could you also advise what your overall intended purpose for the stencil operation was within your application? Was it to do a highlight effect or a background on a string or on only certain characters of the text? We may also be able to suggest alternative ways.

Best Regards, BRT Community

117
Discussion - EVE / Re: Custom Fonts Problem
« on: January 31, 2023, 03:01:44 PM »
Hi,

Could you share your code for loading the 5 custom fonts to EVE and setting up the font e.g. via SetFont2 command?
Could you also share your settings used to convert each font?

Are the loaded from compressed files or are they loaded as raw data?

If the attachment is too large or if you are not able to share the code snippets on the forum, then you can also email the files to us at support.emea@brtchip.com

Best Regards, BRT Community

118
Discussion - EVE / Re: Live traking on EVE4
« on: January 26, 2023, 03:26:07 PM »
Hello,

Thanks for your question.

Just to clarify you are trying to graph incoming data in a similar manner to the following application note:
AN_356 FT800 Interfacing I2C Sensor to VM800P

When programming EVE at a lower level (not with EVE Screen Designer) we tend to utilise line strips or the line primitive to produce a graph on the screen.

ESD includes a line primitive which could be utilised in a similar way, and you can look at the login patter example for how this renders lines on the screen.

Are you committed to utilising ESD in your projects development? if so, i would suggest updating to the latest available version of ESD 4.15.1.

Best Regards,
BRT Community

119
Discussion - EVE / Re: Bitmap truncated randomly
« on: January 20, 2023, 10:26:14 AM »
Hello,

Yes, from the screenshots previously provided it appears as if there may be an overwrite of assets happening in RAM_G.

If the address for the asset has been altered this will cause EVE to attempt to render the asset from the wrong RAM_G location. For example if you have a 100kB image file at RAM_G +0 and you move the allocation to RAM_G+500 the resulting display code will still attempt to render data from RAM_G+0 thus causing corruption in the image.

Do you still experience similar issue in ESD 4.15?

Best Regards,
BRT Community

120
Discussion - EVE / Re: Calculate String Width in Custom Font
« on: December 23, 2022, 09:22:25 AM »
Hi,

Here is a small example code to check the width and the address of the characters. The structure has some defines added compared to the programmers guide as the structure is shown for illustration but would not compile directly as it has more than one array in it. We have updated the Programmers Guide for this and are also releasing a short application note soon with this code and some background explanation (as well as a similar application note on doing the same with standard ASCII).

You can cycle through each character getting its width and add them up. You can then calculate the start and end points for your highlight within this data.

Best Regards, BRT Community

Code: [Select]
#define XF_GPTR(xf)                     ( (unsigned int*)&(((int*)xf)[10]) )
#define XF_WPTR(xf)                     ( (unsigned int*) &(((char*)xf)[40 + 4 * (xf->number_of_characters / 128)]))
#define XF_WIDTH(xf)                    ( (unsigned char*)&(((char*)xf)[0]))
typedef struct
{
       uint32_t signature;// Must be 0x0100AAFF
       uint32_t size;// Total size of the font block, in bytes
       uint32_t format;// Bitmap format, as defined in BITMAP_EXT_FORMAT, except TextVGA,Tex
       uint32_t swizzle;// Bitmap swizzle value
       uint32_t layout_width;//Font bitmap line stride, in bytes
       uint32_t layout_height;//Font bitmap height, in pixels
       uint32_t pixel_width;//Font screen width, in pixels
       uint32_t pixel_height;//Font screen height, in pixels
       uint32_t start_of_graphic_data;//Pointer to font graphic data in memory, including flash.
       uint32_t number_of_characters;//Total number of characters in font: N(multiple of 128)
       //uint32_t gptr[];//Offsets to glyph data
       //uint32_t wptr[];//Offsets to width data
       //uint8_t width_data[];//Width data, one byte per character
} XFONT_EXTENDED;

uint8_t cp_width(const XFONT_EXTENDED * xf, uint32_t cp)
{
    uint32_t offset = XF_WPTR(xf)[cp / 128] + (cp % 128);
    return XF_WIDTH(xf)[offset];
}

uint32_t cp_address(const XFONT_EXTENDED * xf, uint32_t cp)
{
uint32_t bytes_per_glyph;
bytes_per_glyph = xf->layout_width * xf->layout_height;

if (xf->start_of_graphic_data >= 0x800000)
//if the graphic data is in flash
return (xf->start_of_graphic_data +
(XF_GPTR(xf)[cp / 128] +
bytes_per_glyph * (cp % 128)) / 32);
else
//if the graphic data is in RAM_G
return (xf->start_of_graphic_data +
XF_GPTR(xf)[cp / 128] +
bytes_per_glyph * (cp % 128));
}


    // Load the glyph data to RAM_G + 4096
    EVE_LIB_WriteDataToRAMG(glyph_data, sizeof(glyph_data), 4096);
    // Load the xfont data to RAM_G + 0
    EVE_LIB_WriteDataToRAMG(xfont_data, sizeof(xfont_data), 0);

    // Apply the xf structure to the xfont data array
    const XFONT_EXTENDED *xf = (const XFONT_EXTENDED *)xfont_data;

    cp_width_G = cp_width(xf, 0x0047); // letter G = 0x0047
    cp_address_G = cp_address(xf, 0x0047); // Letter G = 0x0047





Pages: 1 ... 6 7 [8] 9 10 ... 50