-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Introduce the cfb_shell sample app #11072
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11072 +/- ##
=========================================
- Coverage 48.23% 48.13% -0.1%
=========================================
Files 279 279
Lines 43291 43278 -13
Branches 10359 10358 -1
=========================================
- Hits 20881 20833 -48
- Misses 18270 18302 +32
- Partials 4140 4143 +3
Continue to review full report at Codecov.
|
c897331
to
58d02a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On top of the inline comments please add a README.rst for the sample.
58d02a9
to
87d41ca
Compare
@diegosueiro Code looks good to me but could you add a README.rst file to the sample then it will be visible from zephyrs documentation? |
@vanwinkeljan and @jfischer-phytec-iot , Any more comments on this PR? |
@diegosueiro No only open comment from my side is the missing README.rst |
samples/display/cfb_shell/prj.conf
Outdated
CONFIG_DISPLAY=y | ||
|
||
CONFIG_LOG=y | ||
CONFIG_DISPLAY_LOG_LEVEL_DBG=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not enable debug logging by default.
samples/display/cfb_shell/prj.conf
Outdated
CONFIG_LOG=y | ||
CONFIG_DISPLAY_LOG_LEVEL_DBG=y | ||
|
||
CONFIG_CFB_LOG_LEVEL_DBG=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@nashif , Do you think we should move from |
87d41ca
to
ec858b9
Compare
samples/display/cfb_shell/README.rst
Outdated
|
||
Overview | ||
******** | ||
A simple shell module that exercises displays using the Character Framebuffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple shell module that exercises displays using the Character Framebuffer | |
This is a simple shell module that exercises displays using the Character Framebuffer |
samples/display/cfb_shell/README.rst
Outdated
Building and Running | ||
******************** | ||
|
||
Build the sample app by choosing the OVERLAY_CONFIG for the target board. E.g.: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build the sample app by choosing the OVERLAY_CONFIG for the target board. E.g.: | |
Build the sample app by choosing the OVERLAY_CONFIG for the target board, for example: |
Shell Module Command Help | ||
========================= | ||
|
||
.. code-block:: console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this shows the command syntax, it doesn't explain what the (sub)commands actually do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't the command names self-explanatory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the uninitiated, such as me, no. I don't know what the commands do. I'll yield to the wisdom of other reviewers.
I'm guessing the framebuffer is sized exactly as the display so the scroll
command is not working with a larger buffer: I can't scroll up 5 rows and down 5 rows and the display would be restored. Will the print
command wrap text when hitting the edge of the display or scroll at the bottom? Do I have to call init
before any other command? Are the <col:pos>
arguments "character" size (not pixels), so I can't scroll half a character height?
When you say font
I'm assuming you're talking about a statically defined font-family + font-weight + font-size. Are all characters on the display the same font? Can I change the font after some characters are displayed (what happens)? What is ppt
?
For get_param, I'm guessing height/width units are pixels (and a fixed value for a given display), and rows/cols depends on the size of the current font that's set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @dbkinder here, anything is better than "[none]" and even for those with help, it is not really easy for someone not familiar with the feature to do anything simple.
ec858b9
to
0ae6c4d
Compare
Shell Module Command Help | ||
========================= | ||
|
||
.. code-block:: console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the uninitiated, such as me, no. I don't know what the commands do. I'll yield to the wisdom of other reviewers.
I'm guessing the framebuffer is sized exactly as the display so the scroll
command is not working with a larger buffer: I can't scroll up 5 rows and down 5 rows and the display would be restored. Will the print
command wrap text when hitting the edge of the display or scroll at the bottom? Do I have to call init
before any other command? Are the <col:pos>
arguments "character" size (not pixels), so I can't scroll half a character height?
When you say font
I'm assuming you're talking about a statically defined font-family + font-weight + font-size. Are all characters on the display the same font? Can I change the font after some characters are displayed (what happens)? What is ppt
?
For get_param, I'm guessing height/width units are pixels (and a fixed value for a given display), and rows/cols depends on the size of the current font that's set?
samples/display/cfb_shell/README.rst
Outdated
-h, --help :Show command help. | ||
Subcommands: | ||
init :[none] | ||
get_param :<all, heigh, width, ppt, rows, cols> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
height
49e3058
to
10d512b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but one typo
samples/display/cfb_shell/README.rst
Outdated
|
||
**get_device**: prints the display device name. | ||
|
||
**get_param**: get the display parameters where heigh, width and ppt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
height
a656e92
to
3277016
Compare
@diegosueiro Can you provide as an example a list of commands that can entered on the shell to allow someone unfamiliar to get going quickly, like print "reel board" in different way, scroll it, invert it, flip it, you name it.... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to pick on your sample, but there's no documentation elsewhere about the CFB API. Maybe some of this wouldn't be necessary if that were documented.
samples/display/cfb_shell/README.rst
Outdated
|
||
**print**: pass the initial column and row positions and the text in | ||
double quotation marks when it contains spaces. If text hits the edge | ||
the display the remain characters will be displayed in the next line. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the display the remain characters will be displayed in the next line. The | |
of the display the remaining characters will be displayed on the next line. The |
(pixel per tile) are in pixels and the number of rows and columns. The row | ||
position is incremented by a multiple of the ppt. | ||
|
||
**get_fonts**: print the index, height and width in pixels of the static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you install a new font?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing new fonts is not covered by this sample. And, AFAIK, you can only install new fonts at build time.
The PR #11224 is covering this.
display boundary, last column for horizontal and last row for vertical | ||
direction. | ||
|
||
**clear**: clear the display screen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great, after these descriptions, to show a nice example of how to display a phrase on the display and manipulate it (and have pictures or describe what gets displayed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can put command examples as @nashif suggested, but at the moment there is no API, AFAIK, to draw pictures, or manipulated what is printed like inversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diegosueiro I think what @dbkinder means is to give examples with screenshots in the docs.
But on adding the screenshots in the docs I already raised the question (PR #9149) if it is allowed to add binary files into the git repo. In my opinion this is not a good idea and git-lfs is not setup for the zephyr repo (@nashif any inputs on this?)
Regarding the API for drawing you have PR #6826 if you need something more fancy than CFB. CFB is just a lightweight framework for displaying text where LVGL is a full blown GUI library and I think they complement each other nicely
I will add examples. Do you think we should move from |
3277016
to
5d4d8bf
Compare
All checks are passing now. Review history of this comment for details about previous failed status. |
5d4d8bf
to
a43a864
Compare
Anything more is needed? |
|
||
uart:~$ cfb print 60 5 ZEPHYR | ||
|
||
**scroll**: pass the scroll direction, vertical or horizontal, the initial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update and examples! I'm still a bit confused about the difference between "print" and "scroll". Is "print" the same as "scroll vertical"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbkinder,
The scroll command will "move" vertically or horizontally the text from the initial position to the display boundaries. And the print will only display the text without any movement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so "scroll" inserts the text and moves any existing text on the display, and "print" will overwrite existing text? That's worth clarifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. The scroll will move the text that you passed with the scroll command. What is already on the display will be overwritten as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did I get that right?
samples/display/cfb_shell/README.rst
Outdated
**print**: pass the initial column and row positions and the text in | ||
double quotation marks when it contains spaces. If text hits the edge | ||
of the display the remaining characters will be displayed on the next line. The | ||
previous printed text will be erased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous printed text will be erased. | |
previous printed text will be overwritten. |
samples/display/cfb_shell/README.rst
Outdated
contains spaces. If text hits the edge the display the remaining characters | ||
will be displayed in the next line. The text will scroll until it hits the | ||
display boundary, last column for horizontal and last row for vertical | ||
direction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
direction. | |
direction. Existing text on the display will be moved, potentially off the display. |
Adds the cfb_framebuffer_invert function to invert Pixels in the Character Framebuffer Signed-off-by: Diego Sueiro <[email protected]>
Adds the cfb_get_numof_fonts function to get the number of available fonts Signed-off-by: Diego Sueiro <[email protected]>
This adds the config option and files of the Character Framebuffer shell module Signed-off-by: Diego Sueiro <[email protected]>
This adds the shell sample app for the Character Framebuffer testing. cfb - Character Framebuffer shell commands Options: -h, --help :Show command help. Subcommands: init :[none] get_device :[none] get_param :<all, height, width, ppt, rows, cols> get_fonts :[none] set_font :<idx> invert :[none] print :<col: pos> <row: pos> <text> scroll :<dir: (vertical|horizontal)> <col: pos> <row: pos> <text> clear :[none] Signed-off-by: Diego Sueiro <[email protected]>
a43a864
to
65aa31b
Compare
Any more comments on the documentation? |
This PR adds:
cfb_framebuffer_invert
function to invert the pixels in the character framebuffer;cfb_get_numof_fonts
function to get the number of available fontsAll tested and validated with the reel_board:
cmake -DBOARD=reel_board ../..