Skip to content

Commit 59b6497

Browse files
committed
Add constants for ST7789 rotations
1 parent 12bf2b9 commit 59b6497

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

red_vision/displays/st7789.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ class ST7789(VideoDisplayDriver):
5454

5555
_ENCODE_POS = ">HH"
5656

57+
# Rotation indices
58+
ROTATION_PORTRAIT = 0
59+
ROTATION_LANDSCAPE = 1
60+
ROTATION_PORTRAIT_INVERTED = 2
61+
ROTATION_LANDSCAPE_INVERTED = 3
62+
5763
# Rotation tables
5864
# (madctl, width, height, xstart, ystart)[rotation % 4]
5965

@@ -125,7 +131,7 @@ def __init__(
125131
width = None,
126132
color_mode = None,
127133
buffer = None,
128-
rotation = 1,
134+
rotation = ROTATION_LANDSCAPE,
129135
):
130136
"""
131137
Initializes the ST7789 display driver.

red_vision_examples/rv_init/display.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
interface = interface,
5454

5555
# Optionally specify the rotation of the display.
56-
# rotation = 1,
56+
# rotation = rv.displays.ST7789.ROTATION_LANDSCAPE,
5757

5858
# Optionally specify the image resolution.
5959
# height = 240,

0 commit comments

Comments
 (0)