Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more Raspberry Pi Pico LCD Shields by PiMoroni #243

Merged
merged 6 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions boards/shields/rpi_pico_lcd/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

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 @@ -14,6 +16,8 @@ config SHIELD_RPI_PICO_LCD
default n

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 @@ -26,6 +30,8 @@ config LV_Z_VDB_SIZE
depends on SHIELD_RPI_PICO_LCD && DISPLAY && LVGL

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 @@ -37,6 +43,8 @@ config LV_Z_BITS_PER_PIXEL
depends on SHIELD_RPI_PICO_LCD && DISPLAY && LVGL

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 @@ -49,6 +57,8 @@ choice LV_COLOR_DEPTH
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 @@ -68,3 +78,8 @@ config INPUT
config REGULATOR
default y
depends on DT_HAS_REGULATOR_FIXED_ENABLED

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
6 changes: 6 additions & 0 deletions boards/shields/rpi_pico_lcd/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Copyright (c) 2023-2024 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

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_240x135.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_135x240: st7789v@0 {
compatible = "sitronix,st7789v";
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;

status = "disabled";

width = <135>; /* portrait */
height = <240>; /* portrait */
x-offset = <52>; /* portrait */
y-offset = <40>; /* portrait */

vcom = <0x3d>;
gctrl = <0x75>;
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 = [70 04 08 09 09 05 2A 33 41 07 13 13 29 2F];
nvgam-param = [70 03 09 0A 09 06 2B 34 41 07 12 14 28 2E];
ram-param = [00 F0];
rgb-param = [CD 08 14];
};
};

lcd_panel: &st7789v_135x240 {};
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_135x240 {
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_135x240 {
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_135x240 {
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_240x135: 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>; /* landscape */
height = <135>; /* landscape */
x-offset = <40>; /* landscape */
y-offset = <53>; /* landscape */

vcom = <0x3d>;
gctrl = <0x75>;
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 = [70 04 08 09 09 05 2A 33 41 07 13 13 29 2F];
nvgam-param = [70 03 09 0A 09 06 2B 34 41 07 12 14 28 2E];
ram-param = [00 F0];
rgb-param = [CD 08 14];
};
};

lcd_panel: &st7789v_240x135 {};
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_240x135 {
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_240x135 {
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_240x135 {
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 */
};
Loading
Loading