diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5b69e180..4ac253f1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/zmkfirmware/zmk-dev-arm:3.2 +FROM docker.io/zmkfirmware/zmk-dev-arm:3.5-branch COPY .bashrc tmp RUN mv /tmp/.bashrc ~/.bashrc diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82b156e1..a0475627 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: if: ${{ always() }} runs-on: ubuntu-latest container: - image: docker.io/zmkfirmware/zmk-build-arm:3.2 + image: docker.io/zmkfirmware/zmk-build-arm:3.5-branch needs: compile-matrix strategy: matrix: diff --git a/.github/workflows/hardware-metadata-validation.yml b/.github/workflows/hardware-metadata-validation.yml index 10092836..98ffb962 100644 --- a/.github/workflows/hardware-metadata-validation.yml +++ b/.github/workflows/hardware-metadata-validation.yml @@ -18,7 +18,7 @@ jobs: validate-metadata: runs-on: ubuntu-latest container: - image: docker.io/zmkfirmware/zmk-dev-arm:3.2 + image: docker.io/zmkfirmware/zmk-dev-arm:3.5-branch steps: - uses: actions/checkout@v3 - name: Install dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8a9d220..6c9054f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: test: ${{ fromJSON(needs.collect-tests.outputs.test-dirs) }} runs-on: ubuntu-latest container: - image: docker.io/zmkfirmware/zmk-build-arm:3.2 + image: docker.io/zmkfirmware/zmk-build-arm:3.5-branch steps: - name: Checkout uses: actions/checkout@v3 diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 0891364b..8a43cfb4 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -17,6 +17,9 @@ project(zmk) zephyr_linker_sources(RODATA include/linker/zmk-events.ld) +zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/behavior.h) +zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/ext_power.h) + # Add your source file to the "app" target. This must come after # find_package(Zephyr) which defines the target. target_include_directories(app PRIVATE include) diff --git a/app/Kconfig b/app/Kconfig index f92f0ae3..b561bda3 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -131,11 +131,6 @@ if ZMK_BLE config BT_TINYCRYPT_ECC default y if BT_HCI && !BT_CTLR -choice BT_LL_SW_LLCP_IMPL - default BT_LL_SW_LLCP_LEGACY - -endchoice - config SYSTEM_WORKQUEUE_STACK_SIZE default 4096 if SOC_RP2040 default 2048 @@ -342,13 +337,12 @@ config ZMK_IDLE_TIMEOUT config ZMK_SLEEP bool "Enable deep sleep support" + depends on HAS_POWEROFF + select POWEROFF imply USB if ZMK_SLEEP -config PM_DEVICE - default y - config ZMK_IDLE_SLEEP_TIMEOUT int "Milliseconds of inactivity before entering deep sleep" default 900000 diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig b/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig index 53bc0e11..6b6c8a48 100644 --- a/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1_defconfig @@ -5,9 +5,6 @@ CONFIG_SOC_STM32F303XC=y # 72MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 -# enable pinmux -CONFIG_PINMUX=y - # enable GPIO CONFIG_GPIO=y diff --git a/app/boards/arm/ferris/ferris_rev02_defconfig b/app/boards/arm/ferris/ferris_rev02_defconfig index 267035c9..bd03c305 100644 --- a/app/boards/arm/ferris/ferris_rev02_defconfig +++ b/app/boards/arm/ferris/ferris_rev02_defconfig @@ -6,7 +6,7 @@ CONFIG_SOC_STM32F072XB=y # 48MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000 -# enable PINMUX +# enable PINCTRL CONFIG_PINCTRL=y # enable GPIO diff --git a/app/boards/arm/mikoto/CMakeLists.txt b/app/boards/arm/mikoto/CMakeLists.txt index 12cf9b1c..05214a68 100644 --- a/app/boards/arm/mikoto/CMakeLists.txt +++ b/app/boards/arm/mikoto/CMakeLists.txt @@ -1,6 +1,3 @@ - -if(CONFIG_PINMUX) zephyr_library() zephyr_library_sources(pinmux.c) -zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) -endif() \ No newline at end of file +zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) \ No newline at end of file diff --git a/app/boards/arm/mikoto/Kconfig.defconfig b/app/boards/arm/mikoto/Kconfig.defconfig index 8117cc87..5702c6de 100644 --- a/app/boards/arm/mikoto/Kconfig.defconfig +++ b/app/boards/arm/mikoto/Kconfig.defconfig @@ -21,9 +21,6 @@ endif # USB config BT_CTLR default BT -config PINMUX - default y - choice BOARD_MIKOTO_CHARGER_CURRENT default BOARD_MIKOTO_CHARGER_CURRENT_100MA endchoice diff --git a/app/boards/arm/mikoto/pinmux.c b/app/boards/arm/mikoto/pinmux.c index 524aa17e..c34c2dc8 100644 --- a/app/boards/arm/mikoto/pinmux.c +++ b/app/boards/arm/mikoto/pinmux.c @@ -11,8 +11,7 @@ #include #include -static int pinmux_mikoto_init(const struct device *port) { - ARG_UNUSED(port); +static int pinmux_mikoto_init(void) { #if CONFIG_BOARD_MIKOTO_520 const struct device *p0 = DEVICE_DT_GET(DT_NODELABEL(gpio0)); diff --git a/app/boards/arm/nrfmicro/CMakeLists.txt b/app/boards/arm/nrfmicro/CMakeLists.txt index 12cf9b1c..05214a68 100644 --- a/app/boards/arm/nrfmicro/CMakeLists.txt +++ b/app/boards/arm/nrfmicro/CMakeLists.txt @@ -1,6 +1,3 @@ - -if(CONFIG_PINMUX) zephyr_library() zephyr_library_sources(pinmux.c) -zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) -endif() \ No newline at end of file +zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) \ No newline at end of file diff --git a/app/boards/arm/nrfmicro/Kconfig.defconfig b/app/boards/arm/nrfmicro/Kconfig.defconfig index 659e9c5c..38daacde 100644 --- a/app/boards/arm/nrfmicro/Kconfig.defconfig +++ b/app/boards/arm/nrfmicro/Kconfig.defconfig @@ -18,9 +18,6 @@ endif # USB_DEVICE_STACK config BT_CTLR default BT -config PINMUX - default y - if BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833 config BOARD_NRFMICRO_CHARGER diff --git a/app/boards/arm/planck/planck_rev6_defconfig b/app/boards/arm/planck/planck_rev6_defconfig index 74050f3d..ce08f41d 100644 --- a/app/boards/arm/planck/planck_rev6_defconfig +++ b/app/boards/arm/planck/planck_rev6_defconfig @@ -5,9 +5,6 @@ CONFIG_SOC_STM32F303XC=y # 72MHz system clock CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 - -# enable pinmux -CONFIG_PINMUX=y CONFIG_PINCTRL=y # enable GPIO diff --git a/app/boards/arm/puchi_ble/CMakeLists.txt b/app/boards/arm/puchi_ble/CMakeLists.txt index 12cf9b1c..05214a68 100644 --- a/app/boards/arm/puchi_ble/CMakeLists.txt +++ b/app/boards/arm/puchi_ble/CMakeLists.txt @@ -1,6 +1,3 @@ - -if(CONFIG_PINMUX) zephyr_library() zephyr_library_sources(pinmux.c) -zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) -endif() \ No newline at end of file +zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) \ No newline at end of file diff --git a/app/boards/arm/puchi_ble/Kconfig.defconfig b/app/boards/arm/puchi_ble/Kconfig.defconfig index 3533104b..0ba7eefd 100644 --- a/app/boards/arm/puchi_ble/Kconfig.defconfig +++ b/app/boards/arm/puchi_ble/Kconfig.defconfig @@ -16,7 +16,4 @@ endif # USB_DEVICE_STACK config BT_CTLR default BT -config PINMUX - default y - endif # BOARD_PUCHI_BLE_v1 diff --git a/app/boards/shields/corne/Kconfig.defconfig b/app/boards/shields/corne/Kconfig.defconfig index 07dd07e9..27d50df3 100644 --- a/app/boards/shields/corne/Kconfig.defconfig +++ b/app/boards/shields/corne/Kconfig.defconfig @@ -21,9 +21,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -31,7 +28,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/corne/corne.dtsi b/app/boards/shields/corne/corne.dtsi index 0e9eddf9..ad5885b3 100644 --- a/app/boards/shields/corne/corne.dtsi +++ b/app/boards/shields/corne/corne.dtsi @@ -78,6 +78,7 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10 segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/elephant42/Kconfig.defconfig b/app/boards/shields/elephant42/Kconfig.defconfig index 70a312c1..dc10e980 100644 --- a/app/boards/shields/elephant42/Kconfig.defconfig +++ b/app/boards/shields/elephant42/Kconfig.defconfig @@ -24,9 +24,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -34,7 +31,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/elephant42/elephant42.dtsi b/app/boards/shields/elephant42/elephant42.dtsi index b0e9a32e..b5e25716 100644 --- a/app/boards/shields/elephant42/elephant42.dtsi +++ b/app/boards/shields/elephant42/elephant42.dtsi @@ -55,6 +55,7 @@ RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; \ No newline at end of file diff --git a/app/boards/shields/jorne/Kconfig.defconfig b/app/boards/shields/jorne/Kconfig.defconfig index 04beb792..ba332226 100644 --- a/app/boards/shields/jorne/Kconfig.defconfig +++ b/app/boards/shields/jorne/Kconfig.defconfig @@ -22,9 +22,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -32,7 +29,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/jorne/jorne.dtsi b/app/boards/shields/jorne/jorne.dtsi index 1d12b85c..d5760a27 100644 --- a/app/boards/shields/jorne/jorne.dtsi +++ b/app/boards/shields/jorne/jorne.dtsi @@ -94,6 +94,7 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10 segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/knob_goblin/Kconfig.defconfig b/app/boards/shields/knob_goblin/Kconfig.defconfig index d8d468ed..3f08e287 100644 --- a/app/boards/shields/knob_goblin/Kconfig.defconfig +++ b/app/boards/shields/knob_goblin/Kconfig.defconfig @@ -14,9 +14,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -24,7 +21,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/knob_goblin/knob_goblin.overlay b/app/boards/shields/knob_goblin/knob_goblin.overlay index 03051ce5..ad9fb15f 100644 --- a/app/boards/shields/knob_goblin/knob_goblin.overlay +++ b/app/boards/shields/knob_goblin/knob_goblin.overlay @@ -76,6 +76,7 @@ segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig index 2d162736..36e02963 100644 --- a/app/boards/shields/kyria/Kconfig.defconfig +++ b/app/boards/shields/kyria/Kconfig.defconfig @@ -22,9 +22,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -32,7 +29,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/kyria/kyria_common.dtsi b/app/boards/shields/kyria/kyria_common.dtsi index 1056794d..50950003 100644 --- a/app/boards/shields/kyria/kyria_common.dtsi +++ b/app/boards/shields/kyria/kyria_common.dtsi @@ -57,5 +57,6 @@ display-offset = <0>; multiplex-ratio = <63>; prechargep = <0x22>; + inversion-on; }; }; diff --git a/app/boards/shields/leeloo/Kconfig.defconfig b/app/boards/shields/leeloo/Kconfig.defconfig index 046bd49a..a3d95f63 100644 --- a/app/boards/shields/leeloo/Kconfig.defconfig +++ b/app/boards/shields/leeloo/Kconfig.defconfig @@ -34,9 +34,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -44,7 +41,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/leeloo/leeloo_common.dtsi b/app/boards/shields/leeloo/leeloo_common.dtsi index ef775cfb..e04617bf 100644 --- a/app/boards/shields/leeloo/leeloo_common.dtsi +++ b/app/boards/shields/leeloo/leeloo_common.dtsi @@ -87,6 +87,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/leeloo_micro/Kconfig.defconfig b/app/boards/shields/leeloo_micro/Kconfig.defconfig index 26256120..8af3214d 100644 --- a/app/boards/shields/leeloo_micro/Kconfig.defconfig +++ b/app/boards/shields/leeloo_micro/Kconfig.defconfig @@ -24,9 +24,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -34,7 +31,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/leeloo_micro/leeloo_micro.dtsi b/app/boards/shields/leeloo_micro/leeloo_micro.dtsi index ab68a615..9712ac0c 100644 --- a/app/boards/shields/leeloo_micro/leeloo_micro.dtsi +++ b/app/boards/shields/leeloo_micro/leeloo_micro.dtsi @@ -85,6 +85,7 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(3,4) RC(3,5) RC(2,5) RC(2,6) RC(2,7) segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; \ No newline at end of file diff --git a/app/boards/shields/lily58/Kconfig.defconfig b/app/boards/shields/lily58/Kconfig.defconfig index e77a9c22..169a6ad7 100644 --- a/app/boards/shields/lily58/Kconfig.defconfig +++ b/app/boards/shields/lily58/Kconfig.defconfig @@ -22,9 +22,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -32,7 +29,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/lily58/lily58.dtsi b/app/boards/shields/lily58/lily58.dtsi index eb427a58..234b65d4 100644 --- a/app/boards/shields/lily58/lily58.dtsi +++ b/app/boards/shields/lily58/lily58.dtsi @@ -77,6 +77,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/lotus58/Kconfig.defconfig b/app/boards/shields/lotus58/Kconfig.defconfig index 62695c20..984095c7 100644 --- a/app/boards/shields/lotus58/Kconfig.defconfig +++ b/app/boards/shields/lotus58/Kconfig.defconfig @@ -24,9 +24,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -34,7 +31,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/lotus58/lotus58.dtsi b/app/boards/shields/lotus58/lotus58.dtsi index 8b1c66f9..9e1f5e2c 100644 --- a/app/boards/shields/lotus58/lotus58.dtsi +++ b/app/boards/shields/lotus58/lotus58.dtsi @@ -86,6 +86,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7 segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/microdox/Kconfig.defconfig b/app/boards/shields/microdox/Kconfig.defconfig index e355c641..3737b83f 100644 --- a/app/boards/shields/microdox/Kconfig.defconfig +++ b/app/boards/shields/microdox/Kconfig.defconfig @@ -24,9 +24,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -34,7 +31,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/microdox/microdox_common.dtsi b/app/boards/shields/microdox/microdox_common.dtsi index 0460e012..ba522a18 100644 --- a/app/boards/shields/microdox/microdox_common.dtsi +++ b/app/boards/shields/microdox/microdox_common.dtsi @@ -46,6 +46,7 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) display-offset = <0>; multiplex-ratio = <31>; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/murphpad/Kconfig.defconfig b/app/boards/shields/murphpad/Kconfig.defconfig index 80e65351..9d80a139 100644 --- a/app/boards/shields/murphpad/Kconfig.defconfig +++ b/app/boards/shields/murphpad/Kconfig.defconfig @@ -14,9 +14,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -24,7 +21,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/murphpad/murphpad.overlay b/app/boards/shields/murphpad/murphpad.overlay index f175c55e..47825411 100644 --- a/app/boards/shields/murphpad/murphpad.overlay +++ b/app/boards/shields/murphpad/murphpad.overlay @@ -70,6 +70,7 @@ segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/nibble/Kconfig.defconfig b/app/boards/shields/nibble/Kconfig.defconfig index 19bddec7..3915ff0f 100644 --- a/app/boards/shields/nibble/Kconfig.defconfig +++ b/app/boards/shields/nibble/Kconfig.defconfig @@ -14,9 +14,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -24,7 +21,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/nibble/nibble.overlay b/app/boards/shields/nibble/nibble.overlay index 43be6c76..9078d16b 100644 --- a/app/boards/shields/nibble/nibble.overlay +++ b/app/boards/shields/nibble/nibble.overlay @@ -70,6 +70,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,6) RC(4,9) display-offset = <0>; multiplex-ratio = <31>; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/nice_view/Kconfig.defconfig b/app/boards/shields/nice_view/Kconfig.defconfig index 53edc1cc..c31cec89 100644 --- a/app/boards/shields/nice_view/Kconfig.defconfig +++ b/app/boards/shields/nice_view/Kconfig.defconfig @@ -6,7 +6,7 @@ if SHIELD_NICE_VIEW config LV_Z_VDB_SIZE default 100 -config LV_Z_DPI +config LV_DPI_DEF default 161 config LV_Z_BITS_PER_PIXEL @@ -24,6 +24,9 @@ choice ZMK_DISPLAY_STATUS_SCREEN default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM endchoice +config LV_Z_MEM_POOL_SIZE + default 4096 if ZMK_DISPLAY_STATUS_SCREEN_CUSTOM + config ZMK_DISPLAY_STATUS_SCREEN_CUSTOM imply NICE_VIEW_WIDGET_STATUS diff --git a/app/boards/shields/nice_view/widgets/status.c b/app/boards/shields/nice_view/widgets/status.c index 453fd650..419b5174 100644 --- a/app/boards/shields/nice_view/widgets/status.c +++ b/app/boards/shields/nice_view/widgets/status.c @@ -149,7 +149,7 @@ static void draw_middle(lv_obj_t *widget, lv_color_t cbuf[], const struct status for (int i = 0; i < 5; i++) { bool selected = i == state->active_profile_index; - lv_canvas_draw_arc(canvas, circle_offsets[i][0], circle_offsets[i][1], 13, 0, 359, + lv_canvas_draw_arc(canvas, circle_offsets[i][0], circle_offsets[i][1], 13, 0, 360, &arc_dsc); if (selected) { @@ -180,7 +180,7 @@ static void draw_bottom(lv_obj_t *widget, lv_color_t cbuf[], const struct status // Draw layer if (state->layer_label == NULL) { - char text[9] = {}; + char text[10] = {}; sprintf(text, "LAYER %i", state->layer_index); diff --git a/app/boards/shields/snap/Kconfig.defconfig b/app/boards/shields/snap/Kconfig.defconfig index e21111e9..0338df48 100644 --- a/app/boards/shields/snap/Kconfig.defconfig +++ b/app/boards/shields/snap/Kconfig.defconfig @@ -24,9 +24,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -34,7 +31,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/snap/snap.dtsi b/app/boards/shields/snap/snap.dtsi index 7523f35b..48d64dbe 100644 --- a/app/boards/shields/snap/snap.dtsi +++ b/app/boards/shields/snap/snap.dtsi @@ -81,6 +81,7 @@ RC(5,7) RC(5,6) RC(5,5) RC(5,4) RC(5,2) RC(5,0) RC(5,15) display-offset = <0>; multiplex-ratio = <31>; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/sofle/Kconfig.defconfig b/app/boards/shields/sofle/Kconfig.defconfig index 4e7bf884..4eb3d743 100644 --- a/app/boards/shields/sofle/Kconfig.defconfig +++ b/app/boards/shields/sofle/Kconfig.defconfig @@ -24,9 +24,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -34,7 +31,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/sofle/sofle.dtsi b/app/boards/shields/sofle/sofle.dtsi index 4917ca32..94920757 100644 --- a/app/boards/shields/sofle/sofle.dtsi +++ b/app/boards/shields/sofle/sofle.dtsi @@ -86,6 +86,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/splitkb_aurora_corne/Kconfig.defconfig b/app/boards/shields/splitkb_aurora_corne/Kconfig.defconfig index a28792c7..d3ac6c77 100644 --- a/app/boards/shields/splitkb_aurora_corne/Kconfig.defconfig +++ b/app/boards/shields/splitkb_aurora_corne/Kconfig.defconfig @@ -30,9 +30,6 @@ config SSD1306 config I2C default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -40,7 +37,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/splitkb_aurora_corne/splitkb_aurora_corne.dtsi b/app/boards/shields/splitkb_aurora_corne/splitkb_aurora_corne.dtsi index 3eefdc6a..5e1536f0 100644 --- a/app/boards/shields/splitkb_aurora_corne/splitkb_aurora_corne.dtsi +++ b/app/boards/shields/splitkb_aurora_corne/splitkb_aurora_corne.dtsi @@ -88,6 +88,7 @@ RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10 segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/splitkb_aurora_helix/Kconfig.defconfig b/app/boards/shields/splitkb_aurora_helix/Kconfig.defconfig index 6d7a5569..df32b83b 100644 --- a/app/boards/shields/splitkb_aurora_helix/Kconfig.defconfig +++ b/app/boards/shields/splitkb_aurora_helix/Kconfig.defconfig @@ -28,9 +28,6 @@ config SSD1306 config I2C default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL diff --git a/app/boards/shields/splitkb_aurora_helix/splitkb_aurora_helix.dtsi b/app/boards/shields/splitkb_aurora_helix/splitkb_aurora_helix.dtsi index e580e87d..751087c0 100644 --- a/app/boards/shields/splitkb_aurora_helix/splitkb_aurora_helix.dtsi +++ b/app/boards/shields/splitkb_aurora_helix/splitkb_aurora_helix.dtsi @@ -74,6 +74,7 @@ segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/splitkb_aurora_lily58/Kconfig.defconfig b/app/boards/shields/splitkb_aurora_lily58/Kconfig.defconfig index e54e2b43..861db44f 100644 --- a/app/boards/shields/splitkb_aurora_lily58/Kconfig.defconfig +++ b/app/boards/shields/splitkb_aurora_lily58/Kconfig.defconfig @@ -30,9 +30,6 @@ config SSD1306 config I2C default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -40,7 +37,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/splitkb_aurora_lily58/splitkb_aurora_lily58.dtsi b/app/boards/shields/splitkb_aurora_lily58/splitkb_aurora_lily58.dtsi index 06b3ef39..96ded7d5 100644 --- a/app/boards/shields/splitkb_aurora_lily58/splitkb_aurora_lily58.dtsi +++ b/app/boards/shields/splitkb_aurora_lily58/splitkb_aurora_lily58.dtsi @@ -74,6 +74,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,1) RC(4,10) RC(3,6) RC(3,7) segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/splitkb_aurora_sofle/Kconfig.defconfig b/app/boards/shields/splitkb_aurora_sofle/Kconfig.defconfig index b53c4c8d..172548e8 100644 --- a/app/boards/shields/splitkb_aurora_sofle/Kconfig.defconfig +++ b/app/boards/shields/splitkb_aurora_sofle/Kconfig.defconfig @@ -28,9 +28,6 @@ config SSD1306 config I2C default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL diff --git a/app/boards/shields/splitkb_aurora_sofle/splitkb_aurora_sofle.dtsi b/app/boards/shields/splitkb_aurora_sofle/splitkb_aurora_sofle.dtsi index 798cd84e..10c434b8 100644 --- a/app/boards/shields/splitkb_aurora_sofle/splitkb_aurora_sofle.dtsi +++ b/app/boards/shields/splitkb_aurora_sofle/splitkb_aurora_sofle.dtsi @@ -74,6 +74,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/splitkb_aurora_sweep/Kconfig.defconfig b/app/boards/shields/splitkb_aurora_sweep/Kconfig.defconfig index 83cb1bf6..6a0e3728 100644 --- a/app/boards/shields/splitkb_aurora_sweep/Kconfig.defconfig +++ b/app/boards/shields/splitkb_aurora_sweep/Kconfig.defconfig @@ -30,9 +30,6 @@ config SSD1306 config I2C default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -40,7 +37,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/splitkb_aurora_sweep/splitkb_aurora_sweep.dtsi b/app/boards/shields/splitkb_aurora_sweep/splitkb_aurora_sweep.dtsi index c5483af5..fdd8a2dc 100644 --- a/app/boards/shields/splitkb_aurora_sweep/splitkb_aurora_sweep.dtsi +++ b/app/boards/shields/splitkb_aurora_sweep/splitkb_aurora_sweep.dtsi @@ -76,6 +76,7 @@ segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/tidbit/Kconfig.defconfig b/app/boards/shields/tidbit/Kconfig.defconfig index 393fbef1..70bb1d74 100644 --- a/app/boards/shields/tidbit/Kconfig.defconfig +++ b/app/boards/shields/tidbit/Kconfig.defconfig @@ -15,9 +15,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -25,7 +22,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/tidbit/tidbit.dtsi b/app/boards/shields/tidbit/tidbit.dtsi index c7af2001..6717a3af 100644 --- a/app/boards/shields/tidbit/tidbit.dtsi +++ b/app/boards/shields/tidbit/tidbit.dtsi @@ -112,6 +112,7 @@ segment-remap; com-invdir; com-sequential; + inversion-on; prechargep = <0x22>; }; }; diff --git a/app/boards/shields/waterfowl/Kconfig.defconfig b/app/boards/shields/waterfowl/Kconfig.defconfig index dbee82b8..1efc3596 100644 --- a/app/boards/shields/waterfowl/Kconfig.defconfig +++ b/app/boards/shields/waterfowl/Kconfig.defconfig @@ -22,9 +22,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -32,7 +29,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/waterfowl/waterfowl.dtsi b/app/boards/shields/waterfowl/waterfowl.dtsi index 3d914094..6ef961b8 100644 --- a/app/boards/shields/waterfowl/waterfowl.dtsi +++ b/app/boards/shields/waterfowl/waterfowl.dtsi @@ -106,5 +106,6 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) display-offset = <0>; multiplex-ratio = <63>; prechargep = <0x22>; + inversion-on; }; }; diff --git a/app/boards/shields/zodiark/Kconfig.defconfig b/app/boards/shields/zodiark/Kconfig.defconfig index e7538c41..07ed7dbe 100644 --- a/app/boards/shields/zodiark/Kconfig.defconfig +++ b/app/boards/shields/zodiark/Kconfig.defconfig @@ -24,9 +24,6 @@ config I2C config SSD1306 default y -config SSD1306_REVERSE_MODE - default y - endif # ZMK_DISPLAY if LVGL @@ -34,7 +31,7 @@ if LVGL config LV_Z_VDB_SIZE default 64 -config LV_Z_DPI +config LV_DPI_DEF default 148 config LV_Z_BITS_PER_PIXEL diff --git a/app/boards/shields/zodiark/zodiark.dtsi b/app/boards/shields/zodiark/zodiark.dtsi index 66ebb7b4..640f9b7b 100644 --- a/app/boards/shields/zodiark/zodiark.dtsi +++ b/app/boards/shields/zodiark/zodiark.dtsi @@ -84,5 +84,6 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) R display-offset = <0>; multiplex-ratio = <31>; prechargep = <0x22>; + inversion-on; }; }; diff --git a/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-common.yaml b/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-common.yaml new file mode 100644 index 00000000..fd1d6826 --- /dev/null +++ b/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-common.yaml @@ -0,0 +1,18 @@ +properties: + dr-gpios: + type: phandle-array + description: Data ready pin for the trackpad + rotate-90: + type: boolean + sleep: + type: boolean + no-taps: + type: boolean + sensitivity: + type: string + enum: + - 1x + - 2x + - 3x + - 4x + description: ADC attenuation (sensitivity) setting. diff --git a/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-i2c.yaml b/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-i2c.yaml new file mode 100644 index 00000000..da2603a7 --- /dev/null +++ b/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-i2c.yaml @@ -0,0 +1,6 @@ +description: | + Sensor driver for the Cirque Pinnacle trackpad ASICs, using the I2C interface + +compatible: "cirque,pinnacle" + +include: ["i2c-device.yaml", "cirque,pinnacle-common.yaml"] diff --git a/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-spi.yaml b/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-spi.yaml new file mode 100644 index 00000000..0bd70ee1 --- /dev/null +++ b/app/drivers/zephyr/dts/bindings/sensor/cirque,pinnacle-spi.yaml @@ -0,0 +1,6 @@ +description: | + Sensor driver for the Cirque Pinnacle trackpad ASICs, using the SPI interface + +compatible: "cirque,pinnacle" + +include: ["spi-device.yaml", "cirque,pinnacle-common.yaml"] diff --git a/app/module/drivers/CMakeLists.txt b/app/module/drivers/CMakeLists.txt index 5281c3dc..a3a15c65 100644 --- a/app/module/drivers/CMakeLists.txt +++ b/app/module/drivers/CMakeLists.txt @@ -5,3 +5,4 @@ add_subdirectory_ifdef(CONFIG_GPIO gpio) add_subdirectory_ifdef(CONFIG_KSCAN kscan) add_subdirectory_ifdef(CONFIG_SENSOR sensor) add_subdirectory_ifdef(CONFIG_DISPLAY display) +add_subdirectory_ifdef(CONFIG_INPUT input) diff --git a/app/module/drivers/Kconfig b/app/module/drivers/Kconfig index c57ed334..db3f49a5 100644 --- a/app/module/drivers/Kconfig +++ b/app/module/drivers/Kconfig @@ -5,3 +5,4 @@ rsource "gpio/Kconfig" rsource "kscan/Kconfig" rsource "sensor/Kconfig" rsource "display/Kconfig" +rsource "input/Kconfig" diff --git a/app/module/drivers/input/CMakeLists.txt b/app/module/drivers/input/CMakeLists.txt new file mode 100644 index 00000000..20cb3598 --- /dev/null +++ b/app/module/drivers/input/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +zephyr_library_amend() + +zephyr_library_sources_ifdef(CONFIG_INPUT_PINNACLE input_pinnacle.c) diff --git a/app/module/drivers/input/Kconfig b/app/module/drivers/input/Kconfig new file mode 100644 index 00000000..f47c5ebb --- /dev/null +++ b/app/module/drivers/input/Kconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +menuconfig INPUT_PINNACLE + bool "Cirque Pinnacle trackpads" + depends on GPIO + depends on SPI || I2C + depends on INPUT + help + Enable driver for Cirque Pinnacle trackpads diff --git a/app/module/drivers/input/input_pinnacle.c b/app/module/drivers/input/input_pinnacle.c new file mode 100644 index 00000000..d24991f6 --- /dev/null +++ b/app/module/drivers/input/input_pinnacle.c @@ -0,0 +1,386 @@ +#define DT_DRV_COMPAT cirque_pinnacle + +#include +#include +#include + +#include + +#include "input_pinnacle.h" + +LOG_MODULE_REGISTER(pinnacle, CONFIG_INPUT_LOG_LEVEL); + +static int pinnacle_seq_read(const struct device *dev, const uint8_t addr, uint8_t *buf, + const uint8_t len) { + const struct pinnacle_config *config = dev->config; +#if DT_INST_ON_BUS(0, spi) + uint8_t tx_buffer[len + 3], rx_dummy[3]; + tx_buffer[0] = PINNACLE_READ | addr; + memset(&tx_buffer[1], PINNACLE_AUTOINC, len + 2); + + const struct spi_buf tx_buf[2] = { + { + .buf = tx_buffer, + .len = 3, + }, + { + .buf = &tx_buffer[3], + .len = len, + }, + }; + const struct spi_buf_set tx = { + .buffers = tx_buf, + .count = 2, + }; + struct spi_buf rx_buf[2] = { + { + .buf = rx_dummy, + .len = 3, + }, + { + .buf = buf, + .len = len, + }, + }; + const struct spi_buf_set rx = { + .buffers = rx_buf, + .count = 2, + }; + int ret = spi_transceive_dt(&config->bus, &tx, &rx); + + return ret; +#elif DT_INST_ON_BUS(0, i2c) + return i2c_burst_read_dt(&config->bus, PINNACLE_READ | addr, buf, len); +#endif +} + +static int pinnacle_write(const struct device *dev, const uint8_t addr, const uint8_t val) { + const struct pinnacle_config *config = dev->config; +#if DT_INST_ON_BUS(0, spi) + uint8_t tx_buffer[2] = {PINNACLE_WRITE | addr, val}; + uint8_t rx_buffer[2]; + + const struct spi_buf tx_buf = { + .buf = tx_buffer, + .len = 2, + }; + const struct spi_buf_set tx = { + .buffers = &tx_buf, + .count = 1, + }; + + const struct spi_buf rx_buf = { + .buf = rx_buffer, + .len = 2, + }; + const struct spi_buf_set rx = { + .buffers = &rx_buf, + .count = 1, + }; + + const int ret = spi_transceive_dt(&config->bus, &tx, &rx); + + if (rx_buffer[1] != PINNACLE_FILLER) { + LOG_ERR("bad ret val %d", rx_buffer[1]); + return -EIO; + } + + if (ret < 0) { + LOG_ERR("spi ret: %d", ret); + } + return ret; +#elif DT_INST_ON_BUS(0, i2c) + return i2c_reg_write_byte_dt(&config->bus, PINNACLE_WRITE | addr, val); +#endif +} + +static void set_int(const struct device *dev, const bool en) { + const struct pinnacle_config *config = dev->config; + int ret = gpio_pin_interrupt_configure_dt(&config->dr, + en ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE); + if (ret < 0) { + LOG_ERR("can't set interrupt"); + } +} + +static int pinnacle_clear_status(const struct device *dev) { + int ret = pinnacle_write(dev, PINNACLE_STATUS1, 0); + if (ret < 0) { + LOG_ERR("Failed to clear STATUS1 register: %d", ret); + } + + return ret; +} + +#if 0 +static int pinnacle_era_read(const struct device *dev, const uint16_t addr, uint8_t *val) { + int ret; + + set_int(dev, false); + + ret = pinnacle_write(dev, PINNACLE_REG_ERA_HIGH_BYTE, (uint8_t)(addr >> 8)); + if (ret < 0) { + LOG_ERR("Failed to write ERA high byte (%d)", ret); + return -EIO; + } + + ret = pinnacle_write(dev, PINNACLE_REG_ERA_LOW_BYTE, (uint8_t)(addr & 0x00FF)); + if (ret < 0) { + LOG_ERR("Failed to write ERA low byte (%d)", ret); + return -EIO; + } + + ret = pinnacle_write(dev, PINNACLE_REG_ERA_CONTROL, PINNACLE_ERA_CONTROL_READ); + if (ret < 0) { + LOG_ERR("Failed to write ERA control (%d)", ret); + return -EIO; + } + + uint8_t control_val; + do { + + ret = pinnacle_seq_read(dev, PINNACLE_REG_ERA_CONTROL, &control_val, 1); + if (ret < 0) { + LOG_ERR("Failed to read ERA control (%d)", ret); + return -EIO; + } + + } while (control_val != 0x00); + + ret = pinnacle_seq_read(dev, PINNACLE_REG_ERA_VALUE, val, 1); + + if (ret < 0) { + LOG_ERR("Failed to read ERA value (%d)", ret); + return -EIO; + } + + ret = pinnacle_clear_status(dev); + + set_int(dev, true); + + return ret; +} +#endif + +static int pinnacle_era_write(const struct device *dev, const uint16_t addr, uint8_t val) { + int ret; + + set_int(dev, false); + + ret = pinnacle_write(dev, PINNACLE_REG_ERA_VALUE, val); + if (ret < 0) { + LOG_ERR("Failed to write ERA value (%d)", ret); + return -EIO; + } + + ret = pinnacle_write(dev, PINNACLE_REG_ERA_HIGH_BYTE, (uint8_t)(addr >> 8)); + if (ret < 0) { + LOG_ERR("Failed to write ERA high byte (%d)", ret); + return -EIO; + } + + ret = pinnacle_write(dev, PINNACLE_REG_ERA_LOW_BYTE, (uint8_t)(addr & 0x00FF)); + if (ret < 0) { + LOG_ERR("Failed to write ERA low byte (%d)", ret); + return -EIO; + } + + ret = pinnacle_write(dev, PINNACLE_REG_ERA_CONTROL, PINNACLE_ERA_CONTROL_WRITE); + if (ret < 0) { + LOG_ERR("Failed to write ERA control (%d)", ret); + return -EIO; + } + + uint8_t control_val; + do { + + ret = pinnacle_seq_read(dev, PINNACLE_REG_ERA_CONTROL, &control_val, 1); + if (ret < 0) { + LOG_ERR("Failed to read ERA control (%d)", ret); + return -EIO; + } + + } while (control_val != 0x00); + + ret = pinnacle_clear_status(dev); + + set_int(dev, true); + + return ret; +} + +static void pinnacle_report_data(const struct device *dev) { + const struct pinnacle_config *config = dev->config; + uint8_t packet[3]; + int ret; + ret = pinnacle_seq_read(dev, PINNACLE_STATUS1, packet, 1); + if (ret < 0) { + LOG_ERR("read status: %d", ret); + return; + } + if (!(packet[0] & PINNACLE_STATUS1_SW_DR)) { + return; + } + ret = pinnacle_seq_read(dev, PINNACLE_2_2_PACKET0, packet, 3); + if (ret < 0) { + LOG_ERR("read packet: %d", ret); + return; + } + struct pinnacle_data *data = dev->data; + uint8_t btn = packet[0] & + (PINNACLE_PACKET0_BTN_PRIM | PINNACLE_PACKET0_BTN_SEC | PINNACLE_PACKET0_BTN_AUX); + int16_t dx = (int16_t)(int8_t)packet[1]; + int16_t dy = (int16_t)(int8_t)packet[2]; + LOG_DBG("button: %d, dx: %d dy: %d", btn, dx, dy); + if (data->in_int) { + LOG_DBG("Clearing status bit"); + ret = pinnacle_clear_status(dev); + data->in_int = true; + } + + if (!config->no_taps && (btn || data->btn_cache)) { + for (int i = 0; i < 3; i++) { + uint8_t btn_val = btn & BIT(i); + if (btn_val != (data->btn_cache & BIT(i))) { + input_report_key(dev, INPUT_BTN_0 + i, btn_val ? 1 : 0, false, K_FOREVER); + } + } + } + + data->btn_cache = btn; + + input_report_rel(dev, INPUT_REL_X, dx, false, K_FOREVER); + input_report_rel(dev, INPUT_REL_Y, dy, true, K_FOREVER); + + return; +} + +static void pinnacle_work_cb(struct k_work *work) { + struct pinnacle_data *data = CONTAINER_OF(work, struct pinnacle_data, work); + pinnacle_report_data(data->dev); +} + +static void pinnacle_gpio_cb(const struct device *port, struct gpio_callback *cb, uint32_t pins) { + struct pinnacle_data *data = CONTAINER_OF(cb, struct pinnacle_data, gpio_cb); + data->in_int = true; + k_work_submit(&data->work); +} + +static int pinnacle_adc_sensitivity_reg_value(enum pinnacle_sensitivity sensitivity) { + switch (sensitivity) { + case PINNACLE_SENSITIVITY_1X: + return PINNACLE_TRACKING_ADC_CONFIG_1X; + case PINNACLE_SENSITIVITY_2X: + return PINNACLE_TRACKING_ADC_CONFIG_2X; + case PINNACLE_SENSITIVITY_3X: + return PINNACLE_TRACKING_ADC_CONFIG_3X; + case PINNACLE_SENSITIVITY_4X: + return PINNACLE_TRACKING_ADC_CONFIG_4X; + default: + return PINNACLE_TRACKING_ADC_CONFIG_1X; + } +} + +static int pinnacle_init(const struct device *dev) { + struct pinnacle_data *data = dev->data; + const struct pinnacle_config *config = dev->config; + + LOG_WRN("pinnacle start"); + data->in_int = false; + int ret; + k_msleep(4); + ret = pinnacle_write(dev, PINNACLE_STATUS1, 0); // Clear CC + if (ret < 0) { + LOG_ERR("can't write %d", ret); + return ret; + } + k_usleep(50); + ret = pinnacle_write(dev, PINNACLE_SYS_CFG, PINNACLE_SYS_CFG_RESET); + if (ret < 0) { + LOG_ERR("can't reset %d", ret); + return ret; + } + k_msleep(20); + ret = pinnacle_write(dev, PINNACLE_Z_IDLE, 0x05); // No Z-Idle packets + if (ret < 0) { + LOG_ERR("can't write %d", ret); + return ret; + } + if (config->sleep_en) { + ret = pinnacle_write(dev, PINNACLE_SYS_CFG, PINNACLE_SYS_CFG_EN_SLEEP); + if (ret < 0) { + LOG_ERR("can't write %d", ret); + return ret; + } + } + + if (config->sensitivity > PINNACLE_SENSITIVITY_1X) { + ret = pinnacle_era_write(dev, PINNACLE_ERA_REG_TRACKING_ADC_CONFIG, + pinnacle_adc_sensitivity_reg_value(config->sensitivity)); + if (ret < 0) { + LOG_ERR("Failed to set ADC sensitivity %d", ret); + return ret; + } + } + + uint8_t feed_cfg2 = PINNACLE_FEED_CFG2_EN_IM; + if (config->no_taps) { + feed_cfg2 |= PINNACLE_FEED_CFG2_DIS_TAP; + } + if (config->rotate_90) { + feed_cfg2 |= PINNACLE_FEED_CFG2_ROTATE_90; + } + ret = pinnacle_write(dev, PINNACLE_FEED_CFG2, feed_cfg2); + if (ret < 0) { + LOG_ERR("can't write %d", ret); + return ret; + } + uint8_t feed_cfg1 = PINNACLE_FEED_CFG1_EN_FEED; + if (feed_cfg1) { + ret = pinnacle_write(dev, PINNACLE_FEED_CFG1, feed_cfg1); + } + if (ret < 0) { + LOG_ERR("can't write %d", ret); + return ret; + } + + data->dev = dev; + + pinnacle_clear_status(dev); + + gpio_pin_configure_dt(&config->dr, GPIO_INPUT); + gpio_init_callback(&data->gpio_cb, pinnacle_gpio_cb, BIT(config->dr.pin)); + ret = gpio_add_callback(config->dr.port, &data->gpio_cb); + if (ret < 0) { + LOG_ERR("Failed to set DR callback: %d", ret); + return -EIO; + } + + k_work_init(&data->work, pinnacle_work_cb); + + pinnacle_write(dev, PINNACLE_FEED_CFG1, feed_cfg1); + + set_int(dev, true); + + return 0; +} + +#define PINNACLE_INST(n) \ + static struct pinnacle_data pinnacle_data_##n; \ + static const struct pinnacle_config pinnacle_config_##n = { \ + .bus = COND_CODE_1( \ + DT_INST_ON_BUS(0, i2c), (I2C_DT_SPEC_INST_GET(0)), \ + (SPI_DT_SPEC_INST_GET(0, \ + SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | SPI_LINES_SINGLE | \ + SPI_TRANSFER_MSB | SPI_MODE_CPHA, \ + 0))), \ + .rotate_90 = DT_INST_PROP(0, rotate_90), \ + .sleep_en = DT_INST_PROP(0, sleep), \ + .no_taps = DT_INST_PROP(0, no_taps), \ + .sensitivity = DT_INST_ENUM_IDX_OR(0, sensitivity, PINNACLE_SENSITIVITY_1X), \ + .dr = GPIO_DT_SPEC_GET_OR(DT_DRV_INST(0), dr_gpios, {}), \ + }; \ + DEVICE_DT_INST_DEFINE(n, pinnacle_init, NULL, &pinnacle_data_##n, &pinnacle_config_##n, \ + POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, NULL); + +DT_INST_FOREACH_STATUS_OKAY(PINNACLE_INST) diff --git a/app/module/drivers/input/input_pinnacle.h b/app/module/drivers/input/input_pinnacle.h new file mode 100644 index 00000000..58947fa9 --- /dev/null +++ b/app/module/drivers/input/input_pinnacle.h @@ -0,0 +1,95 @@ +#pragma once + +#include +#include +#include + +#define PINNACLE_READ 0xA0 +#define PINNACLE_WRITE 0x80 + +#define PINNACLE_AUTOINC 0xFC +#define PINNACLE_FILLER 0xFB + +// Registers +#define PINNACLE_FW_ID 0x00 // ASIC ID. +#define PINNACLE_FW_VER 0x01 // Firmware Version Firmware revision number. +#define PINNACLE_STATUS1 0x02 // Contains status flags about the state of Pinnacle. +#define PINNACLE_STATUS1_SW_DR BIT(2) +#define PINNACLE_STATUS1_SW_CC BIT(3) +#define PINNACLE_SYS_CFG 0x03 // Contains system operation and configuration bits. +#define PINNACLE_SYS_CFG_EN_SLEEP BIT(2) +#define PINNACLE_SYS_CFG_SHUTDOWN BIT(1) +#define PINNACLE_SYS_CFG_RESET BIT(0) + +#define PINNACLE_FEED_CFG1 0x04 // Contains feed operation and configuration bits. +#define PINNACLE_FEED_CFG1_EN_FEED BIT(0) +#define PINNACLE_FEED_CFG1_ABS_MODE BIT(1) +#define PINNACLE_FEED_CFG1_DIS_FILT BIT(2) +#define PINNACLE_FEED_CFG1_DIS_X BIT(3) +#define PINNACLE_FEED_CFG1_DIS_Y BIT(4) +#define PINNACLE_FEED_CFG1_INV_X BIT(6) +#define PINNACLE_FEED_CFG1_INV_Y BIT(7) +#define PINNACLE_FEED_CFG2 0x05 // Contains feed operation and configuration bits. +#define PINNACLE_FEED_CFG2_EN_IM BIT(0) // Intellimouse +#define PINNACLE_FEED_CFG2_DIS_TAP BIT(1) // Disable all taps +#define PINNACLE_FEED_CFG2_DIS_SEC BIT(2) // Disable secondary tap +#define PINNACLE_FEED_CFG2_DIS_SCRL BIT(3) // Disable scroll +#define PINNACLE_FEED_CFG2_DIS_GE BIT(4) // Disable GlideExtend +#define PINNACLE_FEED_CFG2_ROTATE_90 BIT(7) // Swap X & Y +#define PINNACLE_CAL_CFG 0x07 // Contains calibration configuration bits. +#define PINNACLE_PS2_AUX 0x08 // Contains Data register for PS/2 Aux Control. +#define PINNACLE_SAMPLE 0x09 // Sample Rate Number of samples generated per second. +#define PINNACLE_Z_IDLE 0x0A // Number of Z=0 packets sent when Z goes from >0 to 0. +#define PINNACLE_Z_SCALER 0x0B // Contains the pen Z_On threshold. +#define PINNACLE_SLEEP_INTERVAL 0x0C // Sleep Interval +#define PINNACLE_SLEEP_TIMER 0x0D // Sleep Timer +#define PINNACLE_AG_PACKET0 0x10 // trackpad Data (Pinnacle AG) +#define PINNACLE_2_2_PACKET0 0x12 // trackpad Data +#define PINNACLE_REG_COUNT 0x18 + +#define PINNACLE_REG_ERA_VALUE 0x1B +#define PINNACLE_REG_ERA_HIGH_BYTE 0x1C +#define PINNACLE_REG_ERA_LOW_BYTE 0x1D +#define PINNACLE_REG_ERA_CONTROL 0x1E + +#define PINNACLE_ERA_CONTROL_READ 0x01 +#define PINNACLE_ERA_CONTROL_WRITE 0x02 + +#define PINNACLE_ERA_REG_TRACKING_ADC_CONFIG 0x0187 + +#define PINNACLE_TRACKING_ADC_CONFIG_1X 0x00 +#define PINNACLE_TRACKING_ADC_CONFIG_2X 0x40 +#define PINNACLE_TRACKING_ADC_CONFIG_3X 0x80 +#define PINNACLE_TRACKING_ADC_CONFIG_4X 0xC0 + +#define PINNACLE_PACKET0_BTN_PRIM BIT(0) // Primary button +#define PINNACLE_PACKET0_BTN_SEC BIT(1) // Secondary button +#define PINNACLE_PACKET0_BTN_AUX BIT(2) // Auxiliary (middle?) button +#define PINNACLE_PACKET0_X_SIGN BIT(4) // X delta sign +#define PINNACLE_PACKET0_Y_SIGN BIT(5) // Y delta sign + +struct pinnacle_data { + uint8_t btn_cache; + bool in_int; + const struct device *dev; + struct gpio_callback gpio_cb; + struct k_work work; +}; + +enum pinnacle_sensitivity { + PINNACLE_SENSITIVITY_1X, + PINNACLE_SENSITIVITY_2X, + PINNACLE_SENSITIVITY_3X, + PINNACLE_SENSITIVITY_4X, +}; + +struct pinnacle_config { +#if DT_INST_ON_BUS(0, i2c) + const struct i2c_dt_spec bus; +#elif DT_INST_ON_BUS(0, spi) + const struct spi_dt_spec bus; +#endif + bool rotate_90, sleep_en, no_taps; + enum pinnacle_sensitivity sensitivity; + const struct gpio_dt_spec dr; +}; diff --git a/app/module/drivers/kscan/Kconfig b/app/module/drivers/kscan/Kconfig index 6f60b3f9..8a76588f 100644 --- a/app/module/drivers/kscan/Kconfig +++ b/app/module/drivers/kscan/Kconfig @@ -13,6 +13,14 @@ config ZMK_KSCAN_COMPOSITE_DRIVER bool default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_COMPOSITE)) +if ZMK_KSCAN_COMPOSITE_DRIVER + +config ZMK_KSCAN_COMPOSITE_INIT_PRIORITY + int "Init Priority for the composite kscan driver" + default 95 + +endif + config ZMK_KSCAN_GPIO_DRIVER bool select GPIO diff --git a/app/module/drivers/kscan/kscan_composite.c b/app/module/drivers/kscan/kscan_composite.c index 97311ef8..2a364324 100644 --- a/app/module/drivers/kscan/kscan_composite.c +++ b/app/module/drivers/kscan/kscan_composite.c @@ -109,4 +109,4 @@ static const struct kscan_composite_config kscan_composite_config = {}; static struct kscan_composite_data kscan_composite_data; DEVICE_DT_INST_DEFINE(0, kscan_composite_init, NULL, &kscan_composite_data, &kscan_composite_config, - POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY, &mock_driver_api); + POST_KERNEL, CONFIG_ZMK_KSCAN_COMPOSITE_INIT_PRIORITY, &mock_driver_api); diff --git a/app/module/drivers/kscan/kscan_gpio_demux.c b/app/module/drivers/kscan/kscan_gpio_demux.c index 2cbe116d..10433c5a 100644 --- a/app/module/drivers/kscan/kscan_gpio_demux.c +++ b/app/module/drivers/kscan/kscan_gpio_demux.c @@ -9,6 +9,7 @@ #include #include #include +#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -105,7 +106,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); } \ \ static void kscan_gpio_work_handler_##n(struct k_work *work) { \ - struct kscan_gpio_data_##n *data = CONTAINER_OF(work, struct kscan_gpio_data_##n, work); \ + struct k_work_delayable *d_work = k_work_delayable_from_work(work); \ + struct kscan_gpio_data_##n *data = CONTAINER_OF(d_work, struct kscan_gpio_data_##n, work); \ kscan_gpio_read_##n(data->dev); \ } \ \ diff --git a/app/module/drivers/kscan/kscan_gpio_direct.c b/app/module/drivers/kscan/kscan_gpio_direct.c index 5b227784..b5e77f63 100644 --- a/app/module/drivers/kscan/kscan_gpio_direct.c +++ b/app/module/drivers/kscan/kscan_gpio_direct.c @@ -192,10 +192,10 @@ static int kscan_direct_read(const struct device *dev) { for (int i = 0; i < data->inputs.len; i++) { const struct kscan_gpio *gpio = &data->inputs.gpios[i]; - struct zmk_debounce_state *state = &data->pin_state[gpio->index]; + struct zmk_debounce_state *deb_state = &data->pin_state[gpio->index]; - if (zmk_debounce_get_changed(state)) { - const bool pressed = zmk_debounce_is_pressed(state); + if (zmk_debounce_get_changed(deb_state)) { + const bool pressed = zmk_debounce_is_pressed(deb_state); LOG_DBG("Sending event at 0,%i state %s", gpio->index, pressed ? "on" : "off"); data->callback(dev, 0, gpio->index, pressed); @@ -204,7 +204,7 @@ static int kscan_direct_read(const struct device *dev) { } } - continue_scan = continue_scan || zmk_debounce_is_active(state); + continue_scan = continue_scan || zmk_debounce_is_active(deb_state); } if (continue_scan) { diff --git a/app/module/drivers/kscan/kscan_gpio_matrix.c b/app/module/drivers/kscan/kscan_gpio_matrix.c index 0d8a3190..6e91bf95 100644 --- a/app/module/drivers/kscan/kscan_gpio_matrix.c +++ b/app/module/drivers/kscan/kscan_gpio_matrix.c @@ -290,7 +290,7 @@ static int kscan_matrix_read(const struct device *dev) { } static void kscan_matrix_work_handler(struct k_work *work) { - struct k_work_delayable *dwork = CONTAINER_OF(work, struct k_work_delayable, work); + struct k_work_delayable *dwork = k_work_delayable_from_work(work); struct kscan_matrix_data *data = CONTAINER_OF(dwork, struct kscan_matrix_data, work); kscan_matrix_read(data->dev); } diff --git a/app/module/drivers/kscan/kscan_mock.c b/app/module/drivers/kscan/kscan_mock.c index 604e164c..1ffb937e 100644 --- a/app/module/drivers/kscan/kscan_mock.c +++ b/app/module/drivers/kscan/kscan_mock.c @@ -9,6 +9,7 @@ #include #include #include +#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -61,7 +62,8 @@ static int kscan_mock_configure(const struct device *dev, kscan_callback_t callb } \ } \ static void kscan_mock_work_handler_##n(struct k_work *work) { \ - struct kscan_mock_data *data = CONTAINER_OF(work, struct kscan_mock_data, work); \ + struct k_work_delayable *d_work = k_work_delayable_from_work(work); \ + struct kscan_mock_data *data = CONTAINER_OF(d_work, struct kscan_mock_data, work); \ const struct kscan_mock_config_##n *cfg = data->dev->config; \ uint32_t ev = cfg->events[data->event_index]; \ LOG_DBG("ev %u row %d column %d state %d\n", ev, ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), \ diff --git a/app/module/drivers/sensor/CMakeLists.txt b/app/module/drivers/sensor/CMakeLists.txt index 9654600a..28c8e9d5 100644 --- a/app/module/drivers/sensor/CMakeLists.txt +++ b/app/module/drivers/sensor/CMakeLists.txt @@ -4,3 +4,4 @@ add_subdirectory_ifdef(CONFIG_ZMK_BATTERY battery) add_subdirectory_ifdef(CONFIG_EC11 ec11) add_subdirectory_ifdef(CONFIG_MAX17048 max17048) +add_subdirectory_ifdef(CONFIG_PINNACLE pinnacle) diff --git a/app/module/drivers/sensor/max17048/CMakeLists.txt b/app/module/drivers/sensor/max17048/CMakeLists.txt index e895fa11..43b7af4d 100644 --- a/app/module/drivers/sensor/max17048/CMakeLists.txt +++ b/app/module/drivers/sensor/max17048/CMakeLists.txt @@ -5,5 +5,5 @@ zephyr_include_directories(.) zephyr_library() -zephyr_library_sources_ifdef(CONFIG_MAX17048 max17048.c) -zephyr_library_sources_ifndef(CONFIG_MAX17048 ${ZEPHYR_BASE}/misc/empty_file.c) +zephyr_library_sources_ifdef(CONFIG_ZMK_MAX17048 max17048.c) +zephyr_library_sources_ifndef(CONFIG_ZMK_MAX17048 ${ZEPHYR_BASE}/misc/empty_file.c) diff --git a/app/module/drivers/sensor/max17048/Kconfig b/app/module/drivers/sensor/max17048/Kconfig index 8a7ec16e..9537e269 100644 --- a/app/module/drivers/sensor/max17048/Kconfig +++ b/app/module/drivers/sensor/max17048/Kconfig @@ -3,7 +3,7 @@ DT_COMPAT_MAXIM_MAX17048 := maxim,max17048 -menuconfig MAX17048 +menuconfig ZMK_MAX17048 bool "MAX17048/9 I2C-based Fuel Gauge" default $(dt_compat_enabled,$(DT_COMPAT_MAXIM_MAX17048)) depends on I2C @@ -12,7 +12,7 @@ menuconfig MAX17048 Enable driver for MAX17048/9 I2C-based Fuel Gauge. Supports measuring battery voltage and state-of-charge. -if MAX17048 +if ZMK_MAX17048 config SENSOR_MAX17048_INIT_PRIORITY int "Init priority" diff --git a/app/prj.conf b/app/prj.conf index e69de29b..cd2bc13f 100644 --- a/app/prj.conf +++ b/app/prj.conf @@ -0,0 +1 @@ +CONFIG_APPLICATION_DEFINED_SYSCALL=y \ No newline at end of file diff --git a/app/src/activity.c b/app/src/activity.c index 41fe2e15..7894cb71 100644 --- a/app/src/activity.c +++ b/app/src/activity.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include @@ -70,7 +70,7 @@ void activity_work_handler(struct k_work *work) { if (inactive_time > MAX_SLEEP_MS && !is_usb_power_present()) { // Put devices in suspend power mode before sleeping set_state(ZMK_ACTIVITY_SLEEP); - pm_state_force(0U, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0}); + sys_poweroff(); } else #endif /* IS_ENABLED(CONFIG_ZMK_SLEEP) */ if (inactive_time > MAX_IDLE_MS) { @@ -84,7 +84,7 @@ void activity_expiry_function() { k_work_submit(&activity_work); } K_TIMER_DEFINE(activity_timer, activity_expiry_function, NULL); -int activity_init() { +int activity_init(void) { activity_last_uptime = k_uptime_get(); k_timer_start(&activity_timer, K_SECONDS(1), K_SECONDS(1)); diff --git a/app/src/backlight.c b/app/src/backlight.c index f633ddb7..7f87737d 100644 --- a/app/src/backlight.c +++ b/app/src/backlight.c @@ -78,7 +78,7 @@ static void backlight_save_work_handler(struct k_work *work) { static struct k_work_delayable backlight_save_work; #endif -static int zmk_backlight_init(const struct device *_arg) { +static int zmk_backlight_init(void) { if (!device_is_ready(backlight_dev)) { LOG_ERR("Backlight device \"%s\" is not ready", backlight_dev->name); return -ENODEV; diff --git a/app/src/battery.c b/app/src/battery.c index c6466272..a2609d7e 100644 --- a/app/src/battery.c +++ b/app/src/battery.c @@ -84,7 +84,7 @@ static void zmk_battery_timer(struct k_timer *timer) { K_TIMER_DEFINE(battery_timer, zmk_battery_timer, NULL); -static int zmk_battery_init(const struct device *_arg) { +static int zmk_battery_init(void) { #if !DT_HAS_CHOSEN(zmk_battery) battery = device_get_binding("BATTERY"); diff --git a/app/src/behaviors/behavior_backlight.c b/app/src/behaviors/behavior_backlight.c index fe2155b7..27d8de93 100644 --- a/app/src/behaviors/behavior_backlight.c +++ b/app/src/behaviors/behavior_backlight.c @@ -91,7 +91,7 @@ static const struct behavior_driver_api behavior_backlight_driver_api = { .locality = BEHAVIOR_LOCALITY_GLOBAL, }; -DEVICE_DT_INST_DEFINE(0, behavior_backlight_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_backlight_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_backlight_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_bt.c b/app/src/behaviors/behavior_bt.c index bf98532c..69724691 100644 --- a/app/src/behaviors/behavior_bt.c +++ b/app/src/behaviors/behavior_bt.c @@ -52,7 +52,7 @@ static const struct behavior_driver_api behavior_bt_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_DT_INST_DEFINE(0, behavior_bt_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_bt_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_bt_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_caps_word.c b/app/src/behaviors/behavior_caps_word.c index 4c9fd711..7fc34984 100644 --- a/app/src/behaviors/behavior_caps_word.c +++ b/app/src/behaviors/behavior_caps_word.c @@ -182,7 +182,7 @@ static int behavior_caps_word_init(const struct device *dev) { .continuations_count = DT_INST_PROP_LEN(n, continue_list), \ }; \ DEVICE_DT_INST_DEFINE(n, behavior_caps_word_init, NULL, &behavior_caps_word_data_##n, \ - &behavior_caps_word_config_##n, APPLICATION, \ + &behavior_caps_word_config_##n, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_caps_word_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_ext_power.c b/app/src/behaviors/behavior_ext_power.c index 690ac971..ebc75ac6 100644 --- a/app/src/behaviors/behavior_ext_power.c +++ b/app/src/behaviors/behavior_ext_power.c @@ -74,7 +74,7 @@ static const struct behavior_driver_api behavior_ext_power_driver_api = { .locality = BEHAVIOR_LOCALITY_GLOBAL, }; -DEVICE_DT_INST_DEFINE(0, behavior_ext_power_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_ext_power_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, &behavior_ext_power_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index d4aa0dce..5f70de4a 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -678,7 +678,8 @@ ZMK_SUBSCRIPTION(behavior_hold_tap, zmk_position_state_changed); ZMK_SUBSCRIPTION(behavior_hold_tap, zmk_keycode_state_changed); void behavior_hold_tap_timer_work_handler(struct k_work *item) { - struct active_hold_tap *hold_tap = CONTAINER_OF(item, struct active_hold_tap, work); + struct k_work_delayable *d_work = k_work_delayable_from_work(item); + struct active_hold_tap *hold_tap = CONTAINER_OF(d_work, struct active_hold_tap, work); if (hold_tap->work_is_cancelled) { clear_hold_tap(hold_tap); @@ -716,7 +717,7 @@ static int behavior_hold_tap_init(const struct device *dev) { .hold_trigger_key_positions_len = DT_INST_PROP_LEN(n, hold_trigger_key_positions), \ }; \ DEVICE_DT_INST_DEFINE(n, behavior_hold_tap_init, NULL, NULL, &behavior_hold_tap_config_##n, \ - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &behavior_hold_tap_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_key_press.c b/app/src/behaviors/behavior_key_press.c index 2765db9f..9c4ffd32 100644 --- a/app/src/behaviors/behavior_key_press.c +++ b/app/src/behaviors/behavior_key_press.c @@ -36,7 +36,7 @@ static const struct behavior_driver_api behavior_key_press_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released}; #define KP_INST(n) \ - DEVICE_DT_INST_DEFINE(n, behavior_key_press_init, NULL, NULL, NULL, APPLICATION, \ + DEVICE_DT_INST_DEFINE(n, behavior_key_press_init, NULL, NULL, NULL, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_key_press_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_key_repeat.c b/app/src/behaviors/behavior_key_repeat.c index 033f498b..26b84be1 100644 --- a/app/src/behaviors/behavior_key_repeat.c +++ b/app/src/behaviors/behavior_key_repeat.c @@ -117,7 +117,7 @@ static int behavior_key_repeat_init(const struct device *dev) { .usage_pages_count = DT_INST_PROP_LEN(n, usage_pages), \ }; \ DEVICE_DT_INST_DEFINE(n, behavior_key_repeat_init, NULL, &behavior_key_repeat_data_##n, \ - &behavior_key_repeat_config_##n, APPLICATION, \ + &behavior_key_repeat_config_##n, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_key_repeat_driver_api); DT_INST_FOREACH_STATUS_OKAY(KR_INST) diff --git a/app/src/behaviors/behavior_key_toggle.c b/app/src/behaviors/behavior_key_toggle.c index cbbdd0d9..4288ed6d 100644 --- a/app/src/behaviors/behavior_key_toggle.c +++ b/app/src/behaviors/behavior_key_toggle.c @@ -38,7 +38,7 @@ static const struct behavior_driver_api behavior_key_toggle_driver_api = { }; #define KT_INST(n) \ - DEVICE_DT_INST_DEFINE(n, behavior_key_toggle_init, NULL, NULL, NULL, APPLICATION, \ + DEVICE_DT_INST_DEFINE(n, behavior_key_toggle_init, NULL, NULL, NULL, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_key_toggle_driver_api); DT_INST_FOREACH_STATUS_OKAY(KT_INST) diff --git a/app/src/behaviors/behavior_macro.c b/app/src/behaviors/behavior_macro.c index c4728453..9201e9db 100644 --- a/app/src/behaviors/behavior_macro.c +++ b/app/src/behaviors/behavior_macro.c @@ -225,7 +225,7 @@ static const struct behavior_driver_api behavior_macro_driver_api = { .count = DT_PROP_LEN(inst, bindings), \ .bindings = TRANSFORMED_BEHAVIORS(inst)}; \ DEVICE_DT_DEFINE(inst, behavior_macro_init, NULL, &behavior_macro_state_##inst, \ - &behavior_macro_config_##inst, APPLICATION, \ + &behavior_macro_config_##inst, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_macro_driver_api); DT_FOREACH_STATUS_OKAY(zmk_behavior_macro, MACRO_INST) diff --git a/app/src/behaviors/behavior_mod_morph.c b/app/src/behaviors/behavior_mod_morph.c index d540abd9..0843fce1 100644 --- a/app/src/behaviors/behavior_mod_morph.c +++ b/app/src/behaviors/behavior_mod_morph.c @@ -98,7 +98,7 @@ static int behavior_mod_morph_init(const struct device *dev) { return 0; } }; \ static struct behavior_mod_morph_data behavior_mod_morph_data_##n = {}; \ DEVICE_DT_INST_DEFINE(n, behavior_mod_morph_init, NULL, &behavior_mod_morph_data_##n, \ - &behavior_mod_morph_config_##n, APPLICATION, \ + &behavior_mod_morph_config_##n, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mod_morph_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_momentary_layer.c b/app/src/behaviors/behavior_momentary_layer.c index c2bd0ffc..ff05af01 100644 --- a/app/src/behaviors/behavior_momentary_layer.c +++ b/app/src/behaviors/behavior_momentary_layer.c @@ -40,4 +40,4 @@ static const struct behavior_mo_config behavior_mo_config = {}; static struct behavior_mo_data behavior_mo_data; DEVICE_DT_INST_DEFINE(0, behavior_mo_init, NULL, &behavior_mo_data, &behavior_mo_config, - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mo_driver_api); + POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mo_driver_api); diff --git a/app/src/behaviors/behavior_none.c b/app/src/behaviors/behavior_none.c index 613ecbad..3b8eb27e 100644 --- a/app/src/behaviors/behavior_none.c +++ b/app/src/behaviors/behavior_none.c @@ -33,7 +33,7 @@ static const struct behavior_driver_api behavior_none_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_DT_INST_DEFINE(0, behavior_none_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_none_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_none_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_outputs.c b/app/src/behaviors/behavior_outputs.c index 6ae81a0f..5bf4b87b 100644 --- a/app/src/behaviors/behavior_outputs.c +++ b/app/src/behaviors/behavior_outputs.c @@ -42,7 +42,7 @@ static const struct behavior_driver_api behavior_outputs_driver_api = { .binding_pressed = on_keymap_binding_pressed, }; -DEVICE_DT_INST_DEFINE(0, behavior_out_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_out_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_outputs_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c index 0b983c84..0f47c09c 100644 --- a/app/src/behaviors/behavior_reset.c +++ b/app/src/behaviors/behavior_reset.c @@ -44,7 +44,7 @@ static const struct behavior_driver_api behavior_reset_driver_api = { static const struct behavior_reset_config behavior_reset_config_##n = { \ .type = DT_INST_PROP(n, type)}; \ DEVICE_DT_INST_DEFINE(n, behavior_reset_init, NULL, NULL, &behavior_reset_config_##n, \ - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &behavior_reset_driver_api); DT_INST_FOREACH_STATUS_OKAY(RST_INST) diff --git a/app/src/behaviors/behavior_rgb_underglow.c b/app/src/behaviors/behavior_rgb_underglow.c index 0af07f81..84926c3e 100644 --- a/app/src/behaviors/behavior_rgb_underglow.c +++ b/app/src/behaviors/behavior_rgb_underglow.c @@ -149,7 +149,7 @@ static const struct behavior_driver_api behavior_rgb_underglow_driver_api = { .locality = BEHAVIOR_LOCALITY_GLOBAL, }; -DEVICE_DT_INST_DEFINE(0, behavior_rgb_underglow_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_rgb_underglow_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_rgb_underglow_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_sensor_rotate.c b/app/src/behaviors/behavior_sensor_rotate.c index 822bc206..63eee9de 100644 --- a/app/src/behaviors/behavior_sensor_rotate.c +++ b/app/src/behaviors/behavior_sensor_rotate.c @@ -36,7 +36,7 @@ static int behavior_sensor_rotate_init(const struct device *dev) { return 0; }; }; \ static struct behavior_sensor_rotate_data behavior_sensor_rotate_data_##n = {}; \ DEVICE_DT_INST_DEFINE(n, behavior_sensor_rotate_init, NULL, &behavior_sensor_rotate_data_##n, \ - &behavior_sensor_rotate_config_##n, APPLICATION, \ + &behavior_sensor_rotate_config_##n, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &behavior_sensor_rotate_driver_api); diff --git a/app/src/behaviors/behavior_sensor_rotate_var.c b/app/src/behaviors/behavior_sensor_rotate_var.c index e6d20cab..9907f754 100644 --- a/app/src/behaviors/behavior_sensor_rotate_var.c +++ b/app/src/behaviors/behavior_sensor_rotate_var.c @@ -28,7 +28,7 @@ static int behavior_sensor_rotate_var_init(const struct device *dev) { return 0; static struct behavior_sensor_rotate_data behavior_sensor_rotate_var_data_##n = {}; \ DEVICE_DT_INST_DEFINE( \ n, behavior_sensor_rotate_var_init, NULL, &behavior_sensor_rotate_var_data_##n, \ - &behavior_sensor_rotate_var_config_##n, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + &behavior_sensor_rotate_var_config_##n, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &behavior_sensor_rotate_var_driver_api); DT_INST_FOREACH_STATUS_OKAY(SENSOR_ROTATE_VAR_INST) diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index 6697b9b1..9d13570d 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -258,8 +258,9 @@ static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) { } void behavior_sticky_key_timer_handler(struct k_work *item) { + struct k_work_delayable *d_work = k_work_delayable_from_work(item); struct active_sticky_key *sticky_key = - CONTAINER_OF(item, struct active_sticky_key, release_timer); + CONTAINER_OF(d_work, struct active_sticky_key, release_timer); if (sticky_key->position == ZMK_BHV_STICKY_KEY_POSITION_FREE) { return; } @@ -294,7 +295,7 @@ static struct behavior_sticky_key_data behavior_sticky_key_data; .quick_release = DT_INST_PROP(n, quick_release), \ }; \ DEVICE_DT_INST_DEFINE(n, behavior_sticky_key_init, NULL, &behavior_sticky_key_data, \ - &behavior_sticky_key_config_##n, APPLICATION, \ + &behavior_sticky_key_config_##n, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_sticky_key_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_tap_dance.c b/app/src/behaviors/behavior_tap_dance.c index fc685124..2c1f35ce 100644 --- a/app/src/behaviors/behavior_tap_dance.c +++ b/app/src/behaviors/behavior_tap_dance.c @@ -169,7 +169,9 @@ static int on_tap_dance_binding_released(struct zmk_behavior_binding *binding, } void behavior_tap_dance_timer_handler(struct k_work *item) { - struct active_tap_dance *tap_dance = CONTAINER_OF(item, struct active_tap_dance, release_timer); + struct k_work_delayable *d_work = k_work_delayable_from_work(item); + struct active_tap_dance *tap_dance = + CONTAINER_OF(d_work, struct active_tap_dance, release_timer); if (tap_dance->position == ZMK_BHV_TAP_DANCE_POSITION_FREE) { return; } @@ -251,7 +253,7 @@ static int behavior_tap_dance_init(const struct device *dev) { .behaviors = behavior_tap_dance_config_##n##_bindings, \ .behavior_count = DT_INST_PROP_LEN(n, bindings)}; \ DEVICE_DT_INST_DEFINE(n, behavior_tap_dance_init, NULL, NULL, &behavior_tap_dance_config_##n, \ - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &behavior_tap_dance_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_to_layer.c b/app/src/behaviors/behavior_to_layer.c index c05b83ea..24b3b485 100644 --- a/app/src/behaviors/behavior_to_layer.c +++ b/app/src/behaviors/behavior_to_layer.c @@ -37,7 +37,7 @@ static const struct behavior_driver_api behavior_to_driver_api = { .binding_released = to_keymap_binding_released, }; -DEVICE_DT_INST_DEFINE(0, behavior_to_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_to_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_to_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c index 73a700ed..5c2958ab 100644 --- a/app/src/behaviors/behavior_toggle_layer.c +++ b/app/src/behaviors/behavior_toggle_layer.c @@ -44,6 +44,6 @@ static const struct behavior_tog_config behavior_tog_config = {}; static struct behavior_tog_data behavior_tog_data; DEVICE_DT_INST_DEFINE(0, behavior_tog_init, NULL, &behavior_tog_data, &behavior_tog_config, - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_tog_driver_api); + POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_tog_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_transparent.c b/app/src/behaviors/behavior_transparent.c index eeb2242d..0baeb05f 100644 --- a/app/src/behaviors/behavior_transparent.c +++ b/app/src/behaviors/behavior_transparent.c @@ -33,7 +33,7 @@ static const struct behavior_driver_api behavior_transparent_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_DT_INST_DEFINE(0, behavior_transparent_init, NULL, NULL, NULL, APPLICATION, +DEVICE_DT_INST_DEFINE(0, behavior_transparent_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_transparent_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/ble.c b/app/src/ble.c index 8c991c54..83eb6bc9 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #if IS_ENABLED(CONFIG_SETTINGS) @@ -98,7 +98,7 @@ bool zmk_ble_active_profile_is_open() { } void set_profile_address(uint8_t index, const bt_addr_le_t *addr) { - char setting_name[15]; + char setting_name[17]; char addr_str[BT_ADDR_LE_STR_LEN]; bt_addr_le_to_str(addr, addr_str, sizeof(addr_str)); @@ -603,7 +603,7 @@ static void zmk_ble_ready(int err) { update_advertising(); } -static int zmk_ble_init(const struct device *_arg) { +static int zmk_ble_init(void) { int err = bt_enable(NULL); if (err) { diff --git a/app/src/combo.c b/app/src/combo.c index 0d5c2a6e..d36f7fdd 100644 --- a/app/src/combo.c +++ b/app/src/combo.c @@ -537,7 +537,7 @@ ZMK_SUBSCRIPTION(combo, zmk_keycode_state_changed); DT_INST_FOREACH_CHILD(0, COMBO_INST) -static int combo_init() { +static int combo_init(void) { k_work_init_delayable(&timeout_task, combo_timeout_handler); DT_INST_FOREACH_CHILD(0, INITIALIZE_COMBO); return 0; diff --git a/app/src/display/Kconfig b/app/src/display/Kconfig index a2029481..3e17ff76 100644 --- a/app/src/display/Kconfig +++ b/app/src/display/Kconfig @@ -29,11 +29,11 @@ endchoice config LV_MEM_CUSTOM default y -config LV_Z_MEM_POOL_MIN_SIZE - default 32 +# config LV_Z_MEM_POOL_MIN_SIZE +# default 32 -config LV_Z_MEM_POOL_MAX_SIZE - default 8192 +# config LV_Z_MEM_POOL_MAX_SIZE +# default 8192 choice ZMK_DISPLAY_STATUS_SCREEN prompt "Default status screen for displays" diff --git a/app/src/endpoints.c b/app/src/endpoints.c index 098e04e2..cef273be 100644 --- a/app/src/endpoints.c +++ b/app/src/endpoints.c @@ -302,7 +302,7 @@ static struct zmk_endpoint_instance get_selected_instance(void) { return instance; } -static int zmk_endpoints_init(const struct device *_arg) { +static int zmk_endpoints_init(void) { #if IS_ENABLED(CONFIG_SETTINGS) settings_subsys_init(); diff --git a/app/src/hog.c b/app/src/hog.c index 89a903cb..657df0a8 100644 --- a/app/src/hog.c +++ b/app/src/hog.c @@ -341,7 +341,7 @@ int zmk_hog_send_mouse_report(struct zmk_hid_mouse_report_body *report) { #endif // IS_ENABLED(CONFIG_ZMK_MOUSE) -int zmk_hog_init(const struct device *_arg) { +int zmk_hog_init(void) { static const struct k_work_queue_config queue_config = {.name = "HID Over GATT Send Work"}; k_work_queue_start(&hog_work_q, hog_q_stack, K_THREAD_STACK_SIZEOF(hog_q_stack), CONFIG_ZMK_BLE_THREAD_PRIORITY, &queue_config); diff --git a/app/src/main.c b/app/src/main.c index 3fd6b116..9bd7af32 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -17,14 +17,16 @@ LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -void main(void) { +int main(void) { LOG_INF("Welcome to ZMK!\n"); if (zmk_kscan_init(DEVICE_DT_GET(ZMK_MATRIX_NODE_ID)) != 0) { - return; + return -ENOTSUP; } #ifdef CONFIG_ZMK_DISPLAY zmk_display_init(); #endif /* CONFIG_ZMK_DISPLAY */ + + return 0; } diff --git a/app/src/rgb_underglow.c b/app/src/rgb_underglow.c index b80d4039..febe8015 100644 --- a/app/src/rgb_underglow.c +++ b/app/src/rgb_underglow.c @@ -239,7 +239,7 @@ static void zmk_rgb_underglow_save_state_work() { static struct k_work_delayable underglow_save_work; #endif -static int zmk_rgb_underglow_init(const struct device *_arg) { +static int zmk_rgb_underglow_init(void) { led_strip = DEVICE_DT_GET(STRIP_CHOSEN); #if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER) diff --git a/app/src/sensors.c b/app/src/sensors.c index 60f2bd2a..34fd49e2 100644 --- a/app/src/sensors.c +++ b/app/src/sensors.c @@ -140,7 +140,7 @@ static void zmk_sensors_init_item(uint8_t i) { #define SENSOR_INIT(idx, _t) zmk_sensors_init_item(idx); -static int zmk_sensors_init(const struct device *_arg) { +static int zmk_sensors_init(void) { LISTIFY(ZMK_KEYMAP_SENSORS_LEN, SENSOR_INIT, (), 0) return 0; diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index 860e89a5..b8bc75a7 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -685,7 +685,7 @@ int zmk_split_bt_invoke_behavior(uint8_t source, struct zmk_behavior_binding *bi return split_bt_invoke_behavior_payload(wrapper); } -int zmk_split_bt_central_init(const struct device *_arg) { +static int zmk_split_bt_central_init(void) { k_work_queue_start(&split_central_split_run_q, split_central_split_run_q_stack, K_THREAD_STACK_SIZEOF(split_central_split_run_q_stack), CONFIG_ZMK_BLE_THREAD_PRIORITY, NULL); diff --git a/app/src/split/bluetooth/peripheral.c b/app/src/split/bluetooth/peripheral.c index 1d649f71..3b94aab1 100644 --- a/app/src/split/bluetooth/peripheral.c +++ b/app/src/split/bluetooth/peripheral.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #if IS_ENABLED(CONFIG_SETTINGS) @@ -134,7 +134,7 @@ static struct bt_conn_cb conn_callbacks = { bool zmk_split_bt_peripheral_is_connected() { return is_connected; } -static int zmk_peripheral_ble_init(const struct device *_arg) { +static int zmk_peripheral_ble_init(void) { int err = bt_enable(NULL); if (err) { diff --git a/app/src/split/bluetooth/service.c b/app/src/split/bluetooth/service.c index 620df53e..fc174d23 100644 --- a/app/src/split/bluetooth/service.c +++ b/app/src/split/bluetooth/service.c @@ -227,7 +227,7 @@ int zmk_split_bt_sensor_triggered(uint8_t sensor_index, } #endif /* ZMK_KEYMAP_HAS_SENSORS */ -int service_init(const struct device *_arg) { +static int service_init(void) { static const struct k_work_queue_config queue_config = { .name = "Split Peripheral Notification Queue"}; k_work_queue_start(&service_work_q, service_q_stack, K_THREAD_STACK_SIZEOF(service_q_stack), diff --git a/app/src/usb.c b/app/src/usb.c index 9d27900c..da4b2810 100644 --- a/app/src/usb.c +++ b/app/src/usb.c @@ -65,7 +65,7 @@ void usb_status_cb(enum usb_dc_status_code status, const uint8_t *params) { k_work_submit(&usb_status_notifier_work); }; -static int zmk_usb_init(const struct device *_arg) { +static int zmk_usb_init(void) { int usb_enable_ret; usb_enable_ret = usb_enable(usb_status_cb); diff --git a/app/src/usb_hid.c b/app/src/usb_hid.c index fd58c14b..5b472721 100644 --- a/app/src/usb_hid.c +++ b/app/src/usb_hid.c @@ -142,7 +142,7 @@ int zmk_usb_hid_send_mouse_report() { } #endif // IS_ENABLED(CONFIG_ZMK_MOUSE) -static int zmk_usb_hid_init(const struct device *_arg) { +static int zmk_usb_hid_init(void) { hid_dev = device_get_binding("HID_0"); if (hid_dev == NULL) { LOG_ERR("Unable to locate HID device"); diff --git a/app/src/wpm.c b/app/src/wpm.c index 00a5942e..d906665a 100644 --- a/app/src/wpm.c +++ b/app/src/wpm.c @@ -72,7 +72,7 @@ void wpm_expiry_function() { k_work_submit(&wpm_work); } K_TIMER_DEFINE(wpm_timer, wpm_expiry_function, NULL); -int wpm_init() { +static int wpm_init(void) { wpm_state = 0; wpm_update_counter = 0; k_timer_start(&wpm_timer, K_SECONDS(WPM_UPDATE_INTERVAL_SECONDS), diff --git a/app/west.yml b/app/west.yml index ffa36ca3..e66a89c0 100644 --- a/app/west.yml +++ b/app/west.yml @@ -4,10 +4,12 @@ manifest: url-base: https://github.com/zephyrproject-rtos - name: zmkfirmware url-base: https://github.com/zmkfirmware + - name: petejohanson + url-base: https://github.com/petejohanson projects: - name: zephyr - remote: zmkfirmware - revision: v3.2.0+zmk-fixes + remote: petejohanson + revision: v3.5.0+zmk-fixes clone-depth: 1 import: name-blocklist: @@ -29,6 +31,5 @@ manifest: - openthread - edtt - trusted-firmware-m - - sof self: west-commands: scripts/west-commands.yml