Add support for setting framerate, vsync pause, and reading scanline data.

- FrameRate option sets device framerates from 39-111Hz
- VSyncLines option adjusts device vsync pause using st7789 "porch control" feature
- Added Rx(cmd, bytes[]) to support retrieving scanline timing data over SPI
- Added Sync functions to support syncronization of animation to vertical scanline timing
- Minor adjustments to Configure to clear screen memory before display is visible
This commit is contained in:
Jason Striegel
2020-08-13 00:48:27 -04:00
committed by Ron Evans
parent db02cbb8a4
commit ce9c93f228
3 changed files with 204 additions and 38 deletions
+28 -3
View File
@@ -9,12 +9,37 @@ import (
)
func main() {
// Example configuration for Adafruit Clue
// machine.SPI1.Configure(machine.SPIConfig{
// Frequency: 8000000,
// SCK: machine.TFT_SCK,
// SDO: machine.TFT_SDO,
// SDI: machine.TFT_SDO,
// Mode: 0,
// })
// display := st7789.New(machine.SPI1,
// machine.TFT_RESET,
// machine.TFT_DC,
// machine.TFT_CS,
// machine.TFT_LITE)
machine.SPI0.Configure(machine.SPIConfig{
Frequency: 8000000,
Mode: 3,
Mode: 0,
})
display := st7789.New(machine.SPI0,
machine.P6, // TFT_RESET
machine.P7, // TFT_DC
machine.P8, // TFT_CS
machine.P9) // TFT_LITE
display.Configure(st7789.Config{
Rotation: st7789.NO_ROTATION,
RowOffset: 80,
FrameRate: st7789.FRAMERATE_111,
VSyncLines: st7789.MAX_VSYNC_SCANLINES,
})
display := st7789.New(machine.SPI0, machine.P6, machine.P7, machine.P8, machine.P9)
display.Configure(st7789.Config{Rotation: st7789.NO_ROTATION})
width, height := display.Size()