Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding scroll functionality for ili9341 #121

Merged
merged 3 commits into from
Feb 8, 2020

Conversation

bgould
Copy link
Member

@bgould bgould commented Jan 30, 2020

This PR adds a method for setting the vertical scroll address in the ILI9341 driver.

@conejoninja
Copy link
Member

I would also add SetScrollArea and StopScroll

I found that ST7735 do also have scroll functionality (and probably ST7789 too). I used the same register name and functions and added 2 more to specify which area to scroll and to return to normal, althought SetScroll(0) works too

// SetScrollWindow sets an area to scroll with fixed top and bottom parts of the display
func (d *Device) SetScrollArea(topFixedArea, bottomFixedArea int16) {
	d.Command(VSCRDEF)
	d.Tx([]uint8{
		uint8(topFixedArea >> 8), uint8(topFixedArea),
		uint8(d.height - topFixedArea - bottomFixedArea>>8), uint8(d.height - topFixedArea - bottomFixedArea),
		uint8(bottomFixedArea >> 8), uint8(bottomFixedArea)},
		false)
}

// SetScroll sets the vertical scroll address of the display.
func (d *Device) SetScroll(line int16) {
	d.Command(VSCRSADD)
	d.Tx([]uint8{uint8(line >> 8), uint8(line)}, false)
}

// SpotScroll returns the display to its normal state
func (d *Device) StopScroll() {
	d.Command(NORON)
}

@deadprogram
Copy link
Member

@bgould not sure if you saw the comment from @conejoninja above?

@bgould
Copy link
Member Author

bgould commented Jan 31, 2020

I would also add SetScrollArea and StopScroll

@conejoninja Thanks, that is a great idea, I will get these added.

@deadprogram deadprogram merged commit fbe36b6 into tinygo-org:dev Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants