Using RGB444 instead of RGB565 can speed up graphics operations by up to
25%, especially on slow screens. But for full support, all parts of the
driver need to be aware of the color format.
It's possible to do this using a regular configuration variable, but
it's unlikely to be very efficient. Hence the usage of generics.
The existing code was broken in a few ways:
- It didn't use the correct operator precedence for the VSCRDEF VSA
variable: it needed some extra parentheses to be correct.
- It used the configured height instead of the actual display height
for calculating VSA, which is incorrect. TFA+VSA+BFA must always be
exactly 320, even if a lower value is configured.
- If a lower than 320 pixel height is configured, the bottomFixedArea
parameter applied to the whole 320 pixel screen height. Because this
seems counter intuitive (and relies on properties of any given
screen), I've changed it to work from the actual visible bottom of
the screen (which may be smaller than 320 pixels).
TODO: this doesn't take RowOffset into account, while it probably
should.
I haven't fixed the st7735 implementation, because I didn't have example
code on hand that would easily work on a st7735 screen. This is left as
a TODO for the future.
* Unify the Rotation type, so that SetRotation can be used in
interfaces.
* Add Rotation() method to these displays, so that the current
rotation can be read.
* Change SetRotation() so that it can return an error (if the given
rotation isn't supported).
The API looks like this and is based on the PCA9685 PWM chip:
Sleep(sleepEnabled bool) error
It will set the LCD panel to a low power state (not displaying any
image) but memory contents will be preserved.
This is needed for high performance graphics.
Using this API, and using partial updates to the screen (no full screen
refreshes), I've been able to get well over 60fps of updates.
Most of the ceremony around pin toggling was in fact unnecessary. This
improves performance measurably (rougly 6% in one measurement) and cuts
down on binary size by 80 bytes.