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

Integrate U8g2 library #61533

Closed
wants to merge 3 commits into from
Closed

Conversation

soburi
Copy link
Member

@soburi soburi commented Aug 16, 2023

This PR integrates the u8g2 library into Zephyr.


Origin

Name of project hosting the original open source code

U8g2: Library for monochrome displays, version 2

Purpose

Brief description of what this software does

U8g2 is a monochrome graphics library for embedded devices. U8g2 supports monochrome OLEDs and LCDs

Mode of integration

Describe whether you'd like to integrate this external component in the main tree
or as a module, and why. If the mode of integration is a module, suggest a
repository name for the module

As External Module.

Maintainership

List the person(s) that will be maintaining the integration of this external code
for the foreseeable future. Please use GitHub IDs to identify them. You can
choose to identify a single maintainer only or add collaborators as well

@soburi

Pull Request

#61533 (this PR)

Description

Long description that will help reviewers discuss suitability of the
component to solve the problem at hand (there may be a better options
available.)

U8g2 is a graphics library for monochrome displays.
It can draw graphics primitives(lines, circles, etc.)
It has a font renderer and bundles various fonts.
U8g2 also contains LCD driver functions, which is needless in Zephyr.
The feature completely drops when any code does not reference it.

What is its primary functionality (e.g., SQLLite is a lightweight
database)?

Graphics drawing for monochrome display.

What problem are you trying to solve? (e.g., a state store is
required to maintain ...)

To enhance graphic drawing capability for monochrome display.

Why is this the right component to solve it (e.g., SQLite is small,
easy to use, and has a very liberal license.)

LVGL is unsuitable for monochrome display, and CFB optimizes for text rendering.

Dependencies

What other components does this package depend on?

No dependencies.

Revision

Version or SHA you would like to integrate initially

7851fd39858551dfa9c4af4a597e0ad85a180807
(https://github.com/soburi/u8g2 contains modification for zephyr)

License

Please use an SPDX identifier (https://spdx.org/licenses/), such as
BSD-3-Clause

BSD-2-Clause

And contains various license font data. (see below)


I think most issues are already discussed in #38755 and solved.

  • It is a significant gap in functions between the CFB and the LVGL. The U8g2 is suitable to fill the gap.
  • U8g2 is one of the few available libraries specialized to handle monochrome display, which I think is valuable to integrate.
  • U8g2 has the function of driving LCD devices. But no need to use it in Zephyr. We use it just as a graphics library.
  • U8g2 is a simple graphics library when not using its own LCD driver code. It has no dependency on other libraries. (From a portability perspective, it is a "pure C language" library.)
  • U8G2 handles 'VTILED' pixel format. It is the native format of monochrome display, and it is also the Zephyr display driver format.
    It means no overhead to convert pixel format between Zephyr and u8g2.
  • Additionally, introducing the U8G2 makes it able to draw graphics on a monochrome display, so I think CFB can optimize for implementations with stricter resource constraints. It is good to select CFB/U8G2/LVGL by resource constraint.

Mostly part of u8g2 licensed under BSD-2.
But bundled fonts are not so.
I removed files that were released under incompatible licenses with Zephyr.

I append the scancode result.

scancode -clpeu --classify --summary --verbose --html u8g2.html u8g2

And rechecked by hand, the result is https://github.com/soburi/u8g2/blob/zephyr/README.zephyr.md.

@zephyrbot zephyrbot added manifest manifest-u8g2 DNM This PR should not be merged (Do Not Merge) labels Aug 16, 2023
@zephyrbot
Copy link
Collaborator

zephyrbot commented Aug 16, 2023

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
u8g2 N/A soburi/u8g2@7851fd3 (zephyr) N/A

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@nordicjm
Copy link
Collaborator

@jfischer-no wasn't this module requested before and declined for being too similar to in-tree modules?

@soburi
Copy link
Member Author

soburi commented Aug 16, 2023

@nordicjm @jfischer-no

@jfischer-no wasn't this module requested before and declined for being too similar to in-tree modules?

From this discussion,

#58366 (comment)

I'm considering to remove the off-screen buffer function from cfb and use it differently with u8g2 and resource limits.
(Considering whether u8g2 can be used for applications that use off-screen buffers. Such as graphical drawing.)
I will consider whether to submit it formally, but I made it a draft because it seemed to work well for the time being.

#38755

As far as past discussions are concerned, there are some points of contention, but they are not necessarily negative.

@soburi soburi force-pushed the add_u8g2_lib branch 3 times, most recently from 40fcee2 to 2a1fee3 Compare August 16, 2023 11:14
@dolence
Copy link

dolence commented Aug 16, 2023

I am very glad to see there is an effort to bring u8g2 support to Zephyr. How could I test it? Os that possible? The lack of support to a small footprint (and yet very capable) library to be used with more constrained devices is the reason I don't use Zephyr on my projects.

@soburi
Copy link
Member Author

soburi commented Aug 17, 2023

I am very glad to see there is an effort to bring u8g2 support to Zephyr. How could I test it? Os that possible? The lack of support to a small footprint (and yet very capable) library to be used with more constrained devices is the reason I don't use Zephyr on my projects.

It should work with board that equips monochrome display. Such as reel board.
Otherwise, you need to write little configuration for connecting monochrome display.

@soburi soburi force-pushed the add_u8g2_lib branch 2 times, most recently from 8796e6f to c89fb22 Compare August 26, 2023 18:21
@soburi soburi changed the title Add u8g2 lib Integrate U8g2 library Aug 26, 2023
@soburi soburi marked this pull request as ready for review August 26, 2023 19:37
@soburi soburi requested a review from nashif as a code owner August 26, 2023 19:37
@soburi soburi added the TSC Topics that need TSC discussion label Aug 26, 2023
@jfischer-no
Copy link
Collaborator

I see no reason to add this library with many licensing issues when similar functionality is already implemented (by you) in CFB.

@nashif
Copy link
Member

nashif commented Aug 30, 2023

TSC: under review, we are considering to introduce an area for integration optional modules which will allow listing this as something a user can integrate in their application without making it a module maintained in the default manifest.

@soburi
Copy link
Member Author

soburi commented Aug 31, 2023

TSC: under review, we are considering to introduce an area for integration optional modules which will allow listing this as something a user can integrate in their application without making it a module maintained in the default manifest.

I can't touch the details of discussion, but I strongly welcome to add the method to introducing module by weak integration.

@dolence
Copy link

dolence commented Sep 1, 2023

I see no reason to add this library with many licensing issues when similar functionality is already implemented (by you) in CFB.

Isn't CFB character only? This isn't the same as CFB. I think CFB is similar to u8x8. U8g2 would be great. Following this.

I've some pictures attached of u8g2 in action on a project. UI with menus are supported trough MUI.

IMG_20230127_132813

Screenshot from 2023-09-05 15-37-23

@gmarull gmarull removed their request for review September 19, 2023 07:27
@dolence
Copy link

dolence commented Oct 5, 2023

I'm moving my project from STM23CubeIDE to Zephyr. How can I test this as an external out of the tree module?

@soburi
Copy link
Member Author

soburi commented Oct 17, 2023

#61505 was merged,
I changed this PR to use submanifests/optional.yaml.

Add the u8g2 library to the submanifests/optional.yaml.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Integrate u8g2 module.
Add build files and glue code for supporting u8g2.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add sample for u8g2 module.

u8g2_logo sample show basic usage for u8g2.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
@nashif
Copy link
Member

nashif commented Oct 19, 2023

this should be done as an external module, i.e. by providing a reference and enabled by those who need it in their manifest, see https://docs.zephyrproject.org/latest/develop/manifest/index.html#external-projects-modules

@nashif nashif closed this Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Process DNM This PR should not be merged (Do Not Merge) manifest manifest-u8g2 TSC Topics that need TSC discussion
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants