shields: display: Add Waveshare Pico OLED 1.3

Added Waveshare 1.3inch OLED module for RaspberryPi Pico.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
TOKITA Hiroshi 2023-09-14 12:48:35 +09:00 committed by Benjamin Cabé
commit 429e3a96c2
11 changed files with 226 additions and 0 deletions

View file

@ -0,0 +1,24 @@
# Copyright (c) 2025 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0
if SHIELD_WAVESHARE_PICO_OLED_1_3
if DISPLAY
if LVGL
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

View file

@ -0,0 +1,11 @@
# Copyright (c) 2025 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_DISPLAY
def_bool $(shields_list_contains,waveshare_pico_oled_1_3_display)
config SHIELD_WAVESHARE_PICO_OLED_1_3_BUTTONS
def_bool $(shields_list_contains,waveshare_pico_oled_1_3_buttons)

View file

@ -0,0 +1,8 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
/* pico_plus2 can use with the rpi_pico configuration. */
#include "rpi_pico.overlay"

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2025 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 {
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
status = "okay";
};

View file

@ -0,0 +1,8 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
/* rpi_pico2 can use with the rpi_pico configuration. */
#include "rpi_pico.overlay"

View file

@ -0,0 +1,8 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
/* w5500_evb_pico2 can use with the rpi_pico configuration. */
#include "rpi_pico.overlay"

View file

@ -0,0 +1,8 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
/* w5500_evb_pico2 can use with the rpi_pico configuration. */
#include "rpi_pico.overlay"

View file

@ -0,0 +1,65 @@
.. _waveshare_pico_oled_1_3:
Waveshare 1.3inch OLED Display Module for Raspberry Pi Pico
###########################################################
Overview
********
The Waveshare 1.3inch OLED Display Module for 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 Pico OLED 1.3 Module website`_.
Pin Assignments
===============
+-------+-----------+-------------------------------------------+
| Name | Function | Usage |
+=======+===========+===========================================+
| GP6 | I2C_SDA | I2C Data input (I2C1_SDA) |
+-------+-----------+-------------------------------------------+
| GP7 | I2C_SCL | I2C Clock input (I2C1_SCL) |
+-------+-----------+-------------------------------------------+
| GP8 | OLED_DC | Data/Command control pin (optional) |
+-------+-----------+-------------------------------------------+
| GP9 | OLED_CS | SPI Chip Select (SPI1_CSN, optional) |
+-------+-----------+-------------------------------------------+
| GP10 | OLED_CLK | SPI Clock input (SPI1_SCK, optional) |
+-------+-----------+-------------------------------------------+
| GP11 | OLED_DIN | SPI Data input (SPI1_TX, optional) |
+-------+-----------+-------------------------------------------+
| GP12 | OLED_RST | Reset |
+-------+-----------+-------------------------------------------+
| GP15 | GPIO | User Key 0 |
+-------+-----------+-------------------------------------------+
| GP17 | GPIO | User Key 1 |
+-------+-----------+-------------------------------------------+
.. 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
References
**********
.. target-notes::
.. _Waveshare Pico OLED 1.3 Module website:
https://www.waveshare.com/wiki/Pico-OLED-1.3

View file

@ -0,0 +1,8 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "waveshare_pico_oled_1_3_display.overlay"
#include "waveshare_pico_oled_1_3_buttons.overlay"

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/lvgl/lvgl.h>
/ {
buttons {
compatible = "gpio-keys";
key0: key0 {
label = "User Key 0";
gpios = <&pico_header 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_0>;
};
key1: key1 {
label = "User Key 1";
gpios = <&pico_header 17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_1>;
};
};
aliases {
sw0 = &key0;
};
};

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2025 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
chosen {
zephyr,display = &sh1107_waveshare_pico_oled_1_3;
};
};
&i2c1 {
sh1107_waveshare_pico_oled_1_3: sh1107@3c {
compatible = "sinowealth,sh1106";
reg = <0x3c>;
width = <64>;
height = <128>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0x20>;
multiplex-ratio = <63>;
prechargep = <0x22>;
segment-remap;
com-invdir;
reset-gpios = <&pico_header 12 GPIO_ACTIVE_LOW>;
status = "okay";
};
};