From 159fff1daa685b297dae9ae6444740cb7be14b16 Mon Sep 17 00:00:00 2001 From: Allister MacLeod Date: Sat, 3 Aug 2024 19:22:03 -0400 Subject: [PATCH 1/6] Trying an extremely simple module YAML to see what happens. --- zephyr/module.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 zephyr/module.yml diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 00000000..370e48f5 --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,2 @@ +--- +name: zephyr-config From 2c0ef29ec2f9ff14e24b6da0d817e3e42db5d285 Mon Sep 17 00:00:00 2001 From: Allister MacLeod Date: Sat, 3 Aug 2024 20:44:58 -0400 Subject: [PATCH 2/6] Adding build settings to module.yml Much like a hitchhiker and their towel, a module with boards or shields in it needs to know where its board_root is. --- zephyr/module.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zephyr/module.yml b/zephyr/module.yml index 370e48f5..6cce9761 100644 --- a/zephyr/module.yml +++ b/zephyr/module.yml @@ -1,2 +1,5 @@ --- name: zephyr-config +build: + settings: + board_root: . From 44037de591ad1c175237043facd874df07b781f8 Mon Sep 17 00:00:00 2001 From: Allister MacLeod Date: Sat, 3 Aug 2024 21:04:12 -0400 Subject: [PATCH 3/6] Adding a little README showing how to use the config as a module. --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..789da78f --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +Zaphod and Zaphod Lite ZMK Config +================================= + +This configuration may be used independently as a ZMK config as +described in https://zmk.dev/docs/development/build-flash#building-from-zmk-config-folder +or it can be included as a module. + +Using This Config as a Module +----------------------------- + +Add this repository to your `config/west.yml` in the `remotes` and +`projects` sections, adding the following snippets alongside the +entries that are already there. + +```yaml + remotes: + - name: zaphod + url-base: https://github.com/petejohanson + projects: + - name: zaphod-config + remote: zaphod + revision: main +``` From e4cc038b1f65a7a800fc0b14b33f2f2d1b8d0c8c Mon Sep 17 00:00:00 2001 From: Allister MacLeod Date: Sat, 3 Aug 2024 22:50:42 -0400 Subject: [PATCH 4/6] Fix thinko: zephyr-config to zaphod-config I definitely meant for it to be zaphod-config in the first place. Co-authored-by: Pete Johanson --- zephyr/module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zephyr/module.yml b/zephyr/module.yml index 6cce9761..c82e1652 100644 --- a/zephyr/module.yml +++ b/zephyr/module.yml @@ -1,5 +1,5 @@ --- -name: zephyr-config +name: zaphod-config build: settings: board_root: . From 55251ce5057d5bdbc043da0151a217bee5599438 Mon Sep 17 00:00:00 2001 From: Allister MacLeod Date: Tue, 24 Sep 2024 13:19:56 -0400 Subject: [PATCH 5/6] Fixing Zaphod Bongo Cat for LVGL 8.3 and Zephyr 3.5.0, and to work as a module. (#2) * Copying ZAPHOD_BONGO_CAT config declaration into Kconfig.shield, duplicating what is in plain Kconfig. * Updating include directories for Zephyr stuff: kernel.h and logging/log.h * Trying to build things up one step at a time. * Fix module name. * Selecting LV_USE_IMG when ZMK_DISPLAY is enabled on zaphod_lite. * In newer versions of Zephyr, the logging header is under a zephyr directory. * Change LVGL to LV in config selections. * Update Bongo Cat widget for LVGL 8.3 - there is no longer a `lv_anim_value_t` typedef, but `int32_t` works for indexing images in animator functions. - `lv_image_create` only takes one parameter now: the parent object. - `lv_img_set_auto_size` no longer exists. * Minor whitespace cleanup. * Setting width and height to LV_SIZE_CONTENT for auto-sizing. I think the object might already be auto-sized by default, but it can't hurt to be explicit about it. * Removing LV_USE_IMG from defconfig since it is in the main Kconfig Images and animation are only needed by this shield if the Bongo Cat WPM widget is enabled. That selection is handled in boards/shields/zaphod_lite/Kconfig itself. * Reverting Kconfig.shield changes. The configurations in plain Kconfig ought to be sufficient. * Revert "Reverting Kconfig.shield changes." This reverts commit 9c7761dd06c9b05b76e8b08ed9ddc75ca6f4c90e. * Repeating LVGL -> LV correction in Kconfig.shield --- boards/shields/zaphod_lite/Kconfig | 7 +++---- boards/shields/zaphod_lite/Kconfig.shield | 21 +++++++++++++++++++ .../zaphod_lite/zaphod_bongo_cat_widget.c | 10 ++++----- .../zaphod_lite/zaphod_bongo_cat_widget.h | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/boards/shields/zaphod_lite/Kconfig b/boards/shields/zaphod_lite/Kconfig index 0a54be82..16182210 100644 --- a/boards/shields/zaphod_lite/Kconfig +++ b/boards/shields/zaphod_lite/Kconfig @@ -5,8 +5,8 @@ if ZMK_DISPLAY menuconfig ZAPHOD_BONGO_CAT bool "Show WPM bongo cat" select ZMK_WPM - select LVGL_USE_IMG - select LVGL_USE_ANIMATION + select LV_USE_IMG + select LV_USE_ANIMATION if ZAPHOD_BONGO_CAT @@ -20,5 +20,4 @@ config ZAPHOD_BONGO_CAT_SLOW_LIMIT endif # ZAPHOD_BONGO_CAT - -endif +endif # ZMK_DISPLAY diff --git a/boards/shields/zaphod_lite/Kconfig.shield b/boards/shields/zaphod_lite/Kconfig.shield index 3ebcf0c4..4395a8cf 100644 --- a/boards/shields/zaphod_lite/Kconfig.shield +++ b/boards/shields/zaphod_lite/Kconfig.shield @@ -4,3 +4,24 @@ config SHIELD_ZAPHOD_LITE def_bool $(shields_list_contains,zaphod_lite) +if ZMK_DISPLAY + +menuconfig ZAPHOD_BONGO_CAT + bool "Show WPM bongo cat" + select ZMK_WPM + select LV_USE_IMG + select LV_USE_ANIMATION + +if ZAPHOD_BONGO_CAT + +config ZAPHOD_BONGO_CAT_IDLE_LIMIT + int "Upper limit for WPM for showing idle animation" + default 30 + +config ZAPHOD_BONGO_CAT_SLOW_LIMIT + int "Upper limit for WPM for showing slow typing image" + default 60 + +endif # ZAPHOD_BONGO_CAT + +endif # ZMK_DISPLAY diff --git a/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.c b/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.c index acff90c6..719bc7cb 100644 --- a/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.c +++ b/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.c @@ -7,7 +7,7 @@ #include #include -#include +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include "zaphod_bongo_cat_widget.h" @@ -48,7 +48,7 @@ const void* fast_images[] = { &fast_img2, }; -void set_img_src(void *var, lv_anim_value_t val) { +void set_img_src(void *var, int32_t val) { lv_obj_t *img = (lv_obj_t *)var; lv_img_set_src(img, images[val]); } @@ -95,10 +95,10 @@ void state_widget_wpm(struct zaphod_bongo_cat_widget *widget, int wpm) { } int zaphod_bongo_cat_widget_init(struct zaphod_bongo_cat_widget *widget, lv_obj_t *parent) { - widget->obj = lv_img_create(parent, NULL); - + widget->obj = lv_img_create(parent); - lv_img_set_auto_size(widget->obj, true); + lv_obj_set_width(widget->obj, LV_SIZE_CONTENT); + lv_obj_set_height(widget->obj, LV_SIZE_CONTENT); state_widget_wpm(widget, 0); sys_slist_append(&widgets, &widget->node); diff --git a/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.h b/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.h index b46150f3..f752c3b0 100644 --- a/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.h +++ b/boards/shields/zaphod_lite/zaphod_bongo_cat_widget.h @@ -6,7 +6,7 @@ #include -#include +#include struct zaphod_bongo_cat_widget { sys_snode_t node; From 15b7b4665c2d47a3b8a1666010e5c499ac1236d1 Mon Sep 17 00:00:00 2001 From: Allister MacLeod Date: Tue, 24 Sep 2024 13:46:05 -0400 Subject: [PATCH 6/6] Use zmkfirmware/zmk standard GitHub Actions workflow. --- .github/workflows/build.yml | 56 ++----------------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0539fe7d..505e4bb3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,58 +1,6 @@ -on: [push, pull_request, create, workflow_dispatch] +on: [push, pull_request, workflow_dispatch] -name: Build jobs: build: - runs-on: ubuntu-latest - container: - image: zmkfirmware/zmk-build-arm:stable - name: Build Test - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - path: config/ - - name: Cache west modules - uses: actions/cache@v2 - env: - cache-name: cache-zephyr-modules - with: - path: | - modules/ - tools/ - zephyr/ - bootloader/ - zmk/ - key: ${{ runner.os }}-build-v2-${{ env.cache-name }}-${{ hashFiles('manifest-dir/west.yml') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - name: Initialize workspace (west init) - run: west init -l config - - name: Update modules (west update) - run: west update - - name: Export zephyr CMake package (west zephyr-export) - run: west zephyr-export - - name: List modules (west list) - run: west list - - name: Build Zaphod (west build) - run: west build -s zmk/app -b zaphod -d build/zaphod -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" - - name: Build Zaphod Lite w/ Seeeduino XIAO (west build) - run: west build -s zmk/app -b seeeduino_xiao -d build/zaphod_lite_xiao -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" -DSHIELD=zaphod_lite - - name: Build Zaphod Lite w/ Seeeduino XIAO BLE (west build) - run: west build -s zmk/app -b seeeduino_xiao_ble -d build/zaphod_lite_xiao_ble -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" -DSHIELD=zaphod_lite - - name: Zaphod .config - if: ${{ always() }} - run: cat -n build/zaphod/zephyr/.config - - name: Rename zmk.uf2 - run: | - cp build/zaphod/zephyr/zmk.uf2 zaphod.uf2 - cp build/zaphod_lite_xiao/zephyr/zmk.uf2 seeeduino_xiao_zaphod_lite.uf2 - cp build/zaphod_lite_xiao_ble/zephyr/zmk.uf2 seeeduino_xiao_ble_zaphod_lite.uf2 - - name: Archive - uses: actions/upload-artifact@v2 - with: - name: firmware - path: '*.uf2' + uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main