ST7789: 240x240 Handle unsupported rotations gracefully.

This commit is contained in:
Phil Howard 2022-06-08 13:11:37 +01:00
parent 8efe23fb5b
commit 3d489a9383
1 changed files with 9 additions and 9 deletions

View File

@ -123,15 +123,6 @@ namespace pimoroni {
int col_offset = 0; int col_offset = 0;
switch(rotate) { switch(rotate) {
case ROTATE_0:
if (!round) row_offset = 0;
caset[0] = col_offset;
caset[1] = width + col_offset - 1;
raset[0] = row_offset;
raset[1] = width + row_offset - 1;
madctl = MADCTL::HORIZ_ORDER;
break;
case ROTATE_90: case ROTATE_90:
if (!round) row_offset = 0; if (!round) row_offset = 0;
caset[0] = row_offset; caset[0] = row_offset;
@ -157,6 +148,15 @@ namespace pimoroni {
madctl = MADCTL::ROW_ORDER | MADCTL::SWAP_XY; madctl = MADCTL::ROW_ORDER | MADCTL::SWAP_XY;
break; break;
default: // ROTATE_0 (and for any smart-alec who tries to rotate 45 degrees or something...)
if (!round) row_offset = 0;
caset[0] = col_offset;
caset[1] = width + col_offset - 1;
raset[0] = row_offset;
raset[1] = width + row_offset - 1;
madctl = MADCTL::HORIZ_ORDER;
break;
} }
} }