Hi,
I want to display an image sent over Bluetooth on my screen which uses the driver st7735. So I have an application which can send images, and I receive data in the function nus_data_handler. With this application, I send array of 20 data (two first and last data are control data to know that an image is sent). The data sent are 4bytes for 1 pixel so RGBα, and 8 bites for red, 8 for green, 8 for blue and 8 for alpha. I display an image with the function nrf_gfx_bmp565_draw, so pixel format is RGB565. When I received data (R, G, and B), I convert these 3 data to one and transform them to RGB565 with this:
RGB16(red, green, blue) (((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3))
I don't care about α for the conversion. After, I have the value of one pixel. I need to save this pixel value, so I created an array image_received of the image size (80x160 = 12800) with all element are 0xFFFF (white) in another file include in main.c. When I have the value of one pixel, I replace the element of image_received by this value. So at the end, I should have in image_received the image received by Bluetooth. When I try to display image_received, it doesn't work: it is the image of the beginning which is displayed, image_received is not updated. Here is my code who receive and display data.
So I don't know how can I display an image sent over Bluetooth. On the internet, I only find answers to display an image on the application sent by nrf52; but my issue is the other way around. I think it's better to send data received in flash memory, so I can send an array with sd_flash_write, but I still have to stock data in image_received and after reading into the flash and display, but I don't know how to do it.
I use nrf 52832, with PCA10040, s 132, sdk15.3 and Segger embedded.