<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Show BMP image on display</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73983/show-bmp-image-on-display</link><description>Hi there! 
 I have an SD card reader and ST7735 connected to an nRF52850 DK, both working fine. Furthermore, I &amp;#39;m using ARMGCC in combination with Make, nRF5 SDK, nRF SDK for Mesh, FreeRTOS and C++. Now I&amp;#39;ve got the following question; how do I show bitmaps</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 May 2021 08:24:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73983/show-bmp-image-on-display" /><item><title>RE: Show BMP image on display</title><link>https://devzone.nordicsemi.com/thread/309401?ContentTypeID=1</link><pubDate>Wed, 12 May 2021 08:24:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a4ef460-c8c2-4834-9786-750c0bfb5812</guid><dc:creator>JVKran</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thanks for pointing that out! Got that working almost instantly. That topic, however, doesn&amp;#39;t really provide any information with regards to writing an image from the SD card to a display. Since I couldn&amp;#39;t get the function form the GFX library working, I decided to write my own that takes the filename and rectangle as input.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t display_c::show_image(nrf_gfx_rect_t const * p_rect, const char* file_name){
    UINT bytes_read;
    FIL f;
    if(f_open(&amp;amp;f, file_name, FA_READ) != FR_OK){
        NRF_LOG_WARNING(&amp;quot;Opening \&amp;quot;%s\&amp;quot; failed.&amp;quot;, file_name);
        return NRF_ERROR_NOT_FOUND;
    }

    if ((p_rect-&amp;gt;x &amp;gt; nrf_gfx_width_get(&amp;amp;lcd)) || (p_rect-&amp;gt;y &amp;gt; nrf_gfx_height_get(&amp;amp;lcd))){
        return NRF_ERROR_INVALID_PARAM;
    }

    uint16_t signature;
    f_read(&amp;amp;f, &amp;amp;signature, 2, &amp;amp;bytes_read);

    uint32_t size, creator_bytes, image_offset;
    f_read(&amp;amp;f, &amp;amp;size, 4, &amp;amp;bytes_read);
    f_read(&amp;amp;f, &amp;amp;creator_bytes, 4, &amp;amp;bytes_read);
    f_read(&amp;amp;f, &amp;amp;image_offset, 4, &amp;amp;bytes_read);

    f_lseek(&amp;amp;f, image_offset);

    uint16_t pixel;
    for (int32_t i = 0; i &amp;lt; p_rect-&amp;gt;height; i++){
        for (uint32_t j = 0; j &amp;lt; p_rect-&amp;gt;width; j++){
            f_read(&amp;amp;f, &amp;amp;pixel, 2, &amp;amp;bytes_read);
            lcd.lcd_pixel_draw(p_rect-&amp;gt;x + j, p_rect-&amp;gt;y + i, pixel);
        }
    }

    f_close(&amp;amp;f);
    NRF_LOG_WARNING(&amp;quot;Image \&amp;quot;%s\&amp;quot; drawn.&amp;quot;, file_name);
    return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For anyone facing the same challenge; feel free to use it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Jochem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Show BMP image on display</title><link>https://devzone.nordicsemi.com/thread/304956?ContentTypeID=1</link><pubDate>Thu, 15 Apr 2021 05:58:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f41ae65e-b243-44d4-88d2-84d0b9f8b1de</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I&amp;#39;m afraid what documentation we got regarding LCD control is limited to the&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_gfx.html"&gt; GFX library&lt;/a&gt; and the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/gfx_example.html"&gt;GFX example project&lt;/a&gt; in our nRF5 SDK, so we don&amp;#39;t have any examples for displaying data stored on an SD card I&amp;#39;m afraid. We do however have &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38711/controlling-st7789-lcd-with-nrf52-dk/"&gt;this thread on DevZone where control of an ST7789 LCD with an nRF52DK is the theme&lt;/a&gt;. This should be a similar screen to the one you&amp;#39;re using, and has quite a bit of information on bitmaps with the ST-series LCDs, so I would suggest giving it a read to see if that helps with your understanding.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>