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

The PicoBoy Color as additional board variant #299

Merged
merged 8 commits into from
Feb 11, 2025
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
85 changes: 54 additions & 31 deletions boards/jsed/picoboy/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# Copyright (c) 2023-2024 TiaC Systems
# Copyright (c) 2023-2025 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config BOARD_PICOBOY_RP2040
bool
default y if BOARD_PICOBOY
default n

config RP2_FLASH_W25Q080
default y
depends on BOARD_PICOBOY_RP2040
depends on BOARD_PICOBOY

config CLOCK_CONTROL
default y
Expand All @@ -19,69 +14,97 @@ config RESET
default y
depends on DT_HAS_RASPBERRYPI_PICO_RESET_ENABLED

config WATCHDOG
default y
depends on DT_HAS_RASPBERRYPI_PICO_WATCHDOG_ENABLED

config DMA
default y
depends on DT_HAS_RASPBERRYPI_PICO_DMA_ENABLED

config GPIO
default y
depends on DT_HAS_RASPBERRYPI_PICO_GPIO_ENABLED

config PWM
default y
depends on DT_HAS_RASPBERRYPI_PICO_PWM_ENABLED

config REGULATOR
default y
depends on DT_HAS_REGULATOR_FIXED_ENABLED

config WDT_DISABLE_AT_BOOT
default y
depends on HAS_WDT_DISABLE_AT_BOOT

config I2C_DW_CLOCK_SPEED
default 125
depends on I2C_DW && BOARD_PICOBOY_RP2040
depends on I2C_DW && BOARD_PICOBOY

choice ST7789V_PIXEL_FORMAT
default ST7789V_RGB565 if BOARD_PICOBOY_RP2040_COLOR
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040_COLOR
endchoice

config LV_Z_VDB_SIZE
default 64
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default 64 if BOARD_PICOBOY_RP2040
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040

config LV_DPI_DEF
default 116 if BOARD_PICOBOY
default 148
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default 116 if BOARD_PICOBOY_RP2040
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040

config LV_Z_BITS_PER_PIXEL
default 1 if BOARD_PICOBOY
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default 1 if BOARD_PICOBOY_RP2040
default 16 if BOARD_PICOBOY_RP2040_COLOR
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040

choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1 if BOARD_PICOBOY
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default LV_COLOR_DEPTH_1 if BOARD_PICOBOY_RP2040
default LV_COLOR_DEPTH_16 if BOARD_PICOBOY_RP2040_COLOR
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040
endchoice

config LV_COLOR_16_SWAP
default y if BOARD_PICOBOY_RP2040_COLOR
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040_COLOR

config LV_FONT_MONTSERRAT_8
default y if BOARD_PICOBOY
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default y if BOARD_PICOBOY_RP2040
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040

config LV_FONT_MONTSERRAT_10
default y if BOARD_PICOBOY
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default y if BOARD_PICOBOY_RP2040
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040

config LV_FONT_MONTSERRAT_12
default y if BOARD_PICOBOY
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default y if BOARD_PICOBOY_RP2040
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040

config LV_FONT_MONTSERRAT_14
default y if BOARD_PICOBOY
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
default y if BOARD_PICOBOY_RP2040
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040

choice LV_FONT_DEFAULT
default LV_FONT_DEFAULT_MONTSERRAT_10 if !LV_CONF_MINIMAL
default LV_FONT_DEFAULT_UNSCII_8 if LV_CONF_MINIMAL
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
depends on DISPLAY && LVGL && BOARD_PICOBOY_RP2040
endchoice

config INPUT
default y if DT_HAS_ZEPHYR_LVGL_BUTTON_INPUT_ENABLED
default y if DT_HAS_ZEPHYR_LVGL_KEYPAD_INPUT_ENABLED
depends on BOARD_PICOBOY_RP2040 && DISPLAY && LVGL
depends on DISPLAY && LVGL && BOARD_PICOBOY

config USB_SELF_POWERED
default n
depends on USB_DEVICE_STACK && BOARD_PICOBOY_RP2040
depends on USB_DEVICE_STACK && BOARD_PICOBOY

config USB_MAX_POWER
default 125 if BOARD_PICOBOY # 250mA
depends on USB_DEVICE_STACK && BOARD_PICOBOY_RP2040
default 125 if BOARD_PICOBOY_RP2040 # 250mA
default 125 if BOARD_PICOBOY_RP2040_COLOR # 250mA
depends on USB_DEVICE_STACK && BOARD_PICOBOY

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CONSOLE := zephyr,console
Expand All @@ -92,7 +115,7 @@ DT_COMPAT_RPIPICO_USB := raspberrypi,pico-usbd
DT_CHOSEN_CONSOLE_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CONSOLE))
DT_CHOSEN_CONSOLE_PARENT := $(dt_node_parent,$(DT_CHOSEN_CONSOLE_NODE))

if BOARD_PICOBOY_RP2040 && \
if BOARD_PICOBOY && \
$(dt_chosen_enabled,$(DT_CHOSEN_Z_CONSOLE)) && \
$(dt_compat_on_bus,$(DT_COMPAT_Z_CDC_ACM_UART),usb) && \
$(dt_node_has_compat,$(DT_CHOSEN_CONSOLE_PARENT),$(DT_COMPAT_RPIPICO_USB))
Expand Down
2 changes: 1 addition & 1 deletion boards/jsed/picoboy/Kconfig.picoboy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 TiaC Systems
# Copyright (c) 2023-2025 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config BOARD_PICOBOY
Expand Down
17 changes: 16 additions & 1 deletion boards/jsed/picoboy/board.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Copyright (c) 2023-2024 TiaC Systems
# Copyright (c) 2023-2025 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

if("${NORMALIZED_BOARD_TARGET}" STREQUAL "picoboy_rp2040")
set(BOARD_FULL_NAME "The PicoBoy Mini-Handheld")
elseif("${NORMALIZED_BOARD_TARGET}" STREQUAL "picoboy_rp2040_color")
set(BOARD_FULL_NAME "The PicoBoy Color (PBC) Mini-Handheld")
else()
message(FATAL_ERROR "Unsupported board variant: "
"'${BOARD}${BOARD_QUALIFIERS}'\n")
endif()

message(NOTICE "\n"
"\t---------------------------------------------------------------------\n"
"\t--- Build for: '${BOARD_FULL_NAME}'\n"
"\t---------------------------------------------------------------------\n"
)

board_runner_args(uf2 "--board-id=RPI-RP2")
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
3 changes: 3 additions & 0 deletions boards/jsed/picoboy/board.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
boards:
- name: picoboy
full_name: The PicoBoy
vendor: jsed
socs:
- name: rp2040
variants:
- name: "color"
83 changes: 83 additions & 0 deletions boards/jsed/picoboy/color-joystick.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2024-2025 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

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

/ {
aliases {
sw0 = &button_back;
sw1 = &button_forward;
sw2 = &joystick_enter;
sw3 = &joystick_up;
sw4 = &joystick_right;
sw5 = &joystick_down;
sw6 = &joystick_left;
};

lvgl_buttons: lvgl-buttons {
compatible = "zephyr,lvgl-button-input";
input = <&gpio_keys>;
input-codes = <INPUT_KEY_FORWARD>;
coordinates = <120 140>;
};

lvgl_keypad: lvgl-keypad {
compatible = "zephyr,lvgl-keypad-input";
input = <&gpio_keys>;
input-codes = <INPUT_KEY_LEFT INPUT_KEY_RIGHT
INPUT_KEY_UP INPUT_KEY_DOWN
INPUT_KEY_ENTER>;
lvgl-codes = <LV_KEY_LEFT LV_KEY_RIGHT
LV_KEY_UP LV_KEY_DOWN
LV_KEY_ENTER>;
};

gpio_keys: gpio_keys {
compatible = "gpio-keys";
status = "okay";

button_back: button_back {
gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_BACK>;
label = "User button BACK";
};
button_forward: button_forward {
gpios = <&gpio0 28 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_FORWARD>;
label = "User button FORWARD";
};
joystick_enter: joystick_enter {
gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
label = "User joystick ENTER";
};
joystick_up: joystick_up {
gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_UP>;
label = "User joystick UP";
};
joystick_right: joystick_right {
gpios = <&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_RIGHT>;
label = "User joystick RIGHT";
};
joystick_down: joystick_down {
gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_DOWN>;
label = "User joystick DOWN";
};
joystick_left: joystick_left {
gpios = <&gpio0 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_LEFT>;
label = "User joystick LEFT";
};
};
};

&gpio0 {
status = "okay";
};
80 changes: 80 additions & 0 deletions boards/jsed/picoboy/color-lcd.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2024-2025 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

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

/ {
chosen {
zephyr,display = &lcd_panel;
};

lcd_backlight_en: lcd_backlight_en {
compatible = "regulator-fixed";
enable-gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
regulator-name = "lcd_backlight_enable";
regulator-boot-on;
};

mipi_dbi_spi0: mipi_dbi_spi0 {
compatible = "zephyr,mipi-dbi-spi";
status = "okay";

reset-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
spi-dev = <&spi0>;
write-only;

#address-cells = <1>;
#size-cells = <0>;

/* LCD with ST7789V controller. */
st7789v_240x280: st7789v@0 {
compatible = "sitronix,st7789v";
status = "okay";

reg = <0>;
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";

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

vcom = <0x1f>;
gctrl = <0x35>;
vrhs = <0x12>;
vdvs = <0x20>;
// mdac = <0x00>; /* portrait */
// mdac = <0x40>; /* portrait, mirrored */
mdac = <0xC0>; /* portrait, overhead */
// mdac = <0x80>; /* portrait, upsidedown */
colmod = <0x05>; /* 16-bit, RGB565 */
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_240x280 {};

&spi0 {
status = "okay";

clock-frequency = <DT_FREQ_M(20)>;
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
};

&gpio0 {
status = "okay";
};
Loading