The CPU writes in little. The RAM does not care. DMA needs to be told to read in little. 8-bit reads are neither little or big. 16-bit writes are little.
This comes with a performance consequence and possibly a memory cost.
First option: (C++ allows hiding the endian. (C type system sucks.) Saves memory but not time.)Second option: (Expensive in time and memory)
Multibuffering with ntohs applied after drawing. Complete redrawing required.
Third option: (Expensive in time and memory)
Multibuffering with memcpy and ntohs applied after drawing. Does not require redrawing.
This comes with a performance consequence and possibly a memory cost.
First option: (C++ allows hiding the endian. (C type system sucks.) Saves memory but not time.)
Code:
struct RGB565 {public:void write_red(uint8_t val);void write_green(uint8_t val);void write_blue(uint8_t val);uint8_t get_red();uint8_t get_green();uint8_t get_blue();private:uint16_t data;}
Multibuffering with ntohs applied after drawing. Complete redrawing required.
Third option: (Expensive in time and memory)
Multibuffering with memcpy and ntohs applied after drawing. Does not require redrawing.
Statistics: Posted by dthacher — Sun Nov 17, 2024 12:18 pm