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

Pages: [1] 2

Author Topic: BMP SCREEN 1280X800 BT817Q  (Read 1719 times)

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
BMP SCREEN 1280X800 BT817Q
« on: January 09, 2025, 08:00:54 AM »

Hello:

I am new to the forum and I am developing an application for a RVTI01HVBNWC00-B 1280 x 800 screen with a BT817Q micro this same application I already have it developed for a 800 x 480 screen with a FT813 micro.

My problem is that when I want to paint on the right edge of the screen I can't because it doesn't allow me to paint more than the 1020 chords.

I would like to know if there is a way to paint more towards the edge of the screen.

This is the code I use to paint on the screen.

Translated with DeepL.com (free version)

void EVE_Bitmap (img_info_t bmp, uint16_t x, uint16_t y, uint8_t tag_id)
{
    uint32_t stride;

//  Wait4CoProFIFO_Empty();                                                     // Wait for FIFO empty

    eve_tft_dlOffset = EVE_mem_read16(REG_CMD_DL);                              //Check for enough space in RAM DL memory, 8 KB
    if (bmp.format != EVE_PALETTED8 && (eve_tft_dlOffset + EVE_BMP_SIZE + EVE_TFT_END_SIZE) > EVE_RAM_DL_SIZE) { eve_tft_error = SSP_ERR_OUT_OF_MEMORY; return; }
    else if (bmp.format == EVE_PALETTED8 && (eve_tft_dlOffset + EVE_BMP_PAL8_SIZE + EVE_TFT_END_SIZE) > EVE_RAM_DL_SIZE) { eve_tft_error = SSP_ERR_OUT_OF_MEMORY; return; }

    if (bmp.format != EVE_PALETTED8)
        Wait4CoProFIFO_FreeSpace(EVE_BMP_SIZE);                                 // Wait for necessary space in the FIFO
    else
        Wait4CoProFIFO_FreeSpace(EVE_BMP_PAL8_SIZE);                            // Wait for necessary space in the FIFO

    _io_set_cs_lo;                                                              // CS low begins SPI transaction

    EVE_address_for_write(EVE_RAM_CMD + eve_tft_cmdOffset);                     // Send address to which first value will be written

    eve_tft_txOffset = 0x0000;

    if (eve_tft_r != 255u || eve_tft_g != 255u || eve_tft_b != 255u)
    {
        EVE_add_cmd(COLOR_RGB(255u, 255u, 255u), 4u);                           // Color del texto
        eve_tft_r = 255u;
        eve_tft_g = 255u;
        eve_tft_b = 255u;
    }

    if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
        EVE_add_cmd(CMD_SCREENSAVER, 4u);                                       // Command Screen Saver 0xFFFFFF2F

    EVE_add_cmd(BITMAP_HANDLE(BMP_HANDLE), 4u);                                 // Set bitmap handle
    if (bmp.format == EVE_PALETTED4444 || bmp.format == EVE_PALETTED565 || bmp.format == EVE_PALETTED8)
    {
        EVE_add_cmd(PALETTE_SOURCE(EVE_RAM_G + bmp.ram_g_add), 4u);             // Paletted data starts at add
        EVE_add_cmd(BITMAP_SOURCE(EVE_RAM_G + bmp.ram_g_add + BMP_PAL_SIZE), 4u); // Bitmap data starts at add
    }
    else
    {
        EVE_add_cmd(BITMAP_SOURCE(EVE_RAM_G + bmp.ram_g_add), 4u);              // Bitmap data starts at add
    }
    if (bmp.format == EVE_RGB565 || bmp.format == EVE_ARGB4 || bmp.format == EVE_ARGB1555)  stride = bmp.width * 2u;
    else if (bmp.format == EVE_L1)                                                          stride = bmp.width / 8u;
    else if (bmp.format == EVE_L2)                                                          stride = bmp.width / 4u;
    else if (bmp.format == EVE_L4)                                                          stride = bmp.width / 2u;
    else                                                                                    stride = bmp.width;
    EVE_add_cmd(BITMAP_LAYOUT(bmp.format, (unsigned long)(stride), (unsigned long)bmp.height), 4u);             // Tell FT8xx about the properties of the image data
    EVE_add_cmd(BITMAP_SIZE(EVE_NEAREST, EVE_BORDER, EVE_BORDER, bmp.width, bmp.height), 4u);                   // Tell FT8xx about the on-screen properties of the image   //EVE_BILINEAR


    if (tag_id > 0u)
    {
        EVE_add_cmd(TAG_MASK(1), 4u);                                           // Enable tagging
        EVE_add_cmd(TAG(tag_id), 4u);                                           // Tag of the button
    }




    if (bmp.format != EVE_PALETTED8)
    {
        EVE_add_cmd(BEGIN(EVE_BITMAPS), 4u);                                                                     // Begin drawing bitmaps
        if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
            EVE_add_cmd(MACRO(0), 4u);
        else
            EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
        EVE_add_cmd(END(), 4u);

    }
    else
    {
        EVE_add_cmd(SAVE_CONTEXT(), 4u);
        EVE_add_cmd(BEGIN(EVE_BITMAPS), 4u);                                    // Begin drawing bitmaps
        EVE_add_cmd(BLEND_FUNC(EVE_ONE, EVE_ZERO), 4u);
        //Draw Alpha channel
        EVE_add_cmd(COLOR_MASK(0, 0, 0, 1), 4u);
        EVE_add_cmd(PALETTE_SOURCE((bmp.ram_g_add + 3)), 4u);
        if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
            EVE_add_cmd(MACRO(0), 4u);
        else
            EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
        //Draw Red channel
        EVE_add_cmd(BLEND_FUNC(EVE_DST_ALPHA, EVE_ONE_MINUS_DST_ALPHA), 4u);
        EVE_add_cmd(COLOR_MASK(1, 0, 0, 0), 4u);
        EVE_add_cmd(PALETTE_SOURCE((bmp.ram_g_add + 2)), 4u);
        if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
            EVE_add_cmd(MACRO(0), 4u);
        else
            EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
        //Draw Green channel
        EVE_add_cmd(COLOR_MASK(0, 1, 0, 0), 4u);
        EVE_add_cmd(PALETTE_SOURCE((bmp.ram_g_add + 1)), 4u);
        if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
            EVE_add_cmd(MACRO(0), 4u);
        else
            EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
        //Draw Blue channel
        EVE_add_cmd(COLOR_MASK(0, 0, 1, 0), 4u);
        EVE_add_cmd(PALETTE_SOURCE(bmp.ram_g_add), 4u);
        if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
            EVE_add_cmd(MACRO(0), 4u);
        else
            EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
        EVE_add_cmd(END(), 4u);
        EVE_add_cmd(RESTORE_CONTEXT(), 4u);
    }
    if (tag_id > 0u)
    {
        EVE_add_cmd(TAG_MASK(0), 4u);                                           // Tag mask - disable tagging of any subsequent items
    }

    EVE_spi_write(eve_tft_txOffset);

    _io_set_cs_hi;                                                              // Chip Select high concludes burst

    EVE_mem_write16(REG_CMD_WRITE, eve_tft_cmdOffset);                          // Manually update the ring buffer write position pointer to initiate processing of the FIFO

//  Wait4CoProFIFO_Empty();
}

and this is the call to the previous function :

EVE_Bitmap(g_bmp_info[CS5_LOGO_ARGUSA], 1000u, 40u, 0u);

THIS IS THE CONFIGURATION OF THE SCREEN:

/* tested with RVT101HVBNWC00-B */
/* RVT101HVBxxxxx 1280x800 10.1" Riverdi, various options, BT817 */
/* RVT121HVBxxxxx 1280x800 12.1" Riverdi, various options, BT817 */
#if defined (EVE_RVT101H)
#define     EVE_HSIZE       (1280L)
#define     EVE_VSIZE       (800L)
#define     EVE_HCYCLE      (1440L)
#define     EVE_HOFFSET     (88L)
#define     EVE_HSYNC0      (0L)
#define     EVE_HSYNC1      (20L)
#define     EVE_VCYCLE      (838L)
#define     EVE_VOFFSET     (23L)
#define     EVE_VSYNC0      (0L)
#define     EVE_VSYNC1      (10L)
#define     EVE_PCLK        (1L)//(1L)
#define     EVE_SWIZZLE     (0L)
#define     EVE_PCLKPOL     (1L)
#define     EVE_CSPREAD     (0L)
#define     EVE_DITHER      (0L)
#define     EVE_PCLK_FREQ   (0x08C1U) /* value to be put into REG_PCLK_FREQ -> 72MHz, REG_PCLK is set to 1 */
#define     EVE_PCLK_2X     (0L)
#define     EVE_TOUCH_RZTHRESH  (1200L)
#define     EVE_HAS_CRYSTAL
#define     EVE_FLASH_AVAILABLE
#if !defined (EVE_BACKLIGHT_FREQ)
#define EVE_BACKLIGHT_FREQ (4000U) /* if not overwritten in the project options, set 4kHz as recommended by Riverdi */
#endif
#define     BT81X_ENABLE
#endif

THANK YOU VERY MUCH IN ADVANCE.

A SALUTE .

PD. MY IMAGES ARE IN PALETTED4444 AND PALETTED8
« Last Edit: January 09, 2025, 08:27:13 AM by maria@dsg-id.com »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #1 on: January 09, 2025, 02:23:18 PM »

Hi,

Welcome to the BRT Community,

Could you advise what size your image is?
Also, would it be possible for you to send a photo of the image being displayed as the issue happens and we'll help to check.

Was the issue only with screensaver or was it with images in general?

Best Regards, BRT Community
Logged

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #2 on: January 10, 2025, 06:24:45 AM »

Hello:

The problem I have is with any image regardless of the size if I paint beyond the position 1020 the image disappears from the screen and if what I paint is a geometric figure like a rectangle it overflows and paints on the other side of the screen.

Investigating I have seen that I use vertex2f which has a pixel precision of 16 i.e. my x and y position are multiplied by 16 and when the resulting size is greater than 16383 it overflows the missing paint and paints it on the other side of the screen as in the case of geometric figures or disappears and does not paint it as in the case of images.

I don't know how I could paint to not have this limitation of vertex2f.

The screensaver paints the image well and reaches all the sides, but the images painted in fixed position I don't know how to do it.

For the screensaver I use CMD_SCREENSAVER which is internal, from the eve library.

The text I have no problem either, I can also paint up to the same position 1200.

Greetings


Thank you very much.
Logged

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #3 on: January 10, 2025, 06:54:52 AM »

Hello:

In the image we can see how in the buttons I have painted in position 1180 the image is not painted while in the one I have in position 1000 the image appears without problem. The size of the image is a paletted4444 of size 70x70.
Logged

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #4 on: January 13, 2025, 12:33:56 PM »

Hello:

The problem I had when painting with vertex2f has been solved by using vertex_translate_x.

Thanks for the help.

Best regards.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #5 on: January 15, 2025, 04:44:52 PM »

Hi Maria,
Thanks for your update, sorry for the late reply but great to hear that you have found the solution already,
Yes, if you reach the limit of the Vertex, you can use the vertex_translate to add on an offset to the coordinates to reach the far side of the screen.
Best Regards, BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 440
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #6 on: January 16, 2025, 05:53:28 PM »

You could make things a bit simpler by setting the range for VERTEX2F to -16384 to 16383 by using VERTEX_FORMAT(0).
You already use PIXEL_PRECISION to multiply your coordinates, this could be set to 1 or removed entirely.

And speaking of efficiency, it looks like you are mis-using the BT817 as a framebuffer and even a bad one since you need to reduce the color depth.
While this works, this is really not what EVE was designed for.
Sure, you do you, but what is the reason behind this?
« Last Edit: January 20, 2025, 06:22:59 PM by Rudolph »
Logged

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #7 on: January 21, 2025, 06:12:29 AM »

Hello :

I don't understand your misuse of the BT817, the truth is that the project is developed for FT813 with a 7‘ screen and we are adapting it to the BT817 with a 10’ screen.
When we did the project we didn't have much idea and we did things as best we could. If you can help me by explaining better what you mean by misuse and colour depth, I would be very grateful.

Thank you very much.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 440
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #8 on: January 21, 2025, 07:07:00 PM »

Ok, first my apology, I am sorry, I was too direct and there is a good chance that I just misunderstood what your application does,
after all you merely posted a fraction of your code and I presumed too much based on earlier experiences.

So, are you rendering the image data on the host system and sending these images to EVE to be displayed?
Probably not, which means I was wrong to assume this and you are using static images uploaded once and just put them in the desired positions.


Anyways, my point of using VERTEX_FORMAT(0) to set the range for VERTEX2F to -16384 to 16383 is still valid and had nothing to do with the second paragraph.


And to try on expanding on beeing actual helpfull, what threw me of is your handling of different image formats.
Not because it is wrong, but because of the use of all the different formats like L1, L2, L4, paletted 8.
The BT81x offer support for ASTC, which is far superior to the original image formats.
With ASTC 8x8 for example you get 24 bit colors plus alpha channel per pixel while you only need 2 bits of storage per pixel.
Yes, ASTC is a lossy compression format, but there are 14 variants to choose from with very high compression / visable artifacts to high compression / close to no artifacts.
And ASTC 8x8 is right in the middle with still excellent compression and few artifacts if any.
A 64 x 64 icon in ASTC 8x8 is only 1024 bytes in size.
So you could improve your UI with more images that are larger and have more colors, although RAM_G is the same 1MiB in BT81x as in FT81x.
And compared to L1 this would be twice the size, but with anti-aliasing possible.
Logged

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #9 on: January 24, 2025, 01:26:37 PM »



Hello:


I am trying to use the images in ASTC as you said.


I created them with the EVE asset builder and I read them but when I paint them on the screen they don't appear, it paints a line of little stripes on the top where the image should be. I use the following functions:



static void check_console_extras(void)
{
    ssp_err_t err;
    bool in_progress;
    ULONG actual_length = 0u;
    uint32_t flash_write_add, init_block_add, offset_add, block_mem_size, file_dz, ex_index, num_images = 0u, dz;
    CHAR ex_file[FX_MAX_LONG_NAME_LEN];

    // LOOK FOR BMP/ASTC FILES FOR CONSOLE S5
    err = fx_directory_first_entry_find(g_fx_media0_ptr, ex_file );
    while (err == FX_SUCCESS)
    {
        flash_write_add = 0u;
        ex_index = ((uint8_t)(ex_file[EXTRA_FILE_INDEX] - '0') * 100u) + ((uint8_t)(ex_file[EXTRA_FILE_INDEX + 1u] - '0') * 10u) + (uint8_t)(ex_file[EXTRA_FILE_INDEX + 2u] - '0');

        // BMP FILES
        if (!memcmp(CONSOLE_BITMAP, ex_file, strlen(CONSOLE_BITMAP)) &&
            !memcmp(EXTRA_FILE_EXT, &ex_file[strlen(ex_file) - strlen(EXTRA_FILE_EXT)], strlen(EXTRA_FILE_EXT)) &&
            ex_index < CS5_NUM_IMAGES)
        {
            flash_write_add = QSPI_IMGS_ADD + g_bmp_info[ex_index].ram_g_add;
            if (g_bmp_info[ex_index].format == EVE_PALETTED4444 ||
                g_bmp_info[ex_index].format == EVE_PALETTED565 ||
                g_bmp_info[ex_index].format == EVE_PALETTED8)
            {
                flash_write_add += BMP_PAL_SIZE;
            }
        }
        // PALETTE FILES
        else if (!memcmp(CONSOLE_PALETTE, ex_file, strlen(CONSOLE_PALETTE)) &&
                 !memcmp(EXTRA_FILE_EXT, &ex_file[strlen(ex_file) - strlen(EXTRA_FILE_EXT)], strlen(EXTRA_FILE_EXT)) &&
                 ex_index < CS5_NUM_IMAGES)
        {
            flash_write_add = QSPI_IMGS_ADD + g_bmp_info[ex_index].ram_g_add;
        }
        // ASTC FILES - Modified to handle ASTC 4x4, 5x5, 6x6, and 8x8
        else if (!memcmp(CONSOLE_ASTC, ex_file, strlen(CONSOLE_ASTC)) &&
                 !memcmp(EXTRA_FILE_EXT, &ex_file[strlen(ex_file) - strlen(EXTRA_FILE_EXT)], strlen(EXTRA_FILE_EXT)) &&
                 ex_index < CS5_NUM_IMAGES)
        {
            flash_write_add = QSPI_IMGS_ADD + g_bmp_info[ex_index].ram_g_add; // No palette adjustment for ASTC formats
            switch (g_bmp_info[ex_index].format)
            {
                case EVE_ASTC_4x4:
                    flash_write_add += 0; // Add logic specific for ASTC 4x4 if needed
                    break;
                case EVE_ASTC_5x5:
                    flash_write_add += 0; // Add logic specific for ASTC 5x5 if needed
                    break;
                case EVE_ASTC_6x6:
                    flash_write_add += 0; // Add logic specific for ASTC 6x6 if needed
                    break;
                case EVE_ASTC_8x8:  // New case for ASTC 8x8
                    flash_write_add += 0; // Add logic specific for ASTC 8x8 if needed
                    break;
                default:
                    break;
            }
        }
        // LOGO FILES
        else if (!memcmp(LOGO_BITMAP, ex_file, strlen(LOGO_BITMAP)) &&
                 !memcmp(EXTRA_FILE_EXT, &ex_file[strlen(ex_file) - strlen(EXTRA_FILE_EXT)], strlen(EXTRA_FILE_EXT)) &&
                 ex_index < LOGO_IMAGES)
        {
            flash_write_add = QSPI_LOG_IMGS_ADD + (ex_index * QSPI_LOG_IMGS_SIZE) + BMP_PAL_SIZE;
        }
        else if (!memcmp(LOGO_PALETTE, ex_file, strlen(LOGO_PALETTE)) &&
                 !memcmp(EXTRA_FILE_EXT, &ex_file[strlen(ex_file) - strlen(EXTRA_FILE_EXT)], strlen(EXTRA_FILE_EXT)) &&
                 ex_index < LOGO_IMAGES)
        {
            flash_write_add = QSPI_LOG_IMGS_ADD + (ex_index * QSPI_LOG_IMGS_SIZE);
        }

        // PROCESS VALID FILES
        if (flash_write_add > 0u)   // Valid file, write to QSPI at the calculated address
        {
            if (fx_file_open(g_fx_media0_ptr, &g_update_file, ex_file, FX_OPEN_FOR_READ) == FX_SUCCESS)   // Try to open the Image file
            {
                SC_message_screen(CS5_MSG_BMPS_UPDATE, 0u, (int)ex_index);

                // Already open a file, then read the file in blocks of 32KB
                do
                {
                    file_dz = 0;
                    memset(&g_flash_buffer[0], 0, sizeof(g_flash_buffer));
                    err = fx_file_read(&g_update_file, g_flash_buffer, CODEFLASH_BLOCK_SIZE, &actual_length);  // Try to read 32 KB
                    if (actual_length > 0u && (err == FX_SUCCESS || err == FX_END_OF_FILE))
                    {
                        // Write to QSPI in blocks of 4KB (QSPI_ERASE_SIZE)
                        do
                        {
                            init_block_add = QSPI_IMGS_ADD + (QSPI_ERASE_SIZE * ((flash_write_add - QSPI_ADDRESS) / QSPI_ERASE_SIZE)); // Start block address (4KB)
                            offset_add = flash_write_add - init_block_add;
                            block_mem_size = QSPI_ERASE_SIZE - offset_add;
                            if ((file_dz + block_mem_size) > actual_length) block_mem_size = actual_length - file_dz;

                            err = g_qspi_drv.p_api->read(g_qspi_drv.p_ctrl, (uint8_t *)init_block_add, g_buffer_tmp, QSPI_ERASE_SIZE);   // Read block
                            if (SSP_SUCCESS != err) CONSOLE_error_trap( 0, err, "Read Qspi");

                            memcpy(&g_buffer_tmp[offset_add], &g_flash_buffer[file_dz], block_mem_size);    // Copy memory to the correct position

                            err = g_qspi_drv.p_api->erase(g_qspi_drv.p_ctrl, (uint8_t *)init_block_add, QSPI_ERASE_SIZE ); // Erase block
                            if (SSP_SUCCESS != err) CONSOLE_error_trap( 0, err, "Erase Qspi");
                            do { err = g_qspi_drv.p_api->statusGet(g_qspi_drv.p_ctrl, &in_progress); } while (err == SSP_SUCCESS && in_progress);   // Wait for completion

                            // Flash Data to QSPI Flash memory
                            for (dz = 0u; dz < QSPI_ERASE_SIZE; dz += QSPI_WRITE_SIZE)  // Write block in chunks of 256 bytes (QSPI_WRITE_SIZE)
                            {
                                err = g_qspi_drv.p_api->pageProgram(g_qspi_drv.p_ctrl, (uint8_t *)init_block_add, (uint8_t *)&g_buffer_tmp[dz], QSPI_WRITE_SIZE);
                                if (SSP_SUCCESS != err) CONSOLE_error_trap( 0, err, "Write Image");
                                do { err = g_qspi_drv.p_api->statusGet(g_qspi_drv.p_ctrl, &in_progress); } while (err == SSP_SUCCESS && in_progress); // Wait for completion
                                init_block_add += QSPI_WRITE_SIZE;
                            }

                            file_dz += block_mem_size;    // Update memory pointers
                            flash_write_add += block_mem_size;

                        } while (file_dz < actual_length);
                    }
                } while (actual_length > 0);

                fx_file_close(&g_update_file);  // Close opened file
                num_images++;
            }
        }
        err = fx_directory_next_entry_find(g_fx_media0_ptr, ex_file );  // Read the next file
    }

    if (num_images > 0u)
    {
        g_firmware_update = UPDATE_FINISH;
        SC_message_screen(CS5_MSG_BMPS_END, 0u, (int)num_images);
    }
}





static ssp_err_t console_tft_init(void)
{
    uint32_t img_idx, img_tamano, qspi_add, ramg_add;
    uint32_t block_idx = 0u, num_blocks = 1024u, block_size = 1024u;

    SC_message_screen(CS5_MSG_INIT, 0u, 0);

    ramg_add = 0u;

    // Calculamos las posiciones de los Bitmaps en función del tamaño
    for (img_idx = 0; img_idx < CS5_NUM_IMAGES; img_idx++)
    {
        g_bmp_info[img_idx].ram_g_add = ramg_add;

        img_tamano = g_bmp_info[img_idx].width * g_bmp_info[img_idx].height;
        switch (g_bmp_info[img_idx].format)
        {
            case EVE_RGB565:
                img_tamano = img_tamano * 2;  // Cada píxel ocupa 2 bytes
                break;
            case EVE_PALETTED4444:
            case EVE_PALETTED565:
            case EVE_PALETTED8:
                img_tamano = img_tamano + BMP_PAL_SIZE;  // Incluye el tamaño de la paleta
                break;
            case EVE_ASTC_4x4:
                         {
                             uint32_t blocks_x = (g_bmp_info[img_idx].width + 3) / 4;  // Ancho en bloques de 4x4
                             uint32_t blocks_y = (g_bmp_info[img_idx].height + 3) / 4; // Alto en bloques de 4x4
                             img_tamano = blocks_x * blocks_y * 16;  // Tamaño total en bytes (16 bytes por bloque)
                         }
                         break;
                     case EVE_ASTC_5x5:
                         {
                             uint32_t blocks_x = (g_bmp_info[img_idx].width + 4) / 5;  // Ancho en bloques de 5x5
                             uint32_t blocks_y = (g_bmp_info[img_idx].height + 4) / 5; // Alto en bloques de 5x5
                             img_tamano = blocks_x * blocks_y * 16;  // Tamaño total en bytes (16 bytes por bloque)
                         }
                         break;
                     case EVE_ASTC_6x6:
                         {
                             uint32_t blocks_x = (g_bmp_info[img_idx].width + 5) / 6;  // Ancho en bloques de 6x6
                             uint32_t blocks_y = (g_bmp_info[img_idx].height + 5) / 6; // Alto en bloques de 6x6
                             img_tamano = blocks_x * blocks_y * 16;  // Tamaño total en bytes (16 bytes por bloque)
                         }
                         break;
                     case EVE_ASTC_8x8:
                         {
                             uint32_t blocks_x = (g_bmp_info[img_idx].width + 7) / 8;  // Ancho en bloques de 8x8
                             uint32_t blocks_y = (g_bmp_info[img_idx].height + 7) / 8; // Alto en bloques de 8x8
                             img_tamano = blocks_x * blocks_y * 16;  // Tamaño total en bytes (16 bytes por bloque)
                         }
                         break;
            default:
                break;
        }

        ramg_add += img_tamano;

        // Validación: Dirección debe ser par
        if ((ramg_add % 2) > 0) {
            ramg_add++;
        }

        // Validación: No exceder tamaño de RAM_G
        if (ramg_add > EVE_RAM_G_SIZE) {
            return SSP_ERR_OUT_OF_MEMORY;  // Error: Exceso de memoria
        }
    }

    // Transferencia de bloques desde QSPI a RAM_G
    for (block_idx = 0u; block_idx < num_blocks; block_idx++)
    {
        qspi_add = (uint32_t)(QSPI_IMGS_ADD + (block_size * block_idx));
        ramg_add = (uint32_t)(EVE_RAM_G + (block_size * block_idx));

        // Leer datos desde QSPI
        ssp_err_t qspi_status = g_qspi_drv.p_api->read(g_qspi_drv.p_ctrl, (uint8_t *)qspi_add, g_flash_buffer, block_size);
        if (qspi_status != SSP_SUCCESS) {
            return SSP_ERR_READ_FAILED;  // Error al leer desde QSPI
        }

        // Escribir datos en RAM_G
        EVE_mem_write(ramg_add, g_flash_buffer, block_size);
    }

    return SSP_SUCCESS;
}

Logged

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #10 on: January 24, 2025, 01:28:02 PM »

Now I paint the screen and call the function of the EVE_Bitmap



void SC_login_screen(uint8_t tag_val_scr)
{
#ifdef TFT_DEBUG

   //ssp_err_t err, subclk_st;
   //rtc_info_t rtc_info;
#endif

   EVE_dl_begin2(CS5_TFT_FONDO_2, CS5_TFT_FONDO_1);

//   EVE_Bitmap(g_bmp_info[CS5_LOGO_ARGUSA2], 1100u, 40u, 0u);

   EVE_Text(255u, 255u, 255u, (uint8_t*)&"ARGUSA CONTROL DE ACCESOS",                                                                                                0u, 32u, 0u, 210u,  40u); //0, 31, 0, 38, 20
   EVE_Text(255u, 255u, 255u, (uint8_t*)&"INICIO DE SESION",                                                                                                         0u, 30u, 0u, 500u,  120u); //0u, 28u, 0u, 390u,  90u
   EVE_Text(255u, 255u, 255u, (uint8_t*)&"Sistema de Control de Dispositivos de Paso y Control de Aforos",                                                           0u, 23u, 0u, 350u,  190u); //0u, 21u, 0u, 160u, 130u
   EVE_Text(255u, 255u, 255u, (uint8_t*)&"Por motivos de seguridad todas las acciones realizadas por el usuario quedaran registradas para su posible verificacion.", 0u, 23u, 0u, 130u,  230u); //0u, 21u, 0u,  30u, 150u
   EVE_Text(255u, 255u, 255u, (uint8_t*)&"Usuario",     0u, 30u, 0u, 300u, 320u); //0u, 28u, 0u, 100u, 220u
   EVE_Edit (TFT_EDIT_COLOR, TFT_EDIT_FOCUS_COLOR, TFT_EDIT_TEXT_COLOR, (g_focus == EDIT_USER_FOCUS), TAG_EDIT_USER, EDIT_TYPE_CHAR, (uint8_t*)&log_user,     28u, 0u, 570u, 330u, 300u, 22u);
   EVE_Text (255u, 255u, 255u, (uint8_t*)&"Clave de Acceso", 0u, 30u, 0u, 300u, 370u);
   EVE_Edit (TFT_EDIT_COLOR, TFT_EDIT_FOCUS_COLOR, TFT_EDIT_TEXT_COLOR, (g_focus == EDIT_PASS_FOCUS), TAG_EDIT_PASS, EDIT_TYPE_PASS, (uint8_t*)&log_password, 28u, 0u, 570u, 380u, 300u, 22u);

   //EVE_Bitmap(g_bmp_info[CS5_ENT_BTN], 1000u, 340u, TFT_TAG_BT_ACCEPT);
   EVE_Bitmap(g_bmp_info[CS5_ASTC_ENTER], 1000u, 340u, TFT_TAG_BT_ACCEPT);

#ifdef TFT_DEBUG
       debug_dl_offset = EVE_mem_read16(REG_CMD_DL);
       tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "%i", debug_dl_offset);
       EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 20u, 770u);
#endif

   if(g_focus <= EDIT_LAST_FOCUS && tag_val_scr != 255)
       EVE_Keyboard (TFT_BT_R, TFT_BT_G, TFT_BT_B, TFT_BT_REPOSO, TFT_BT_GR, TFT_BT_PULSADO, EDIT_FONT, tag_val_scr, TFT_KEYB_X, TFT_KEYB_Y, TFT_KEYB_W, TFT_KEYB_H, log_edit_type);
   else
   {
       EVE_Text(255u, 255u, 255u, (uint8_t*)&"El usuario acepta las condiciones de uso de la licencia y se responsabiliza de los posibles fallos de funcionamiento", 0u, 23u, 0u, 150u, 460u);
       EVE_Text(255u, 255u, 255u, (uint8_t*)&"de los dispositivos causados por la modificacion de los datos de los mismos.",                                         0u, 23u, 0u, 320u, 510u);
       tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "Version %02i.%02i", CONSOLE_VERSION, CONSOLE_SUB_VERSION);
       EVE_Text (255u, 255u, 255u, (uint8_t*)&tft_buffer, tft_bf_count, 27u, EVE_OPT_CENTERY, 40u, 750u);
      if (g_rtc_init == SSP_SUCCESS)
       {
           tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "%i / %i / %i    %02i : %02i ", g_system_time.tm_mday, (g_system_time.tm_mon + 1), (g_system_time.tm_year + 1900),
                                                                                                        g_system_time.tm_hour, g_system_time.tm_min);  //, g_system_time.tm_sec
           EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 1050u, 750u);
       }
   }

//#else
//    SSP_PARAMETER_NOT_USED(tag_val_scr);

   //err = g_rtc_clock.p_api->infoGet (g_rtc_clock.p_ctrl, &rtc_info);
   //if (err != SSP_SUCCESS) CONSOLE_error_trap( 0, err, "Error RTC Info");
   //subclk_st = g_cgc.p_api->clockCheck(CGC_CLOCK_SUBCLOCK);

   //tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "RTC.- Init: %i calendarTimeGet %i ", g_rtc_init, g_rtc_get_err);
   //EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 10u, 344u);

   //tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "Source: %i  Rtc Status: %i  Subclock Status: %i  SOSTP: %i", rtc_info.clock_source, rtc_info.status, subclk_st, R_SYSTEM->SOSCCR_b.SOSTP);
   //EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 10u, 368u);

   /*rtc_instance_ctrl_t * p_ctrl = (rtc_instance_ctrl_t *) g_rtc_clock.p_ctrl;
   R_RTC_Type * p_rtc_reg = (R_RTC_Type *) p_ctrl->p_reg;
   tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "REG 1:  AIE:%i   CIE:%i   PIE:%i   RTCOS:%i   PES:%i", p_rtc_reg->RCR1_b.AIE, p_rtc_reg->RCR1_b.CIE, p_rtc_reg->RCR1_b.PIE, p_rtc_reg->RCR1_b.RTCOS, p_rtc_reg->RCR1_b.PES);
   EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 10u, 392u);

   tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "REG 2:  START:%i   RESET:%i   ADJ30:%i   RTCOE:%i   AADJE:%i   AADJP:%i   HR24:%i   CNTMD:%i",
                  p_rtc_reg->RCR2_b.START, p_rtc_reg->RCR2_b.RESET, p_rtc_reg->RCR2_b.ADJ30, p_rtc_reg->RCR2_b.RTCOE, p_rtc_reg->RCR2_b.AADJE, p_rtc_reg->RCR2_b.AADJP, p_rtc_reg->RCR2_b.HR24, p_rtc_reg->RCR2_b.CNTMD);
   EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 10u, 416u);

   tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "REG 4:  RCKSEL:%i", p_rtc_reg->RCR4_b.RCKSEL);
   EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 10u, 440u);*/
/**
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 320u, 800u, 320u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 330u, 800u, 330u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 340u, 800u, 340u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 350u, 800u, 350u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 360u, 800u, 360u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 370u, 800u, 370u);
   EVE_Line(EVE_ONLY, 255u, 255u, 255u, 1u, 0, 380u, 800u, 380u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 390u, 800u, 390u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 400u, 800u, 400u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 410u, 800u, 410u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 420u, 800u, 420u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 430u, 800u, 430u);
   EVE_Line(EVE_ONLY, 0u, 0u, 0u, 1u, 0, 440u, 800u, 440u);

   uint8_t r, g, b;
   uint16_t x1, y1, x2, y2;
   uint32_t last = ((rtc_error_dz + 100) > rtc_error_index) ? rtc_error_index : (rtc_error_dz + 100);
   tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "%li", rtc_error_dz);
   EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 42u, 292u);
   EVE_Bitmap( g_bmp_info[CS5_F_IZQUIERDA],  2u, 270u, TAG_IZDA);
   EVE_Bitmap( g_bmp_info[CS5_F_DERECHA],   60u, 270u, TAG_DCHA);
   for (uint32_t i = rtc_error_dz, p = 0; i < last; i++, p++)
   {
       if (rtc_delta_log > 40 || rtc_delta_log < (-40)) { r = 255u; g = 0u; b = 0u; }
       else if (rtc_delta_log > 20 || rtc_delta_log < (-20)) { r = 255u; g = 255u; b = 0u; }
       else { r = 0u; g = 255u; b = 0u; }
       x1 = (uint16_t)(p * 8u);
       x2 = (uint16_t)(x1 + 8u);
       y1 = (i == 0) ? 380 : (uint16_t)((380 - rtc_delta_log[i-1]));
       y2 = (uint16_t)(380 - rtc_delta_log);
       EVE_Line(EVE_ONLY, r, g, b, 1u, x1, y1, x2, y2);
   }
   tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "Tag %i  Fecha: %i / %i / %i  %02i : %02i : %02i ", tag_val_scr,
                                     g_system_time.tm_mday, (g_system_time.tm_mon + 1), (g_system_time.tm_year + 1900),  //  SS Time: %i / %i"
                                     g_system_time.tm_hour, g_system_time.tm_min, g_system_time.tm_sec); //, g_console_config.screensaver_time, g_screensaver_timeout);
   EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 2u, 468u);
   tft_bf_count = (uint16_t)sprintf ((char *)tft_buffer, "RTC.- CNT %li Hz %li Delta %i AdjustVal %i",
                                     tft_rtc_error_correct.rtc_1_sec_via_gpt, (uint32_t)tft_rtc_error_correct.effective_freq, rtc_1_sec_sig_delta, tft_rtc_error_correct.rtc_adjust_value);
   EVE_Text( 255u, 255u, 255u, tft_buffer, tft_bf_count, 27, EVE_OPT_CENTERY, 330u, 468u);
   //if ((++debug_dot %2) == 0u)
   //    EVE_Dot(EVE_ONLY, 240u, 240u, 50u, 7u, 20u, 470u);

***/
//#endif

   EVE_dl_end();
}



function EVE_BITMAP



void EVE_Bitmap(img_info_t bmp, uint16_t x, uint16_t y, uint8_t tag_id)
{
   uint32_t stride;
   uint16_t x_posicion;
   eve_tft_dlOffset = EVE_mem_read16(REG_CMD_DL);  // Verifica el espacio disponible en la memoria DL

   if (bmp.format != EVE_PALETTED8 && (eve_tft_dlOffset + EVE_BMP_SIZE + EVE_TFT_END_SIZE) > EVE_RAM_DL_SIZE) {
       eve_tft_error = SSP_ERR_OUT_OF_MEMORY;
       return;
   } else if (bmp.format == EVE_PALETTED8 && (eve_tft_dlOffset + EVE_BMP_PAL8_SIZE + EVE_TFT_END_SIZE) > EVE_RAM_DL_SIZE) {
       eve_tft_error = SSP_ERR_OUT_OF_MEMORY;
       return;
   }

   if (bmp.format != EVE_PALETTED8)
       Wait4CoProFIFO_FreeSpace(EVE_BMP_SIZE); // Espera suficiente espacio en el FIFO
   else
       Wait4CoProFIFO_FreeSpace(EVE_BMP_PAL8_SIZE);  // Para imágenes con paleta

   _io_set_cs_lo;  // Inicia la transacción SPI

   EVE_address_for_write(EVE_RAM_CMD + eve_tft_cmdOffset);  // Dirección para escribir el primer comando

   eve_tft_txOffset = 0x0000;

   if (eve_tft_r != 255u || eve_tft_g != 255u || eve_tft_b != 255u) {
       EVE_add_cmd(COLOR_RGB(255u, 255u, 255u), 4u);  // Establece el color blanco
       eve_tft_r = 255u;
       eve_tft_g = 255u;
       eve_tft_b = 255u;
   }

   if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
       EVE_add_cmd(CMD_SCREENSAVER, 4u);  // Comando para activar el screensaver

   EVE_add_cmd(BITMAP_HANDLE(BMP_HANDLE), 4u);  // Define el manejador de la imagen

   if (bmp.format == EVE_PALETTED4444 || bmp.format == EVE_PALETTED565 || bmp.format == EVE_PALETTED8) {
       EVE_add_cmd(PALETTE_SOURCE(EVE_RAM_G + bmp.ram_g_add), 4u);  // Dirección de la paleta
       EVE_add_cmd(BITMAP_SOURCE(EVE_RAM_G + bmp.ram_g_add + BMP_PAL_SIZE), 4u);  // Dirección de los datos del bitmap
   } else {
       EVE_add_cmd(BITMAP_SOURCE(EVE_RAM_G + bmp.ram_g_add), 4u);  // Dirección de los datos del bitmap
   }

   if (bmp.format == EVE_RGB565 || bmp.format == EVE_ARGB4 || bmp.format == EVE_ARGB1555) {
       stride = bmp.width * 2u;
   } else if (bmp.format == EVE_L1) {
       stride = bmp.width / 8u;
   } else if (bmp.format == EVE_L2) {
       stride = bmp.width / 4u;
   } else if (bmp.format == EVE_L4) {
       stride = bmp.width / 2u;
   } else if (bmp.format == EVE_ASTC_8x8) {
         stride = (bmp.width + 7) / 8 * 16;  // Ancho en bloques de 8x8 (16 bytes por bloque)
   } else if (bmp.format == EVE_ASTC_4x4) {
         stride = (bmp.width + 3) / 4 * 8;   // Ancho en bloques de 4x4 (8 bytes por bloque)
   } else if (bmp.format == EVE_ASTC_5x5) {
         stride = (bmp.width + 4) / 5 * 8;   // Ancho en bloques de 5x5 (8 bytes por bloque)
   } else if (bmp.format == EVE_ASTC_6x6) {
         stride = (bmp.width + 5) / 6 * 8;   // Ancho en bloques de 6x6 (8 bytes por bloque)
   } else {
         stride = bmp.width;
   }

   if (bmp.format == EVE_ASTC_4x4 || bmp.format == EVE_ASTC_5x5 || bmp.format == EVE_ASTC_6x6 || bmp.format == EVE_ASTC_8x8) {
           EVE_add_cmd(BITMAP_LAYOUT(bmp.format, stride, (bmp.height + 7) /, 4u);
       } else {
           EVE_add_cmd(BITMAP_LAYOUT(bmp.format, stride, bmp.height), 4u);
       }

   EVE_add_cmd(BITMAP_SIZE(EVE_NEAREST, EVE_BORDER, EVE_BORDER, bmp.width, bmp.height), 4u);  // Propiedades de la imagen

   if (tag_id > 0u) {
       EVE_add_cmd(TAG_MASK(1), 4u);  // Habilitar tag
       EVE_add_cmd(TAG(tag_id), 4u);  // ID del tag
   }

   if (x > 1020 && x != BMP_SCRSAVER_XY) {
           x_posicion = (x - 1020) * PIXEL_PRECISION;
           EVE_add_cmd(VERTEX_TRANSLATE_X(x_posicion), 4u);  // Desplazamos la imagen 160 píxeles en X
           x = 1020;
       }


   if (bmp.format != EVE_PALETTED8)
       {
           EVE_add_cmd(BEGIN(EVE_BITMAPS), 4u);                                                                     // Begin drawing bitmaps
           if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
               EVE_add_cmd(MACRO(0), 4u);
           else
               EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
           EVE_add_cmd(END(), 4u);

       }
       else
       {
           EVE_add_cmd(SAVE_CONTEXT(), 4u);
           EVE_add_cmd(BEGIN(EVE_BITMAPS), 4u);                                    // Begin drawing bitmaps
           EVE_add_cmd(BLEND_FUNC(EVE_ONE, EVE_ZERO), 4u);
           //Draw Alpha channel
           EVE_add_cmd(COLOR_MASK(0, 0, 0, 1), 4u);
           EVE_add_cmd(PALETTE_SOURCE((bmp.ram_g_add + 3)), 4u);
           if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
               EVE_add_cmd(MACRO(0), 4u);
           else
               EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
           //Draw Red channel
           EVE_add_cmd(BLEND_FUNC(EVE_DST_ALPHA, EVE_ONE_MINUS_DST_ALPHA), 4u);
           EVE_add_cmd(COLOR_MASK(1, 0, 0, 0), 4u);
           EVE_add_cmd(PALETTE_SOURCE((bmp.ram_g_add + 2)), 4u);
           if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
               EVE_add_cmd(MACRO(0), 4u);
           else
               EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
           //Draw Green channel
           EVE_add_cmd(COLOR_MASK(0, 1, 0, 0), 4u);
           EVE_add_cmd(PALETTE_SOURCE((bmp.ram_g_add + 1)), 4u);
           if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
               EVE_add_cmd(MACRO(0), 4u);
           else
               EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
           //Draw Blue channel
           EVE_add_cmd(COLOR_MASK(0, 0, 1, 0), 4u);
           EVE_add_cmd(PALETTE_SOURCE(bmp.ram_g_add), 4u);
           if (x == BMP_SCRSAVER_XY && y == BMP_SCRSAVER_XY)
               EVE_add_cmd(MACRO(0), 4u);
           else
               EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION) ), 4u);  // Top left point to print
           EVE_add_cmd(END(), 4u);
           EVE_add_cmd(RESTORE_CONTEXT(), 4u);
       }
   /*

   // Desplazar la imagen usando `VERTEX_TRANSLATE_X` para moverla a la posición 1180
   // La coordenada 1180 está fuera del límite de 1020, por lo que aplicamos un desplazamiento de 160 píxeles.
   if (x > 1020) {
       x_posicion = (x - 1020) * PIXEL_PRECISION;
       EVE_add_cmd(VERTEX_TRANSLATE_X(x_posicion), 4u);  // Desplazamos la imagen 160 píxeles en X
       x = 1020;
   }

   // Dibuja la imagen en la nueva posición (1180, y)
   EVE_add_cmd(BEGIN(EVE_BITMAPS), 4u);  // Comienza a dibujar el bitmap
   EVE_add_cmd(VERTEX2F((unsigned long)(x * PIXEL_PRECISION), (unsigned long)(y * PIXEL_PRECISION)), 4u);  // Coordenadas X=1180, Y=desired
   EVE_add_cmd(END(), 4u);  // Finaliza el comando de dibujo
*/
   if (tag_id > 0u) {
       EVE_add_cmd(TAG_MASK(0), 4u);  // Desactiva el tag
   }

   EVE_add_cmd(VERTEX_TRANSLATE_X(0),4u);

   EVE_spi_write(eve_tft_txOffset);  // Envía los comandos

   _io_set_cs_hi;  // Finaliza la transacción SPI

   EVE_mem_write16(REG_CMD_WRITE, eve_tft_cmdOffset);  // Actualiza el puntero de escritura en la memoria DL
}


As I said it doesn't paint the images, I know it's a lot of code but could you tell me if I'm doing something wrong.


Thank you very much.


PS.- the images are ASTC_8x8 and it is a 88x72 image. I pass the .raw file that is generated from the several that it generates.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 440
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #11 on: January 27, 2025, 04:06:56 PM »

I tried, but there is just too much code and this is incomplete.

Please try something much simpler first, not reading from SD(?), writing to QSPI flash(?), reading from there and so on.

Quote
PS.- the images are ASTC_8x8 and it is a 88x72 image. I pass the .raw file that is generated from the several that it generates.

Using the .raw file is correct.
So the files should have 1584 bytes.

Just add the array to the .c file as a first step.

const uint8_t test_icon [1584] =
{
.....
};

Write it to RAM_G in console_tft_init():
EVE_mem_write(ramg_test_icon_address, test_icon, sizeof(test_icon));

Display it:
EVE_add_cmd(COLOR_RGB(255u, 255u, 255u), 4u);
EVE_add_cmd(BEGIN(EVE_BITMAPS), 4u);
EVE_add_cmd(CMD_SETBITMAP(ramg_test_icon_address, EVE_ASTC_8x8, 88u, 72u), 16u);
EVE_add_cmd(VERTEX2F((unsigned long)(100 * 16), (unsigned long)(100 * 16) ), 4u);
EVE_add_cmd(END(), 4u);

Yes, that "EVE_add_cmd(CMD_SETBITMAP(" is a wild guess, I am not familiar with the library you are using.
But it really should include a way to use CMD_SETBITMAP.
Which library is this? The "4u" at the end really looks inconveniant.

Side-Note, does your VERTEX2F really need uint32_t? The coordinates are 15 bit wide and signed.
My lib uses int16_t for VERTEX2F: void EVE_vertex2f(const int16_t xc0, const int16_t yc0);

In my library this would look like this:
EVE_color_rgb(WHITE);
EVE_begin(EVE_BITMAPS);
EVE_cmd_setbitmap(MEM_LOGO, EVE_ASTC_8X8, 88U, 72U);
EVE_vertex2f(100U*16U, 100U*16U);
EVE_end();

CMD_SETBITMAP sets bitmap source, size and layout_h and layout.
The only time you do not want to use it is when you need to not set BITMAP_SIZE filter/wrapx/wrapy to NEAREST/BORDER/BORDER.
But even then you can send a BITMAP_SIZE with the preferred values after CMD_BITMAP, at the cost of 4 bytes extra in the display-list.

At this point I am not sure anymore what "linestride" was, something, something, pixel. :-)
I have not been using BITMAP_LAYOUT for years now as FT81x / BT81x support CMD_SETBITMAP.
Logged

maria@dsg-id.com

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #12 on: January 28, 2025, 01:29:57 PM »

Hello:

I attach an image where you can see that I cannot load the image.
At the bottom of the screen you can see that the image is in position 0 of the ram_g, width: 88, height: 72 and format: 38 which is equivalent to EVE_COMPRESSED_RGBA_ASTC_8x8_KHR

so the image loads fine in ramg and its values ​​are displayed.

can you help me please.
« Last Edit: January 28, 2025, 08:17:10 PM by BRT Community »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 800
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #13 on: January 28, 2025, 03:32:48 PM »

Hi,

Thanks for the image, we'll try it out here too.

It is worth trying Rudolph's advice to use CMD_SETBITMAP -  if you set the size and layout via the individual commands and if the layout and size _H values (which have the upper bits) are left with old values then EVE may be using these incorrect values.

Also, displaying from RAM_G is good to test,

Best Regards, BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 440
    • View Profile
Re: BMP SCREEN 1280X800 BT817Q
« Reply #14 on: January 28, 2025, 06:49:48 PM »

I attach an image where you can see that I cannot load the image.
At the bottom of the screen you can see that the image is in position 0 of the ram_g, width: 88, height: 72 and format: 38 which is equivalent to EVE_COMPRESSED_RGBA_ASTC_8x8_KHR

so the image loads fine in ramg and its values ​​are displayed.

can you help me please.

First of all, please be aware that images carry meta information, including your geo location

I always cut fotos to what I want to show and when I save I have all the checkboxes in IrfanView to keep the meta data ticked off.


Then I just loaded the image into EVE Screen Editor and it works fine, including alpha, so the image is good.

CMD_SETBITMAP(4500, COMPRESSED_RGBA_ASTC_8x8_KHR, 88,72)
BEGIN(BITMAPS)
VERTEX2F(20, 326)
END()

And the inspector shows this in the display-list:
Offset
(decimal)   Raw   Text
447   0x01001194   BITMAP_SOURCE(4500)
448   0x29000000   BITMAP_SIZE_H(0, 0)
449   0x0800b048   BITMAP_SIZE(NEAREST, BORDER, BORDER, 88, 72)
450   0x2e0093b7   BITMAP_EXT_FORMAT(COMPRESSED_RGBA_ASTC_8x8_KHR)
451   0x28000000   BITMAP_LAYOUT_H(0, 0)
452   0x07f96009           BITMAP_LAYOUT(GLFORMAT, 176, 9)
453   0x1f000001           BEGIN(BITMAPS)
454   0x400a0146   VERTEX2F(20, 326)
455   0x21000000   END()

And that should be it, you are not using BITMAP_EXT_FORMAT, only BITMAP_LAYOUT.
GLFORMAT should be 31.
And COMPRESSED_RGBA_ASTC_8x8_KHR should be 37815.

0x07f96009 - 0x07 / bit 19 to 23 = format -> 11111 = 31 / bits 9 to 18 = linestride -> 00 1011 0000 = 176 (88*2) / bits 0 to 8 = height -> 9 (72 / 8)
0x2e0093b7 - 0x2e ... reserved .. 16 bits format - yes, 0x93b7 = 37815


Oh yes, I almost overlooked this, the VERTEX2F coordinates are only so low because I am also using VERTEX_FORMAT(0) in this ESE test-project
« Last Edit: January 28, 2025, 09:24:28 PM by Rudolph »
Logged
Pages: [1] 2