Skip to content

Commit

Permalink
shields: display: Add Waveshare Pico OLED 1.3
Browse files Browse the repository at this point in the history
Added Waveshare 1.3inch OLED module for RaspberryPi Pico.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
  • Loading branch information
soburi committed Sep 15, 2023
1 parent db52d27 commit 5a96bbb
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 0 deletions.
27 changes: 27 additions & 0 deletions boards/shields/waveshare_pico_oled_1_3/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions boards/shields/waveshare_pico_oled_1_3/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -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)
22 changes: 22 additions & 0 deletions boards/shields/waveshare_pico_oled_1_3/boards/rpi_pico.overlay
Original file line number Diff line number Diff line change
@@ -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 = <I2C1_SDA_P6>, <I2C1_SCL_P7>;
input-enable;
input-schmitt-enable;
};
};
};

&i2c1 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
};
113 changes: 113 additions & 0 deletions boards/shields/waveshare_pico_oled_1_3/doc/index.rst
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2023 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
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>;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2023 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
buttons {
compatible = "gpio-keys";
key0: key0 {
gpios = <&gpio0 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "User Key 0";
zephyr,code = <INPUT_KEY_0>;
};
key1: key1 {
gpios = <&gpio0 17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "User Key 1";
zephyr,code = <INPUT_KEY_1>;
};
};

aliases {
sw0 = &key0;
};
};

0 comments on commit 5a96bbb

Please sign in to comment.