Skip to content
Open
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
81 changes: 81 additions & 0 deletions samples/subsys/display/lvgl/boards/nrf52840dk_nrf52840.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright 2025 Picodev
# SPDX-License-Identifier: Apache-2.0

# Enable SPI support
CONFIG_SPI=y
# Enable LVGL graphics library
CONFIG_LVGL=y
# Enable GPIO driver support
CONFIG_GPIO=y

# Enable MIPI DBI over SPI
CONFIG_MIPI_DBI_SPI=y

# Peripheral initialization priority
CONFIG_DISPLAY_INIT_PRIORITY=90

# Enable ILI9341 display controller driver
CONFIG_ILI9341=y


### Console and logging support ###

# Use UART for console
CONFIG_CONSOLE=y
# Enable serial driver support
CONFIG_UART_CONSOLE=y
# Enable logging subsystem
CONFIG_SERIAL=y
# Enable printk() support
CONFIG_LOG=y
# Disable Zephyr shell
CONFIG_PRINTK=y
# Main thread stack size (bytes)
CONFIG_SHELL=n
# System workqueue stack size (bytes)
CONFIG_MAIN_STACK_SIZE=8192
# Heap memory pool size (bytes)
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192

# Enable display subsystem
CONFIG_HEAP_MEM_POOL_SIZE=16384
# Allow writing to flash (for updates, etc.)

# Use newlib C library
CONFIG_DISPLAY=y

### LVGL configuration ###

# LVGL memory pool size (bytes)
CONFIG_MPU_ALLOW_FLASH_WRITE=y
# Use newlib C library
CONFIG_NEWLIB_LIBC=y
# Enable LVGL logging
CONFIG_LV_USE_LOG=y
CONFIG_LV_USE_BUTTON=y
# Set LVGL memory pool size to 16KB
CONFIG_LV_Z_MEM_POOL_SIZE=16384

CONFIG_LV_USE_ILI9341=y


# Enable arc widget
CONFIG_LV_USE_ARC=y
# Enable Label widget
CONFIG_LV_USE_LABEL=y
# Enable Montserrat 14pt font
CONFIG_LV_FONT_MONTSERRAT_14=y
# Enable Montserrat 40pt font
CONFIG_LV_FONT_MONTSERRAT_40=y

CONFIG_LV_USE_TFT_ESPI=y
CONFIG_LV_BUILD_EXAMPLES=n

## Enables system monitor and on screen performance monitor widgets
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_SYSMON=y


## ADC and touchscreen support
CONFIG_INPUT=y
CONFIG_ADC=y
112 changes: 112 additions & 0 deletions samples/subsys/display/lvgl/boards/nrf52840dk_nrf52840.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* Copyright (c) 2025, Picodev
*
* SPDX-License-Identifier: Apache-2.0
*/

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

mipi_dbi_spi: mipi_dbi_spi {
compatible = "zephyr,mipi-dbi-spi";
dc-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; // DC/RS pin (P1.11)
reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; // RESET pin (P1.10)

write-only;
#address-cells = <1>;
#size-cells = <0>;
spi-dev = <&spi1>;

ili9341: ili9341@0 {
compatible = "ilitek,ili9341";
reg = <0>;
mipi-max-frequency = <8000000>;
width = <240>;
height = <320>;
rotation = <0>;
pixel-format = <1>; // 0: RGB565, 1: RGB888

};
};
};

&spi1 {
status = "okay";
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
};

&spi3 {
status = "disabled";
};

&spi2 {
status = "disabled";
};

&pinctrl {
spi1_default: spi1_default {

group3 {
psels = <NRF_PSEL(SPIM_MISO, 1, 14)>,
<NRF_PSEL(SPIM_MOSI, 1, 13)>,
<NRF_PSEL(SPIM_SCK, 1, 15)>;
nordic,drive-mode = <NRF_DRIVE_H0H1>;
};
};

spi1_sleep: spi1_sleep {
group1 {
// Sleep configuration (same pins, low-power mode)
psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
<NRF_PSEL(SPIM_MOSI, 1, 13)>,
<NRF_PSEL(SPIM_MISO, 1, 14)>;
};
};
};

&adc {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN1>; /* P0.03 Y+ */
zephyr,resolution = <12>;
};

channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN2>; /* P0.04 X- */
zephyr,resolution = <12>;
};

channel@4 {
reg = <4>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN4>; /* P0.28 X+ */
zephyr,resolution = <12>;
};

channel@5 {
reg = <5>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN5>; /* P0.29 Y- */
zephyr,resolution = <12>;
};
};


Loading