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

Blit #21

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Blit #21

wants to merge 17 commits into from

Conversation

Phylex
Copy link

@Phylex Phylex commented Jun 30, 2024

This is a quite large Code restructure, as well as adding a simple text widget.

The code assumes that the 'blit' function is the core function of the display code, this splits the responsibility of rendering to the display into the preparation of the sprite and the placement of the sprite into the display buffer (the blitting). Widgets are the things that prepare the sprites, which are to be placed into the display buffer. This code is a mild refactor of the original code, where most of the text functions are moved into a set of widget functions that operate on a sprite, before having the sprite copied into the display buffer.

The build system has also been reworked so as to place the library files into the src directory, the fonts into their own directory (as they are in a sense "data" and not code). and also added an example showing how to use the text widget together with raw (avoiding pico stdio) usb-serial that allows to display text typed on the keyboard on the ssd1306.

Besides this there are some small tweaks in the display struct creation macro.

Phylex and others added 17 commits March 10, 2024 20:20
Instead of encoding font properties in the bitmap buffer,
Encode them in a struct, thus removing magic numbers in the code
When using the built in font, it creates a conflict in the linker
as the symbol font5x8 is defined twice (once in the executable and
once in the 'library'. As this is a fairly trivial wrapper, the user
can recreate it with their 'default' font for the project.
Instead of having the CPU Idle while the Data is being transfered to the
Display, Use the DMA engine to transfer display buffer into the I2C
peripheral. allowing the CPU time to be used otherwise.

The use of the DMA needed to change the way the peripheral is
initialized. Most of the data initialization is done via a Macro that
sets up all the necessary data in the display struct. To initialize the
display, the ssd1306_init function still needs to be run. The define
also changes the implementation of the 'ssd1306_show' function to use
the DMA instead of 'fancy_write'
Also add commands to the CMakeLists.txt file of the example to allow for changing
the compile Define on the target.
The example is modified so that during build time DMA mode may
be selected or standard mode. Due to a small added delay due to
copying data into the DMA tx buffer the sleep time needed to be
increased to eliminate tearing.
Blitting moves a sprite into the display buffer while in this case
using bit wise operations to accomplish this with fewer CPU cycles
than using the draw pixel functions
Changed things such that the build system can straight up import the
src directory as a subdirectory. Changed the example CMake to do this
moved the fonts into their own directory and included that in the build
system. Added the start of a widget system to the ssd1306 display
(developed for other projects).
Create a new subfolder and update the example folder to include the
subfolders containing our examples
The new example shows the text typed over a serial interface
on the ssd1306, including basic control char handling
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.

1 participant