ST7789: 240x240 Handle unsupported rotations gracefully.
This commit is contained in:
parent
8efe23fb5b
commit
3d489a9383
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue