ili9341: st7735: st7789: unify rotation support

* Unify the Rotation type, so that SetRotation can be used in
    interfaces.
  * Add Rotation() method to these displays, so that the current
    rotation can be read.
  * Change SetRotation() so that it can return an error (if the given
    rotation isn't supported).
This commit is contained in:
Ayke van Laethem
2023-04-18 00:59:03 +02:00
committed by Ron Evans
parent 59d66d1e73
commit c689c11838
7 changed files with 96 additions and 53 deletions
+6 -4
View File
@@ -1,5 +1,7 @@
package st7789
import "tinygo.org/x/drivers"
// Registers
const (
NOP = 0x00
@@ -53,10 +55,10 @@ const (
VSCRDEF = 0x33
VSCRSADD = 0x37
NO_ROTATION Rotation = 0
ROTATION_90 Rotation = 1 // 90 degrees clock-wise rotation
ROTATION_180 Rotation = 2
ROTATION_270 Rotation = 3
NO_ROTATION = drivers.Rotation0
ROTATION_90 = drivers.Rotation90 // 90 degrees clock-wise rotation
ROTATION_180 = drivers.Rotation180
ROTATION_270 = drivers.Rotation270
// Allowable frame rate codes for FRCTRL2 (Identifier is in Hz)
FRAMERATE_111 FrameRate = 0x01