+ // Allows for slightly better performance than setting individual pixels
+ uint16_t x, pixels;
+
+ if (x1 < x0)
+ {
+ // Switch x1 and x0
+ x = x1;
+ x1 = x0;
+ x0 = x;
+ }
+
+ // Check limits
+ if (x1 >= ssd1351Properties.width)
+ {
+ x1 = ssd1351Properties.width - 1;
+ }
+ if (x0 >= ssd1351Properties.width)
+ {
+ x0 = ssd1351Properties.width - 1;
+ }
+
+ ssd1351SetCursor(x0, y);
+ CMD(SSD1351_CMD_WRITERAM);
+ for (pixels = 0; pixels < x1 - x0 + 1; pixels++)
+ {
+ DATA(color >> 8);
+ DATA(color);
+ }
+ ssd1351GoHome();