Adding scroll functionality for ili9341 (#121)

* ili9341: Adding scroll functionality
This commit is contained in:
BCG
2020-02-08 15:12:20 -05:00
committed by GitHub
parent 0519540d0c
commit fbe36b62fd
3 changed files with 71 additions and 2 deletions
+20 -2
View File
@@ -7,8 +7,6 @@ import (
"time"
)
const _debug = false
type Config struct {
Width int16
Height int16
@@ -229,6 +227,26 @@ func (d *Device) SetRotation(rotation Rotation) {
d.rotation = rotation
}
// SetScrollWindow sets an area to scroll with fixed top and bottom parts of the display
func (d *Device) SetScrollArea(topFixedArea, bottomFixedArea int16) {
d.sendCommand(VSCRDEF, []uint8{
uint8(topFixedArea >> 8), uint8(topFixedArea),
uint8(d.height - topFixedArea - bottomFixedArea>>8),
uint8(d.height - topFixedArea - bottomFixedArea),
uint8(bottomFixedArea >> 8), uint8(bottomFixedArea),
})
}
// SetScroll sets the vertical scroll address of the display.
func (d *Device) SetScroll(line int16) {
d.sendCommand(VSCRSADD, []uint8{uint8(line >> 8), uint8(line)})
}
// SpotScroll returns the display to its normal state
func (d *Device) StopScroll() {
d.sendCommand(NORON, nil)
}
// setWindow prepares the screen to be modified at a given rectangle
func (d *Device) setWindow(x, y, w, h int16) {
//x += d.columnOffset