Skip to content

Add knobs for SSD1322 and two displayio fixes. - #2011

Merged
tannewt merged 3 commits into
adafruit:masterfrom
tannewt:ssd1322
Jul 30, 2019
Merged

Add knobs for SSD1322 and two displayio fixes.#2011
tannewt merged 3 commits into
adafruit:masterfrom
tannewt:ssd1322

Conversation

@tannewt

@tannewt tannewt commented Jul 25, 2019

Copy link
Copy Markdown
Member
  • Fix terminal clear after first successful code.py run.
  • Fix transmitting too many bytes for column constraint with single
    byte bounds.

* Fix terminal clear after first successful code.py run.
* Fix transmitting too many bytes for column constraint with single
  byte bounds.
@tannewt tannewt added this to the 5.x milestone Jul 25, 2019
@tannewt
tannewt requested a review from dhalbert July 26, 2019 06:18

@dhalbert dhalbert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good! Just cosmetic comments, which don't need to be fixed now. I'll let you merge.

16, // Color depth
false, // Grayscale
false, // Pixels in a byte share a row. Only used for depth < 8
1, // bytes per cell. Only valid for depths < 8

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

At some point maybe this should turn into a struct, which you could initialize with slot names, and then pass a pointer to the struct, to save passing so many positional arguments. Maybe it could be static. Doesn't have to be now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ya, wish C had kwargs. Does using a struct prevent the compiler from optimizing things?

if (self->colorspace.pixels_in_byte_share_row) {
x1 /= pixels_per_byte;
x2 /= pixels_per_byte;
x1 /= pixels_per_byte * self->colorspace.bytes_per_cell;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pixels_per_byte * self->colorspace.bytes_per_cell could be computed just once. We'd hope the compiler would take care of this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ya, I hope it would too.

((uint8_t*)buffer)[offset / pixels_per_byte] |= pixel << ((offset % pixels_per_byte) * colorspace->depth);
uint8_t shift = (offset % pixels_per_byte) * colorspace->depth;
if (colorspace->reverse_pixels_in_byte) {
shift = (pixels_per_byte - 1) * colorspace->depth - shift;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So this makes a negative shift, I think? A comment or example would help the reader.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will add in my follow up epaper PR. Going to merge this now so I can base the epaper work on it.

@tannewt
tannewt merged commit 366fdcc into adafruit:master Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants