Add knobs for SSD1322 and two displayio fixes. - #2011
Conversation
* Fix terminal clear after first successful code.py run. * Fix transmitting too many bytes for column constraint with single byte bounds.
dhalbert
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
pixels_per_byte * self->colorspace.bytes_per_cell could be computed just once. We'd hope the compiler would take care of this.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
So this makes a negative shift, I think? A comment or example would help the reader.
There was a problem hiding this comment.
Will add in my follow up epaper PR. Going to merge this now so I can base the epaper work on it.
byte bounds.