Floyd-Fish / ST7789-STM32

using STM32's Hardware SPI to drive a ST7789 based IPS displayer
GNU General Public License v3.0
276 stars 55 forks source link

FILL colour function #23

Open MrVlads opened 1 year ago

MrVlads commented 1 year ago

Hello, In the fill colour function you are using memset to set the colour but memset will set the memory to only the first byte, if for example you try green, in 565 it's 0x07E0, it will set each memory element in the array with E0, use this instead:

static void memset_pattern2(void b, const void pattern2, size_t len) { char start = (char )b; char p = (char )b; while ((start + len) - p >= 2) { memmove(p, pattern2, 2); p += 2; } if ((start + len) - p != 0) { memmove(p, pattern2, (start + len) - p); } }

and in the fill colour function : memset_pattern2(disp_buf, &color, sizeof(disp_buf));

kind regards Vlad