Skip to content

Commit

Permalink
Migrate to NCS SDK v2.5.0 (#107)
Browse files Browse the repository at this point in the history
* NCS v2.5.0

* no partition for non ZS hardware

* partition for dk

* PR feedback

* here we go

* fix partitions

* Use NCS Partition manager to put settings in external flash.

* lvgl patch ad NCS 2.5 does not include a patch for touch input which causes accidental presses.

---------

Co-authored-by: Jakob Krantz <[email protected]>
  • Loading branch information
ldab and jakkra authored Nov 16, 2023
1 parent 8f49403 commit 1c901bd
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ build*
/tools
/zephyr
__pycache__
/nrf
/nrfxlib
/test

/.vscode
6 changes: 6 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ if(ZSWATCH_BOARD)
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition.yml)
set(OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/boards/dfu.conf)
set(mcuboot_DTC_OVERLAY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/overlays/mcuboot.overlay)
else()
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_zs.yml)
endif()
endif()

if("nrf5340dk_nrf5340_cpuapp" STREQUAL "${BOARD}")
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/partition_zs.yml)
endif()

set(BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(ZSWatchFW)
Expand Down
6 changes: 5 additions & 1 deletion app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_LV_Z_USE_FILESYSTEM=y
CONFIG_LV_IMG_CACHE_DEF_SIZE=10

CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=16384
CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=16384

CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL=y
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x100000
Empty file.
5 changes: 4 additions & 1 deletion app/boards/nrf5340dk_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_LV_Z_USE_FILESYSTEM=y
CONFIG_LV_IMG_CACHE_DEF_SIZE=10

CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=16384
CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=16384

CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL=y
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x100000
1 change: 1 addition & 0 deletions app/boards/nrf5340dk_nrf5340_cpuapp.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
chosen {
zephyr,display = &gc9a01;
zephyr,keyboard-scan = &cst816s;
nordic,pm-ext-flash = &mx25r64;
};

aliases {
Expand Down
15 changes: 15 additions & 0 deletions app/partition_zs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#-------------------
# External partition
# ------------------
lvgl_lfs_partition:
address: 0x0
region: external_flash
size: 0x200000
lvgl_raw_partition:
address: 0x200000
region: external_flash
size: 0x200000
settings_partition:
address: 0x400000
region: external_flash
size: 0x100000
35 changes: 35 additions & 0 deletions app/patches/lvgl_scroll_click.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/modules/lvgl/input/lvgl_common_input.c b/modules/lvgl/input/lvgl_common_input.c
index 23b61a230e..9e2cfb5019 100644
--- a/modules/lvgl/input/lvgl_common_input.c
+++ b/modules/lvgl/input/lvgl_common_input.c
@@ -15,7 +15,18 @@ static void lvgl_input_read_cb(lv_indev_drv_t *drv, lv_indev_data_t *data)
{
const struct device *dev = drv->user_data;
const struct lvgl_common_input_config *cfg = dev->config;
+ struct lvgl_common_input_data *common_data = dev->data;
+
+ if (k_msgq_get(cfg->event_msgq, data, K_NO_WAIT) != 0) {
+ memcpy(data, &common_data->previous_event, sizeof(lv_indev_data_t));
+ if (drv->type == LV_INDEV_TYPE_ENCODER) {
+ data->enc_diff = 0; /* For encoders, clear last movement */
+ }
+ data->continue_reading = false;
+ return;
+ }

+ memcpy(&common_data->previous_event, data, sizeof(lv_indev_data_t));
k_msgq_get(cfg->event_msgq, data, K_NO_WAIT);
data->continue_reading = k_msgq_num_used_get(cfg->event_msgq) > 0;
}
diff --git a/modules/lvgl/input/lvgl_common_input.h b/modules/lvgl/input/lvgl_common_input.h
index e9d0ef34f8..2c1b2bd9a5 100644
--- a/modules/lvgl/input/lvgl_common_input.h
+++ b/modules/lvgl/input/lvgl_common_input.h
@@ -23,6 +23,7 @@ struct lvgl_common_input_data {
lv_indev_drv_t indev_drv;
lv_indev_t *indev;
lv_indev_data_t pending_event;
+ lv_indev_data_t previous_event;
};

int lvgl_input_register_driver(lv_indev_type_t indev_type, const struct device *dev);
2 changes: 2 additions & 0 deletions app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ static void on_zbus_ble_data_callback(const struct zbus_channel *chan)
}
}

#ifndef CONFIG_RESET_ON_FATAL_ERROR
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
{
ARG_UNUSED(esf);
Expand All @@ -617,3 +618,4 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)

CODE_UNREACHABLE;
}
#endif
14 changes: 8 additions & 6 deletions app/west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ manifest:
west-commands: scripts/west-commands.yml

remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
- name: sdk
url-base: https://github.com/nrfconnect

projects:
- name: zephyr
remote: zephyrproject-rtos
revision: 2ea2d37d60ada33bdf051eb9d699f4db9123c3ff
- name: sdk-nrf
remote: sdk
revision: v2.5.0
path: nrf
import:
name-blocklist:
- ci-tools
Expand All @@ -24,9 +25,10 @@ manifest:
- hal_ti
- loramac-node
- net-tools
- openthread
- edtt
- trusted-firmware-m
- sof
clone-depth: 1

self:
west-commands: scripts/west-commands.yml
20 changes: 0 additions & 20 deletions app/zephyr/module.yml

This file was deleted.

0 comments on commit 1c901bd

Please sign in to comment.