Skip to content

Commit

Permalink
shields: rpi_pico_lcd: add PiMoroni Pico LCD 2
Browse files Browse the repository at this point in the history
The new part of the Raspberry Pi Pico LCD shield by PiMoroni is:

  * PIM580 Pico Display Pack 2.0, here in Bridle known as
    PiMoroni Pico LCD 2 (pimoroni_pico_lcd_2)

supported features:

  * display API (zephyr/samples/drivers/display)
  * LVGL stack (zephyr/samples/subsys/display/lvgl)
  * input API (zephyr/samples/subsys/input/input_dump)

supported platforms:

  * Raspberry Pi Pico (rpi_pico)
  * Raspberry Pi Pico W (rpi_pico_w)
  * Waveshare RP2040 Plus 4MB (waveshare_rp2040_plus)
  * Waveshare RP2040 Plus 16MB (waveshare_rp2040_plus@16mb)

Signed-off-by: Stephan Linz <[email protected]>
  • Loading branch information
rexut committed Jun 30, 2024
1 parent 0878df2 commit 968cc8f
Show file tree
Hide file tree
Showing 42 changed files with 1,281 additions and 1 deletion.
6 changes: 6 additions & 0 deletions boards/shields/rpi_pico_lcd/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
config SHIELD_RPI_PICO_LCD
bool
default y if SHIELD_PIMORONI_PICO_LCD_1_44
default y if SHIELD_PIMORONI_PICO_LCD_2
default y if SHIELD_WAVESHARE_PICO_LCD_0_96
default y if SHIELD_WAVESHARE_PICO_LCD_1_14
default y if SHIELD_WAVESHARE_PICO_LCD_1_3
Expand All @@ -16,6 +17,7 @@ config SHIELD_RPI_PICO_LCD

choice ST7789V_PIXEL_FORMAT
default ST7789V_RGB565 if SHIELD_PIMORONI_PICO_LCD_1_44
default ST7789V_RGB565 if SHIELD_PIMORONI_PICO_LCD_2
default ST7789V_RGB565 if SHIELD_WAVESHARE_PICO_LCD_1_14
default ST7789V_RGB565 if SHIELD_WAVESHARE_PICO_LCD_1_3
default ST7789V_RGB565 if SHIELD_WAVESHARE_PICO_LCD_2
Expand All @@ -29,6 +31,7 @@ config LV_Z_VDB_SIZE

config LV_Z_BITS_PER_PIXEL
default 16 if SHIELD_PIMORONI_PICO_LCD_1_44
default 16 if SHIELD_PIMORONI_PICO_LCD_2
default 16 if SHIELD_WAVESHARE_PICO_LCD_0_96
default 16 if SHIELD_WAVESHARE_PICO_LCD_1_14
default 16 if SHIELD_WAVESHARE_PICO_LCD_1_3
Expand All @@ -41,6 +44,7 @@ config LV_Z_BITS_PER_PIXEL

choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_16 if SHIELD_PIMORONI_PICO_LCD_1_44
default LV_COLOR_DEPTH_16 if SHIELD_PIMORONI_PICO_LCD_2
default LV_COLOR_DEPTH_16 if SHIELD_WAVESHARE_PICO_LCD_0_96
default LV_COLOR_DEPTH_16 if SHIELD_WAVESHARE_PICO_LCD_1_14
default LV_COLOR_DEPTH_16 if SHIELD_WAVESHARE_PICO_LCD_1_3
Expand All @@ -54,6 +58,7 @@ endchoice

config LV_COLOR_16_SWAP
default y if SHIELD_PIMORONI_PICO_LCD_1_44
default y if SHIELD_PIMORONI_PICO_LCD_2
default y if SHIELD_WAVESHARE_PICO_LCD_0_96
default y if SHIELD_WAVESHARE_PICO_LCD_1_14
default y if SHIELD_WAVESHARE_PICO_LCD_1_3
Expand All @@ -76,4 +81,5 @@ config REGULATOR

config GPIO_HOGS
default y if SHIELD_PIMORONI_PICO_LCD_1_44
default y if SHIELD_PIMORONI_PICO_LCD_2
depends on SHIELD_RPI_PICO_LCD && GPIO
3 changes: 3 additions & 0 deletions boards/shields/rpi_pico_lcd/Kconfig.shield
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
config SHIELD_PIMORONI_PICO_LCD_1_44
def_bool $(shields_list_contains,pimoroni_pico_lcd_1_44)

config SHIELD_PIMORONI_PICO_LCD_2
def_bool $(shields_list_contains,pimoroni_pico_lcd_2)

config SHIELD_WAVESHARE_PICO_LCD_0_96
def_bool $(shields_list_contains,waveshare_pico_lcd_0_96)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "rpipico_r3.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "rpipico_r3.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "rpipico_r3-tweaks.dtsi"
#include "rpipico_r3-pinctrl.dtsi"

#include <freq.h>

&pico_spi0 {
pinctrl-0 = <&spi0_lcd>;
pinctrl-names = "default";
clock-frequency = <DT_FREQ_M(20)>;
};

rpipico_spi_lcd: &pico_spi0 {};

&pico_pwm {
pinctrl-0 = <&pwm_lcd_leds>;
pinctrl-names = "default";
};

rpipico_pwm: &pico_pwm {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>

pwm_lcd_leds: &pwm_pico {
group6_led {
pinmux = <PWM_3A_P6>; /* GP6: PWM3CHA (6) */
};
group7_led {
pinmux = <PWM_3B_P7>; /* GP7: PWM3CHB (7) */
};
group8_led {
pinmux = <PWM_4A_P8>; /* GP8: PWM4CHA (8) */
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/gpio/gpio.h>

&gpio0 {
boot-hogs-led-rgb-off {
gpio-hog;
gpios = <6 GPIO_ACTIVE_HIGH>, /* User LED R */
<7 GPIO_ACTIVE_HIGH>, /* User LED G */
<8 GPIO_ACTIVE_HIGH>; /* User LED B */
output-high;
line-name = "TriColor ChipLED switched off";
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "rpipico_r3-connect.dtsi"

#include "st7789v_320x240.dtsi"
#include "st7789v_rgb565.dtsi"

#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/pwm/pwm.h>

&rpipico_spi_lcd {
status = "okay";
cs-gpios = <&rpipico_header 17 GPIO_ACTIVE_LOW>; /* GP17 */
};

&mipi_dbi {
status = "okay";
dc-gpios = <&rpipico_header 16 GPIO_ACTIVE_HIGH>; /* GP16 */
spi-dev = <&rpipico_spi_lcd>;
#address-cells = <1>;
#size-cells = <0>;
};

&lcd_panel {
status = "okay";
};

&lcd_backlight_en {
status = "okay";
enable-gpios = <&rpipico_header 20 GPIO_ACTIVE_HIGH>; /* GP20 */
};

&rpipico_pwm {
status = "okay";
divider-frac-3 = <15>;
divider-int-3 = <255>;
divider-frac-4 = <15>;
divider-int-4 = <255>;
};

&pwm_led_r { /* GP6:PWM3A */
pwms = <&rpipico_pwm 6 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};

&pwm_led_g { /* GP7:PWM3B */
pwms = <&rpipico_pwm 7 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};

&pwm_led_b { /* GP8:PWM4A */
pwms = <&rpipico_pwm 8 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};

&led_r { /* GP6 */
gpios = <&rpipico_header 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

&led_g { /* GP7 */
gpios = <&rpipico_header 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

&led_b { /* GP8 */
gpios = <&rpipico_header 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

&button_0 { /* GP12 */
gpios = <&rpipico_header 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

&button_1 { /* GP13 */
gpios = <&rpipico_header 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

&button_2 { /* GP14 */
gpios = <&rpipico_header 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

&button_3 { /* GP15 */
gpios = <&rpipico_header 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <freq.h>
#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>

&mipi_dbi {
st7789v_240x320: st7789v@0 {
compatible = "sitronix,st7789v";
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;

status = "disabled";

width = <240>; /* portrait */
height = <320>; /* portrait */
x-offset = <0>; /* portrait */
y-offset = <0>; /* portrait */

vcom = <0x1f>;
gctrl = <0x35>;
vrhs = <0x12>;
vdvs = <0x20>;
mdac = <0x00>; /* portrait */
gamma = <0x01>;
lcm = <0x2c>;
porch-param = [0C 0C 00 33 33];
cmd2en-param = [5A 69 02 01];
pwctrl1-param = [A4 A1];
pvgam-param = [D0 08 11 08 0C 15 39 33 50 36 13 14 29 2D];
nvgam-param = [D0 08 10 08 06 06 39 44 51 0B 16 14 2F 31];
ram-param = [00 F0];
rgb-param = [CD 08 14];
};
};

lcd_panel: &st7789v_240x320 {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&st7789v_240x320 {
mdac = <0x40>; /* portrait, mirrored */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&st7789v_240x320 {
mdac = <0xC0>; /* portrait, overhead */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&st7789v_240x320 {
mdac = <0x80>; /* portrait, upsidedown */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include <freq.h>
#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>

&mipi_dbi {
st7789v_320x240: st7789v@0 {
compatible = "sitronix,st7789v";
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;

status = "disabled";

width = <320>; /* landscape */
height = <240>; /* landscape */
x-offset = <0>; /* landscape */
y-offset = <0>; /* landscape */

vcom = <0x1f>;
gctrl = <0x35>;
vrhs = <0x12>;
vdvs = <0x20>;
mdac = <0x60>; /* landscape */
gamma = <0x01>;
lcm = <0x2c>;
porch-param = [0C 0C 00 33 33];
cmd2en-param = [5A 69 02 01];
pwctrl1-param = [A4 A1];
pvgam-param = [D0 08 11 08 0C 15 39 33 50 36 13 14 29 2D];
nvgam-param = [D0 08 10 08 06 06 39 44 51 0B 16 14 2F 31];
ram-param = [00 F0];
rgb-param = [CD 08 14];
};
};

lcd_panel: &st7789v_320x240 {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&st7789v_320x240 {
mdac = <0xE0>; /* landscape, mirrored */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&st7789v_320x240 {
mdac = <0xA0>; /* landscape, overhead */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&st7789v_320x240 {
mdac = <0x20>; /* landscape, upsidedown */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&lcd_panel {
inversion-off;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&lcd_panel {
colmod = <0x05>; /* 16-bit, RGB565 */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&lcd_panel {
colmod = <0x06>; /* 18-bit, RGB666 */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

&lcd_panel {
colmod = <0x07>; /* 24-bit, RGB888 */
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright (c) 2024 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

#include "rpipico_r3.dtsi"
Loading

0 comments on commit 968cc8f

Please sign in to comment.