The goal
The commands.
The result.
This is the 16 bit 565 bitmap. The color seems to be off, but the pixels are in the right place.
//TODO:pre-adjust the images so we can just DMA it.
for(uint32_t b=offset; b<(320*240*2+offset); b+=2){
pixel[0]=image[b+1];
pixel[1]=image[b];
spi_write_blocking(BP_SPI_PORT, pixel, 2);
}
I believe each byte pair has to be swapped in order, at least that is what is happening in the firmware elsewhere, that seems annoying… Is there any way around this?
//sort image data
for (int i = 0; i < 256; i += 2) {
image_data_sorted[i] = image_data[i + 1];
image_data_sorted[i + 1] = image_data[i];
}
Swap byte order in pixels…
Yeah! That did it. Let’s try to turn 24 bit into 565 format.