I would display a picture on my lcd screen. I use the driver st7735, with PCA10040 and my IDE is segger embedded. I find the documentation of nrf_gfx_bmp565_draw:
I don't find example with it.
I don't understand the last parameter: [in]img_buf Pointer to data from the .bmp file, because I don't know how can I have a pointer to data.
In my code, I opened a picture with fopen, and I read this file with fread. I thought img_buf was the result of fread, but no, it doesn't work or it displays anything. Here is my code
char * img_file ="../../../../../../couleurs.bmp"; char buff_img; uint16_t img_size; FILE * img = fopen(img_file, "r"); img_size = fread(buff_img, sizeof(buff_img), 1, img); APP_ERROR_CHECK(nrf_gfx_bmp565_draw(p_lcd, &rect_img, img_size));
So i would like to have more information about nrf_gfx_bmp565_draw to understand how to use it.
Do you mean you don't know how pointers work on a conceptual level, or that you don't know how to transfer the image data into a buffer?
You mean buff_img and not img_buf I assume?
What I don't understand is where you have stored the couleurs.bmp file?
In order to access a file directly from your code you have to embed the file into the code flash, unless you have some external memory device connected to the nRF52 that you can use for file storage.
The easiest way to store an image in the internal flash is to find some tool to convert the bmp file into a const C array, that you can then declare in your code to store the image. Then you simply refer to this array whenever you want to display the image.
There are various tools available online to convert a bmp file into a C array, but not all of them support the 16-bit 565 format. You could give this one a try: https://www.displaymodule.com/pages/copy-of-displaymodules-image-converter-free-download
Please be aware that you might have to do some small changes to the generated file to integrate it into your code, in case the array uses a type not supported by the Segger compiler etc.
I didn't know how to transfer the image data into a buffer. I try DisplayModule but I can't use it because it converts image into two hexadecimal number. When I try to convert an image which is green, it converts 0x07E0 into 0x7, 0xE0 so the display is wrong because the third parameter is expected to be stored in 2-byte samples. I can't find a converter that works.
Thanks for your answer.