kengineer Posted July 1, 2016 Report Share Posted July 1, 2016 (edited) With a project I'm working on with uGFX, I'm able to successfully read BMP files off a files system and then draw them to the screen (SPI using ILI9341). I'm trying to modify the driver to get DMA support for Blitting images however I've run into an issue. Because of the way 16 bit ints are stored (like color_t), this ends up flipping the high and low bytes and therefore the colors are messed up on images. Is there a built in option in uGFX to handle this kind of thing or is this going to require me to modify the image decoder? This doesn't happen with the non dma writes because each pixel is broken up as separate bytes with the following macro rather than just reading straight through memory: #define write_data16(g, data) { write_data(g, data >> 8); write_data(g, (uint8_t)data); } I know I could also read the buffer into another buffer and reverse the bytes and then DMA that but I want to see if there is a better solution. Edited July 1, 2016 by kengineer Link to comment Share on other sites More sharing options...
inmarket Posted July 2, 2016 Report Share Posted July 2, 2016 The image decoder converts the image colour into the GDISP_PIXEL_FORMAT. By default that pixel format is the same format as the drivers native format. It doesn't have to be however. If a different value is specified in gfxconf.h then that format will be translated by the driver to the display native format. You could then set that pixel format so it is suitable for dma, or set it to rgb888 and translate on the fly (if your dma supports it). The difficulty will be if your color format for dma ends up splitting one of the colors on the byte boundary. In that case you would have to write a full set of custom color macros to support the byte swapped color format. This would not be a simple undertaking. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now