From 4faf6546b1e36368cb8055812cd260d0b6c4aebf Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Tue, 10 Dec 2019 14:34:46 +0100 Subject: [PATCH] boards/shields: ssd1306: Factorize and move to conditional Kconfig Factorize definitions for ssd1306_128x32 and sd1306_128x64 shields and move to conditional Kconfig. As part of this change, direct drivers Kconfig symbols enabling (I2C, SSD1306) are removed as they are application responsibility. Also disabling SSD16XX is removed as SSD16XX should not be enabled by default. Signed-off-by: Erwan Gouriou --- boards/shields/ssd1306/Kconfig.defconfig | 45 +++++++++++++++++++ boards/shields/ssd1306/Kconfig.shield | 8 ++++ .../ssd1306/boards/reel_board.defconfig | 10 +++++ .../boards/reel_board.overlay | 0 .../{ssd1306_128x64 => ssd1306}/doc/index.rst | 8 ++-- .../ssd1306_128x32.overlay | 0 .../ssd1306_128x64.overlay | 0 .../ssd1306_128x32/boards/reel_board.conf | 2 - boards/shields/ssd1306_128x32/doc/index.rst | 30 ------------- .../ssd1306_128x32/ssd1306_128x32.conf | 11 ----- .../ssd1306_128x64/boards/reel_board.conf | 2 - .../ssd1306_128x64/boards/reel_board.overlay | 3 -- .../ssd1306_128x64/ssd1306_128x64.conf | 11 ----- samples/gui/lvgl/README.rst | 2 +- 14 files changed, 68 insertions(+), 64 deletions(-) create mode 100644 boards/shields/ssd1306/Kconfig.defconfig create mode 100644 boards/shields/ssd1306/Kconfig.shield create mode 100644 boards/shields/ssd1306/boards/reel_board.defconfig rename boards/shields/{ssd1306_128x32 => ssd1306}/boards/reel_board.overlay (100%) rename boards/shields/{ssd1306_128x64 => ssd1306}/doc/index.rst (78%) rename boards/shields/{ssd1306_128x32 => ssd1306}/ssd1306_128x32.overlay (100%) rename boards/shields/{ssd1306_128x64 => ssd1306}/ssd1306_128x64.overlay (100%) delete mode 100644 boards/shields/ssd1306_128x32/boards/reel_board.conf delete mode 100644 boards/shields/ssd1306_128x32/doc/index.rst delete mode 100644 boards/shields/ssd1306_128x32/ssd1306_128x32.conf delete mode 100644 boards/shields/ssd1306_128x64/boards/reel_board.conf delete mode 100644 boards/shields/ssd1306_128x64/boards/reel_board.overlay delete mode 100644 boards/shields/ssd1306_128x64/ssd1306_128x64.conf diff --git a/boards/shields/ssd1306/Kconfig.defconfig b/boards/shields/ssd1306/Kconfig.defconfig new file mode 100644 index 000000000000..a3e45b9cb6fe --- /dev/null +++ b/boards/shields/ssd1306/Kconfig.defconfig @@ -0,0 +1,45 @@ +# Copyright (c) 2019 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +if SHIELD_SSD1306_128X64 || SHIELD_SSD1306_128X32 + +if DISPLAY + +config I2C + default y + +config SSD1306 + default y + +if LVGL + +config LVGL_DISPLAY_DEV_NAME + default "SSD1306" + +config LVGL_HOR_RES + default 128 + +config LVGL_VER_RES + default 64 if SHIELD_SSD1306_128X64 + default 32 if SHIELD_SSD1306_128X32 + +config LVGL_VDB_SIZE + default 64 + +config LVGL_DPI + default 148 + +config LVGL_BITS_PER_PIXEL + default 1 + +choice LVGL_COLOR_DEPTH + default LVGL_COLOR_DEPTH_1 +endchoice + +endif # LVGL + +rsource "boards/*.defconfig" + +endif # DISPLAY + +endif # SHIELD_SSD1306_128X64 || SHIELD_SSD1306_128X32 diff --git a/boards/shields/ssd1306/Kconfig.shield b/boards/shields/ssd1306/Kconfig.shield new file mode 100644 index 000000000000..0b9671e460f8 --- /dev/null +++ b/boards/shields/ssd1306/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2019 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_SSD1306_128X32 + def_bool $(shields_list_contains,ssd1306_128x32) + +config SHIELD_SSD1306_128X64 + def_bool $(shields_list_contains,ssd1306_128x64) diff --git a/boards/shields/ssd1306/boards/reel_board.defconfig b/boards/shields/ssd1306/boards/reel_board.defconfig new file mode 100644 index 000000000000..5f9b40833397 --- /dev/null +++ b/boards/shields/ssd1306/boards/reel_board.defconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2019 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_REEL_BOARD + +choice I2C_0_NRF_TYPE + default I2C_0_NRF_TWI +endchoice + +endif # BOARD_REEL_BOARD diff --git a/boards/shields/ssd1306_128x32/boards/reel_board.overlay b/boards/shields/ssd1306/boards/reel_board.overlay similarity index 100% rename from boards/shields/ssd1306_128x32/boards/reel_board.overlay rename to boards/shields/ssd1306/boards/reel_board.overlay diff --git a/boards/shields/ssd1306_128x64/doc/index.rst b/boards/shields/ssd1306/doc/index.rst similarity index 78% rename from boards/shields/ssd1306_128x64/doc/index.rst rename to boards/shields/ssd1306/doc/index.rst index 435cbb6e5088..793158cf2acf 100644 --- a/boards/shields/ssd1306_128x64/doc/index.rst +++ b/boards/shields/ssd1306/doc/index.rst @@ -1,12 +1,12 @@ -.. _ssd1306_128x64_shield: +.. _ssd1306_128_shield: -SSD1306 128x64 pixels generic shield -#################################### +SSD1306 128x64(/32) pixels generic shield +######################################### Overview ******** -This is a generic shield for 128x64 pixel resolution OLED displays +This is a generic shield for 128x64(/32) pixel resolution OLED displays based on SSD1306 controller. These displays have an I2C interface and usually only four pins: GND, VCC, SCL and SDA. Display pins can be connected to the pin header of a board using jumper wires. diff --git a/boards/shields/ssd1306_128x32/ssd1306_128x32.overlay b/boards/shields/ssd1306/ssd1306_128x32.overlay similarity index 100% rename from boards/shields/ssd1306_128x32/ssd1306_128x32.overlay rename to boards/shields/ssd1306/ssd1306_128x32.overlay diff --git a/boards/shields/ssd1306_128x64/ssd1306_128x64.overlay b/boards/shields/ssd1306/ssd1306_128x64.overlay similarity index 100% rename from boards/shields/ssd1306_128x64/ssd1306_128x64.overlay rename to boards/shields/ssd1306/ssd1306_128x64.overlay diff --git a/boards/shields/ssd1306_128x32/boards/reel_board.conf b/boards/shields/ssd1306_128x32/boards/reel_board.conf deleted file mode 100644 index 9882ce2a64f3..000000000000 --- a/boards/shields/ssd1306_128x32/boards/reel_board.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_I2C_0_NRF_TWI=y -CONFIG_SSD16XX=n diff --git a/boards/shields/ssd1306_128x32/doc/index.rst b/boards/shields/ssd1306_128x32/doc/index.rst deleted file mode 100644 index 0eda3dcfaa77..000000000000 --- a/boards/shields/ssd1306_128x32/doc/index.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. _ssd1306_128x32_shield: - -SSD1306 128x32 pixels generic shield -#################################### - -Overview -******** - -This is a generic shield for 128x32 pixel resolution OLED displays -based on SSD1306 controller. These displays have an I2C interface and -usually only four pins: GND, VCC, SCL and SDA. Display pins can be -connected to the pin header of a board using jumper wires. - -Requirements -************ - -This shield can only be used with a board which provides a configuration -for Arduino connectors and defines a node alias for the I2C interface -(see :ref:`shields` for more details). - -Programming -*********** - -Set ``-DSHIELD=ssd1306_128x32`` when you invoke ``west build``. For example: - -.. zephyr-app-commands:: - :zephyr-app: samples/gui/lvgl - :board: frdm_k64f - :shield: ssd1306_128x32 - :goals: build diff --git a/boards/shields/ssd1306_128x32/ssd1306_128x32.conf b/boards/shields/ssd1306_128x32/ssd1306_128x32.conf deleted file mode 100644 index 74b6056c01eb..000000000000 --- a/boards/shields/ssd1306_128x32/ssd1306_128x32.conf +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG_I2C=y -CONFIG_SSD1306=y - -CONFIG_LVGL_COLOR_DEPTH_1=y -CONFIG_LVGL_BITS_PER_PIXEL=1 -CONFIG_LVGL_HOR_RES=128 -CONFIG_LVGL_VER_RES=32 -CONFIG_LVGL_DPI=148 -CONFIG_LVGL_VDB_SIZE=64 - -CONFIG_LVGL_DISPLAY_DEV_NAME="SSD1306" diff --git a/boards/shields/ssd1306_128x64/boards/reel_board.conf b/boards/shields/ssd1306_128x64/boards/reel_board.conf deleted file mode 100644 index 9882ce2a64f3..000000000000 --- a/boards/shields/ssd1306_128x64/boards/reel_board.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_I2C_0_NRF_TWI=y -CONFIG_SSD16XX=n diff --git a/boards/shields/ssd1306_128x64/boards/reel_board.overlay b/boards/shields/ssd1306_128x64/boards/reel_board.overlay deleted file mode 100644 index a6834a5419e5..000000000000 --- a/boards/shields/ssd1306_128x64/boards/reel_board.overlay +++ /dev/null @@ -1,3 +0,0 @@ -&arduino_i2c { - compatible = "nordic,nrf-twi"; -}; diff --git a/boards/shields/ssd1306_128x64/ssd1306_128x64.conf b/boards/shields/ssd1306_128x64/ssd1306_128x64.conf deleted file mode 100644 index 804e2ad10243..000000000000 --- a/boards/shields/ssd1306_128x64/ssd1306_128x64.conf +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG_I2C=y -CONFIG_SSD1306=y - -CONFIG_LVGL_COLOR_DEPTH_1=y -CONFIG_LVGL_BITS_PER_PIXEL=1 -CONFIG_LVGL_HOR_RES=128 -CONFIG_LVGL_VER_RES=64 -CONFIG_LVGL_DPI=148 -CONFIG_LVGL_VDB_SIZE=64 - -CONFIG_LVGL_DISPLAY_DEV_NAME="SSD1306" diff --git a/samples/gui/lvgl/README.rst b/samples/gui/lvgl/README.rst index b117a6ee1090..3ceb0df94392 100644 --- a/samples/gui/lvgl/README.rst +++ b/samples/gui/lvgl/README.rst @@ -16,7 +16,7 @@ Display shield and a board which provides a configuration for Arduino connectors, for example: - :ref:`adafruit_2_8_tft_touch_v2` and :ref:`nrf52840_pca10056` -- :ref:`ssd1306_128x64_shield` and :ref:`frdm_k64f` +- :ref:`ssd1306_128_shield` and :ref:`frdm_k64f` or a simulated display environment in a native Posix application: