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
+10 -8
View File
@@ -1,5 +1,7 @@
package ili9341
import "tinygo.org/x/drivers"
type Rotation uint8
const (
@@ -77,13 +79,13 @@ const (
)
const (
Rotation0 Rotation = 0
Rotation90 Rotation = 1 // 90 degrees clock-wise rotation
Rotation180 Rotation = 2
Rotation270 Rotation = 3
Rotation0 = drivers.Rotation0
Rotation90 = drivers.Rotation90 // 90 degrees clock-wise rotation
Rotation180 = drivers.Rotation180
Rotation270 = drivers.Rotation270
Rotation0Mirror Rotation = 4
Rotation90Mirror Rotation = 5
Rotation180Mirror Rotation = 6
Rotation270Mirror Rotation = 7
Rotation0Mirror = drivers.Rotation0Mirror
Rotation90Mirror = drivers.Rotation90Mirror
Rotation180Mirror = drivers.Rotation180Mirror
Rotation270Mirror = drivers.Rotation270Mirror
)