Hi. If someone tries to draw filled rectangle with coordinates starting with 0,0 (ex. FillRectangle(0,0,10,10,Black), he or she will be surprised. Program gets in an endless cycle.
for (uint8_t y = y2; y >= y1; y--) {
for (uint8_t x = x2; x >= x1; x--) {
ssd1306_DrawPixel(x, y, color);
}
}
Imagine x1=0 and x is constantly decreasing after each cycle.
x=1, 1>=0 - true
x=0, 0>=0 - true
x=255, 255>=0 -true. "x" is an unsigned var.
And so on.
By the way, I didn't search for problems in other similar functions. Maybe they should be reconsidered.
https://github.com/afiskon/stm32-ssd1306/blob/11c023452e2a9baa69069810fc11f32912daa3d5/ssd1306/ssd1306.c#L541
Hi. If someone tries to draw filled rectangle with coordinates starting with 0,0 (ex. FillRectangle(0,0,10,10,Black), he or she will be surprised. Program gets in an endless cycle.
Imagine x1=0 and x is constantly decreasing after each cycle.
And so on.
By the way, I didn't search for problems in other similar functions. Maybe they should be reconsidered.