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

Introduce the cfb_shell sample app #11072

Merged
merged 4 commits into from
Dec 6, 2018

Conversation

diegosueiro
Copy link
Contributor

@diegosueiro diegosueiro commented Nov 4, 2018

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 fonts
  • a character framebuffer shell module;
  • a sample app to test the character framebuffer shell module.

All tested and validated with the reel_board: cmake -DBOARD=reel_board ../..

@codecov-io
Copy link

codecov-io commented Nov 4, 2018

Codecov Report

Merging #11072 into master will decrease coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
subsys/logging/log_output.c 62.38% <0%> (-10%) ⬇️
subsys/logging/log_core.c 70.85% <0%> (-4.69%) ⬇️
misc/printk.c 81.81% <0%> (-3.13%) ⬇️
include/logging/log_msg.h 89.09% <0%> (-1.82%) ⬇️
include/logging/log_core.h 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61ccafa...65aa31b. Read the comment docs.

Copy link
Member

@vanwinkeljan vanwinkeljan left a 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.

subsys/fb/Kconfig Outdated Show resolved Hide resolved
subsys/fb/Kconfig Outdated Show resolved Hide resolved
subsys/fb/cfb_shell.c Outdated Show resolved Hide resolved
subsys/fb/cfb_shell.c Outdated Show resolved Hide resolved
subsys/fb/cfb_shell.c Outdated Show resolved Hide resolved
subsys/fb/cfb_shell.c Outdated Show resolved Hide resolved
@vanwinkeljan
Copy link
Member

@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?

@diegosueiro
Copy link
Contributor Author

@vanwinkeljan and @jfischer-phytec-iot ,

Any more comments on this PR?

@vanwinkeljan
Copy link
Member

@diegosueiro No only open comment from my side is the missing README.rst

nashif
nashif previously requested changes Nov 11, 2018
CONFIG_DISPLAY=y

CONFIG_LOG=y
CONFIG_DISPLAY_LOG_LEVEL_DBG=y
Copy link
Member

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.

CONFIG_LOG=y
CONFIG_DISPLAY_LOG_LEVEL_DBG=y

CONFIG_CFB_LOG_LEVEL_DBG=y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@diegosueiro
Copy link
Contributor Author

@nashif ,

Do you think we should move from samples/display/cfb_shell to samples/subsys/shell/cfb_module/ ?


Overview
********
A simple shell module that exercises displays using the Character Framebuffer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A simple shell module that exercises displays using the Character Framebuffer
This is a simple shell module that exercises displays using the Character Framebuffer

Building and Running
********************

Build the sample app by choosing the OVERLAY_CONFIG for the target board. E.g.:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Member

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.

Shell Module Command Help
=========================

.. code-block:: console
Copy link
Contributor

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?

-h, --help :Show command help.
Subcommands:
init :[none]
get_param :<all, heigh, width, ppt, rows, cols>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height

@diegosueiro diegosueiro force-pushed the cfb_shell branch 2 times, most recently from 49e3058 to 10d512b Compare November 13, 2018 07:38
@diegosueiro
Copy link
Contributor Author

@dbkinder and @nashif ,

Any more comments?

Copy link
Contributor

@dbkinder dbkinder left a 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


**get_device**: prints the display device name.

**get_param**: get the display parameters where heigh, width and ppt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height

@diegosueiro diegosueiro force-pushed the cfb_shell branch 2 times, most recently from a656e92 to 3277016 Compare November 15, 2018 08:42
@nashif
Copy link
Member

nashif commented Nov 21, 2018

@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....

@nashif nashif dismissed their stale review November 21, 2018 20:19

addressed

Copy link
Contributor

@dbkinder dbkinder left a 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.


**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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

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?

Copy link
Contributor Author

@diegosueiro diegosueiro Nov 22, 2018

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.
Copy link
Contributor

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).

Copy link
Contributor Author

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.

Copy link
Member

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

@diegosueiro
Copy link
Contributor Author

@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....

I will add examples.

Do you think we should move from samples/display/cfb_shell/ to samples/subsys/shell/cfb_module/

@zephyrbot
Copy link
Collaborator

zephyrbot commented Nov 22, 2018

All checks are passing now.

Review history of this comment for details about previous failed status.
Note that some checks might have not completed yet.

@diegosueiro
Copy link
Contributor Author

@dbkinder ,

Anything more is needed?


uart:~$ cfb print 60 5 ZEPHYR

**scroll**: pass the scroll direction, vertical or horizontal, the initial
Copy link
Contributor

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"?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@dbkinder dbkinder left a 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?

**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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
previous printed text will be erased.
previous printed text will be overwritten.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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]>
@diegosueiro
Copy link
Contributor Author

@dbkinder,

Any more comments on the documentation?

@nashif nashif merged commit 48f4932 into zephyrproject-rtos:master Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants