Skip to content

Conversation

@vanwinkeljan
Copy link
Member

This PR introduces a generic display shield sample as long as a board supports arduino shields this sample should work for suche board.

@zephyrbot
Copy link

zephyrbot commented Nov 11, 2019

All checks are passing now.

checkpatch (informational only, not a failure)

-:205: WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided
#205: FILE: samples/drivers/display/src/main.c:25:
+#define RETURN_FROM_MAIN(exit_code) return

- total: 0 errors, 1 warnings, 424 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: AVOID_EXTERNS BRACES CONFIG_EXPERIMENTAL CONST_STRUCT DATE_TIME FILE_PATH_CHANGES MINMAX NETWORKING_BLOCK_COMMENT_STYLE PRINTK_WITHOUT_KERN_LEVEL SPLIT_STRING VOLATILE

NOTE: If any of the errors are false positives, please report
      them to the maintainers.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to use CONFIG_LVGL_DISPLAY_DEV_NAME as it is already there.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is not an option CONFIG_LVGL_DISPLAY_DEV_NAME can only be set if LVGL is used else this config is not available.

@jfischer-no
Copy link
Contributor

@vanwinkeljan Why not make it more generic and move to samples/drivers/? I guess your plan is also to remove samples/display/ili9340 and samples/display/st7789?

Copy link
Contributor

Choose a reason for hiding this comment

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

change if to If (beginning of a sentence)

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's fix some issues with this rewrite:

This sample makes use of Arduino-based display shields and should work on any
board supporting such a shield, for example:

- :ref:`adafruit_2_8_tft_touch_v2`
- :ref:`ssd1306_128x32_shield`
- :ref:`ssd1306_128x64_shield`

Copy link
Contributor

Choose a reason for hiding this comment

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

change build to built

@vanwinkeljan
Copy link
Member Author

@vanwinkeljan Why not make it more generic and move to samples/drivers/? I guess your plan is also to remove samples/display/ili9340 and samples/display/st7789?

@jfischer-phytec-iot thx for the suggestion will take care of this in the next push.

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

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

This addition is not matching the definition of shield: a HW component that could be added on top of a board thanks to compatible connector.
Agree with @jfischer-phytec-iot , it would be better proposed as a sample/driver.

@vanwinkeljan
Copy link
Member Author

@erwango The sample was already moved to samples/drivers/display_shield

Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

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

@vanwinkeljan Why not make it more generic and move to samples/drivers/? I guess your plan is also to remove samples/display/ili9340 and samples/display/st7789?

@jfischer-phytec-iot thx for the suggestion will take care of this in the next push.

This looks more like a general display driver sample than a shield sample, so I think it belongs in samples/drivers/display. It should work on mimxrt1050_evk, which doesn't need a shield.

@vanwinkeljan
Copy link
Member Author

vanwinkeljan commented Nov 13, 2019

@MaureenHelm Valid point, only remaining problem is how do we get the correct display name in the sample.

An option would be to add a dts_fixup.h file to the sample to map all display name defines to a well known define that we can use in the sample.

@jfischer-no
Copy link
Contributor

Valid point, only remaining problem is how do we get the correct display name in the sample.

I am to implement similar mechanism that network stack has to discover the network interfaces or what we have for the usb classes.

@vanwinkeljan
Copy link
Member Author

@jfischer-phytec-iot Any suggestion how we proceed with this PR, eg. proceed with a dts_fixup.h file until your mechanism is in place, ... ?

@MaureenHelm
Copy link
Member

only remaining problem is how do we get the correct display name in the sample.

What about a common dts alias like we do for led0?

@jfischer-no
Copy link
Contributor

only remaining problem is how do we get the correct display name in the sample.

What about a common dts alias like we do for led0?

Would probably not work for the configuration like reel board + ssd1306_128x32 or mimxrt1050 + waveshare_epaper.

@jfischer-no
Copy link
Contributor

@jfischer-phytec-iot Any suggestion how we proceed with this PR, eg. proceed with a dts_fixup.h file until your mechanism is in place, ... ?

I think yes if that with dts_fixup.h works and is acceptable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Change to Below

Copy link
Contributor

Choose a reason for hiding this comment

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

for consistency, use lowercase for the color names (red, green, blue)

Copy link
Contributor

Choose a reason for hiding this comment

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

What should you do if the LCD is "endian swapped"? Is there a configuration or code change needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

As this is a generic display sample there is no clear solution to this issue and it is up to the user to figure it out. Could be a Kconfig that is not set correctly or a plain bug in the code.

@vanwinkeljan
Copy link
Member Author

Updated PR

  • Renamed sample to display instead of display_shield
  • Added support for mimxrt1050_evk (including build in CI)
  • Run sample in CI for native_posix + dummy display
  • Added waveshare_epaper_gdeh0213b1 to CI
  • Removed shield specific dts_fixup.h
  • Added dts_fixup.h to sample until display discovery mechanism is available

Copy link
Contributor

Choose a reason for hiding this comment

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

That's funny. My previous comments ask what someone should do if indeed the LCD is endian swapped and @MaureenHelm hit this. So maybe this is a common enough problem to say more here about what the developer might need to do in this situation?

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.

docs LGTM, thanks.

@vanwinkeljan
Copy link
Member Author

@MaureenHelm @erwango could you please revisit your reviews?

@erwango
Copy link
Member

erwango commented Dec 10, 2019

@vanwinkeljan,approved.
Btw, can you provide inputs on #20934.
I've modified shield Kconfig system, so I had to rewrite some shields configuration.
I have some doubts on the display shields configuration I proposed (particularly where to draw the line between application and shield configuration), and it seems like this change is perfect to test the proposal.

@vanwinkeljan
Copy link
Member Author

@erwango I will have a look at the other PR

Copy link
Contributor

@jfischer-no jfischer-no left a comment

Choose a reason for hiding this comment

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

block it to have time for review and test

@vanwinkeljan vanwinkeljan force-pushed the display_shield_sample branch 2 times, most recently from f7c27b9 to 4c5c1a1 Compare January 7, 2020 18:34
Copy link
Contributor

@jfischer-no jfischer-no left a comment

Choose a reason for hiding this comment

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

LGTM, thanks. Tested with ssd1306, mimxrt1050, st7789v, ssd16xx. As next we should remove samples/display/ili9340 and sample/display/st7789v.

Added a generic display shield sample.

Signed-off-by: Jan Van Winkel <[email protected]>
@vanwinkeljan vanwinkeljan force-pushed the display_shield_sample branch from 4c5c1a1 to 864f3bd Compare January 8, 2020 07:08
@jfischer-no
Copy link
Contributor

@MaureenHelm Please revise.

@jfischer-no jfischer-no added this to the v2.2.0 milestone Jan 10, 2020
@jfischer-no jfischer-no changed the title Display shield sample Display driver API sample Jan 10, 2020
@MaureenHelm MaureenHelm merged commit 7e3f9eb into zephyrproject-rtos:master Jan 10, 2020
@vanwinkeljan vanwinkeljan deleted the display_shield_sample branch January 17, 2020 07:01
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.

7 participants