From 3d489a93834b5c9354f7172a62305cdd810cdd76 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 8 Jun 2022 13:11:37 +0100 Subject: [PATCH] ST7789: 240x240 Handle unsupported rotations gracefully. --- drivers/st7789/st7789.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/st7789/st7789.cpp b/drivers/st7789/st7789.cpp index 99361f1f..4a9d2430 100644 --- a/drivers/st7789/st7789.cpp +++ b/drivers/st7789/st7789.cpp @@ -123,15 +123,6 @@ namespace pimoroni { int col_offset = 0; 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: if (!round) row_offset = 0; caset[0] = row_offset; @@ -157,6 +148,15 @@ namespace pimoroni { madctl = MADCTL::ROW_ORDER | MADCTL::SWAP_XY; 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; } }