diff --git a/boards/shields/waveshare_pico_oled_1_3/Kconfig.defconfig b/boards/shields/waveshare_pico_oled_1_3/Kconfig.defconfig new file mode 100644 index 000000000000000..5d126ae2629b680 --- /dev/null +++ b/boards/shields/waveshare_pico_oled_1_3/Kconfig.defconfig @@ -0,0 +1,27 @@ +# Copyright (c) 2023 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +if SHIELD_WAVESHARE_PICO_OLED_1_3 + +if DISPLAY + +if LVGL + +config LV_Z_VDB_SIZE + default 64 + +config LV_DPI_DEF + default 110 + +config LV_Z_BITS_PER_PIXEL + default 1 + +choice LV_COLOR_DEPTH + default LV_COLOR_DEPTH_1 +endchoice + +endif # LVGL + +endif # DISPLAY + +endif # SHIELD_WAVESHARE_PICO_OLED_1_3 diff --git a/boards/shields/waveshare_pico_oled_1_3/Kconfig.shield b/boards/shields/waveshare_pico_oled_1_3/Kconfig.shield new file mode 100644 index 000000000000000..0ad090ca4014e70 --- /dev/null +++ b/boards/shields/waveshare_pico_oled_1_3/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2023 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_WAVESHARE_PICO_OLED_1_3 + def_bool $(shields_list_contains,waveshare_pico_oled_1_3) + +config SHIELD_WAVESHARE_PICO_OLED_1_3_KEYS + def_bool $(shields_list_contains,waveshare_pico_oled_1_3_keys) diff --git a/boards/shields/waveshare_pico_oled_1_3/boards/rpi_pico.overlay b/boards/shields/waveshare_pico_oled_1_3/boards/rpi_pico.overlay new file mode 100644 index 000000000000000..4439346f86263ad --- /dev/null +++ b/boards/shields/waveshare_pico_oled_1_3/boards/rpi_pico.overlay @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + i2c1_default: i2c1_default { + waveshare_pico_oled_1_3_group1 { + pinmux = , ; + input-enable; + input-schmitt-enable; + }; + }; +}; + +&i2c1 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; +}; diff --git a/boards/shields/waveshare_pico_oled_1_3/doc/index.rst b/boards/shields/waveshare_pico_oled_1_3/doc/index.rst new file mode 100644 index 000000000000000..85ef6591632bc19 --- /dev/null +++ b/boards/shields/waveshare_pico_oled_1_3/doc/index.rst @@ -0,0 +1,113 @@ +.. _waveshare_pico_oled_1_3: + +Waveshare 1.3inch OLED Module for RaspberryPi Pico +################################################## + +Overview +******** + +The Waveshare 1.3" OLED Module for the Raspberry Pi Pico is a 64x128 +vertically long LCD module based on the SinoWealth SH1107 controller. +This module connects via I2C and optionally can use SPI(need soldering). +This display module has two buttons that the user program can use. +It is convenient for implementing user interfaces. + +More information about the shield and Arduino adapter can be found at +the `Waveshare 1.3inch OLED Module for RaspberryPi Pico 64x128 website`_. + +Pin Assignments +=============== + ++-------+-----------+-------------------------------------------+ +| Name | Function | Usage | ++=======+===========+===========================================+ +| GP0 | None | | ++-------+-----------+-------------------------------------------+ +| GP1 | None | | ++-------+-----------+-------------------------------------------+ +| GP2 | None | | ++-------+-----------+-------------------------------------------+ +| GP3 | None | | ++-------+-----------+-------------------------------------------+ +| GP4 | None | | ++-------+-----------+-------------------------------------------+ +| GP5 | None | | ++-------+-----------+-------------------------------------------+ +| GP6 | I2C1_SDA | I2C Data input | ++-------+-----------+-------------------------------------------+ +| GP7 | I2C1_SCL | I2C Clock input | ++-------+-----------+-------------------------------------------+ +| GP8 | GPIO | Data/Command control pin (Need soldering) | ++-------+-----------+-------------------------------------------+ +| GP9 | SPI1_CSN | SPI Chip Select (Need soldering) | ++-------+-----------+-------------------------------------------+ +| GP10 | SPI1_SCK | SPI Clock input (Need soldering) | ++-------+-----------+-------------------------------------------+ +| GP11 | SPI1_TX | SPI Data input (Need soldering) | ++-------+-----------+-------------------------------------------+ +| GP12 | RESET | | ++-------+-----------+-------------------------------------------+ +| GP13 | None | | ++-------+-----------+-------------------------------------------+ +| GP14 | None | | ++-------+-----------+-------------------------------------------+ +| GP15 | GPIO | User Key 0 | ++-------+-----------+-------------------------------------------+ +| GP16 | None | | ++-------+-----------+-------------------------------------------+ +| GP17 | GPIO | User Key 1 | ++-------+-----------+-------------------------------------------+ +| GP18 | None | | ++-------+-----------+-------------------------------------------+ +| GP19 | None | | ++-------+-----------+-------------------------------------------+ +| GP20 | None | | ++-------+-----------+-------------------------------------------+ +| GP21 | None | | ++-------+-----------+-------------------------------------------+ +| GP22 | None | | ++-------+-----------+-------------------------------------------+ +| GP23 | None | | ++-------+-----------+-------------------------------------------+ +| GP24 | None | | ++-------+-----------+-------------------------------------------+ +| GP25 | None | | ++-------+-----------+-------------------------------------------+ +| GP26 | None | | ++-------+-----------+-------------------------------------------+ +| GP27 | None | | ++-------+-----------+-------------------------------------------+ +| GP28 | None | | ++-------+-----------+-------------------------------------------+ + +.. note:: + The SPI interface is not available by default. + Switch the J1, J2, and J3 jumper by moving 0-ohm registers + to the SPI side to enable SPI. + +Programming +*********** + +Set ``-DSHIELD=waveshare_pico_oled_1_3`` when you invoke ``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/display/lvgl + :board: rpi_pico + :shield: waveshare_pico_oled_1_3 + :goals: build + +For using buttons, set ``-DSHIELD=waveshare_pico_oled_1_3_keys`` to enable it. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/button + :board: rpi_pico + :shield: waveshare_pico_oled_1_3_keys + :goals: build + +References +********** + +.. target-notes:: + +.. _Waveshare 1.3inch OLED Module for RaspberryPi Pico 64x128 website: + https://www.waveshare.com/pico-oled-1.3.htm diff --git a/boards/shields/waveshare_pico_oled_1_3/waveshare_pico_oled_1_3.overlay b/boards/shields/waveshare_pico_oled_1_3/waveshare_pico_oled_1_3.overlay new file mode 100644 index 000000000000000..dcbf5c6e278af8c --- /dev/null +++ b/boards/shields/waveshare_pico_oled_1_3/waveshare_pico_oled_1_3.overlay @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + chosen { + zephyr,display = &waveshare_pico_oled_1_3; + }; +}; + +&i2c1 { + waveshare_pico_oled_1_3: ssd1306@3c { + compatible = "sinowealth,sh1106"; + status = "okay"; + reg = <0x3c>; + width = <64>; + height = <128>; + segment-offset = <0>; + page-offset = <0>; + display-offset = <0x60>; + multiplex-ratio = <63>; + prechargep = <0x22>; + ready-time-ms = <0>; + }; +}; diff --git a/boards/shields/waveshare_pico_oled_1_3/waveshare_pico_oled_1_3_keys.overlay b/boards/shields/waveshare_pico_oled_1_3/waveshare_pico_oled_1_3_keys.overlay new file mode 100644 index 000000000000000..758beac20309096 --- /dev/null +++ b/boards/shields/waveshare_pico_oled_1_3/waveshare_pico_oled_1_3_keys.overlay @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + buttons { + compatible = "gpio-keys"; + key0: key0 { + gpios = <&gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "User Key 0"; + zephyr,code = ; + }; + key1: key1 { + gpios = <&gpio0 17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "User Key 1"; + zephyr,code = ; + }; + }; + + aliases { + sw0 = &key0; + }; +};