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

Add support for restricting display area #4

Merged
merged 2 commits into from
Mar 20, 2016

Conversation

mmabey
Copy link
Contributor

@mmabey mmabey commented Mar 7, 2016

Sometimes it can be really useful to change the areas of the screen that the buffer is written to, so I added these functions. Calling them without parameters will reset to the default of the whole screen.

raise ValueError('Start column must be between 0 and %d.' % (self.columns - 1,))
if end_col < 0 or end_col > self.columns -1:
raise ValueError('End column must be between 0 and %d.' % (self.columns - 1,))

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add another check to make sure that start_col is smaller than end_col, or is this something that is possible? If that would be the case, what's the behavior?

The same for start_page and end_page below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The start/end location for pages and columns is an inclusive range. For example, if you call set_start_end_cols(0, 0) you'll write to only column zero. How this actually writes to the screen depends on the addressing mode (see pgs. 35-36 of the datasheet), but the bottom line is that it doesn't have to be a strict inequality.

But you're definitely right, and I appreciate you pointing that out. I'll add another check to make sure that end_page isn't less than start_page and same for the columns.

@mmabey
Copy link
Contributor Author

mmabey commented Mar 18, 2016

@khenderick do you see any other issues with PR #4?

@khenderick
Copy link
Owner

I'm so sorry, seems I missed that last commit. Seems fine to me.

khenderick added a commit that referenced this pull request Mar 20, 2016
Add support for restricting display area
@khenderick khenderick merged commit ee5e742 into khenderick:master Mar 20, 2016
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.

2 participants