File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ const (
5050 GMCTRP1 = 0xE0
5151 GMCTRN1 = 0xE1
5252 GSCAN = 0x45
53+ VSCRDEF = 0x33
54+ VSCRSADD = 0x37
5355
5456 NO_ROTATION Rotation = 0
5557 ROTATION_90 Rotation = 1 // 90 degrees clock-wise rotation
Original file line number Diff line number Diff line change @@ -435,6 +435,27 @@ func (d *Device) IsBGR(bgr bool) {
435435 d .isBGR = bgr
436436}
437437
438+ // SetScrollWindow sets an area to scroll with fixed top and bottom parts of the display
439+ func (d * Device ) SetScrollArea (topFixedArea , bottomFixedArea int16 ) {
440+ d .Command (VSCRDEF )
441+ d .Tx ([]uint8 {
442+ uint8 (topFixedArea >> 8 ), uint8 (topFixedArea ),
443+ uint8 (d .height - topFixedArea - bottomFixedArea >> 8 ), uint8 (d .height - topFixedArea - bottomFixedArea ),
444+ uint8 (bottomFixedArea >> 8 ), uint8 (bottomFixedArea )},
445+ false )
446+ }
447+
448+ // SetScroll sets the vertical scroll address of the display.
449+ func (d * Device ) SetScroll (line int16 ) {
450+ d .Command (VSCRSADD )
451+ d .Tx ([]uint8 {uint8 (line >> 8 ), uint8 (line )}, false )
452+ }
453+
454+ // SpotScroll returns the display to its normal state
455+ func (d * Device ) StopScroll () {
456+ d .Command (NORON )
457+ }
458+
438459// RGBATo565 converts a color.RGBA to uint16 used in the display
439460func RGBATo565 (c color.RGBA ) uint16 {
440461 r , g , b , _ := c .RGBA ()
You can’t perform that action at this time.
0 commit comments