diff --git a/.github/workflows/build-user-config.yml b/.github/workflows/build-user-config.yml index c3aeff20cba..3833abe80f7 100644 --- a/.github/workflows/build-user-config.yml +++ b/.github/workflows/build-user-config.yml @@ -18,26 +18,29 @@ on: default: "bin" required: false type: string + archive_name: + description: 'Archive output file name' + default: 'firmware' + required: false + type: string jobs: matrix: runs-on: ubuntu-latest name: Fetch Build Keyboards outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} + build_matrix: ${{ env.build_matrix }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install yaml2json run: python3 -m pip install remarshal - - id: set-matrix - name: Fetch Build Matrix + - name: Fetch Build Matrix run: | - matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .) - yaml2json ${{ inputs.build_matrix_path }} - echo "::set-output name=matrix::${matrix}" + echo "build_matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .)" >> $GITHUB_ENV + yaml2json ${{ inputs.build_matrix_path }} | jq build: runs-on: ubuntu-latest @@ -47,33 +50,31 @@ jobs: name: Build strategy: fail-fast: false - matrix: ${{fromJson(needs.matrix.outputs.matrix)}} + matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }} steps: - name: Prepare variables - id: variables + shell: sh -x {0} run: | - if [ -n "${{ matrix.shield }}" ]; then - EXTRA_CMAKE_ARGS="-DSHIELD=${{ matrix.shield }}" - ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk" - DISPLAY_NAME="${{ matrix.shield }} - ${{ matrix.board }}" + if [ -n "${{ matrix.shield }}" ] + then + echo "extra_cmake_args=-DSHIELD=\"${{ matrix.shield }}\"" >> $GITHUB_ENV + echo "artifact_name=${{ matrix.shield }}-${{ matrix.board }}-zmk" >> $GITHUB_ENV + echo "display_name=${{ matrix.shield }} - ${{ matrix.board }}" >> $GITHUB_ENV else - EXTRA_CMAKE_ARGS= - DISPLAY_NAME="${{ matrix.board }}" - ARTIFACT_NAME="${{ matrix.board }}-zmk" + echo "extra_cmake_args=" >> $GITHUB_ENV + echo "artifact_name=${{ matrix.board }}-zmk" >> $GITHUB_ENV + echo "display_name=${{ matrix.board }}" >> $GITHUB_ENV fi - echo ::set-output name=extra-cmake-args::${EXTRA_CMAKE_ARGS} - echo ::set-output name=artifact-name::${ARTIFACT_NAME} - echo ::set-output name=display-name::${DISPLAY_NAME} - echo ::set-output name=zephyr-version::${ZEPHYR_VERSION} + echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache west modules - uses: actions/cache@v3.0.1 + uses: actions/cache@v3.0.11 continue-on-error: true env: - cache-name: cache-zephyr-${{ steps.variables.outputs.zephyr-version }}-modules + cache_name: cache-zephyr-${{ env.zephyr_version }}-modules with: path: | modules/ @@ -81,9 +82,9 @@ jobs: zephyr/ bootloader/ zmk/ - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }} + key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build-${{ env.cache_name }}- ${{ runner.os }}-build- ${{ runner.os }}- @@ -96,26 +97,28 @@ jobs: - name: West Zephyr export run: west zephyr-export - - name: West Build (${{ steps.variables.outputs.display-name }}) + - name: West Build (${{ env.display_name }}) + shell: sh -x {0} run: | - west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ steps.variables.outputs.extra-cmake-args }} ${{ matrix.cmake-args }} + west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }} - - name: ${{ steps.variables.outputs.display-name }} Kconfig file - run: cat build/zephyr/.config | grep -v "^#" | grep -v "^$" | sort + - name: ${{ env.display_name }} Kconfig file + run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort - name: Rename artifacts + shell: sh -x {0} run: | mkdir build/artifacts if [ -f build/zephyr/zmk.uf2 ] then - cp build/zephyr/zmk.uf2 "build/artifacts/${{ steps.variables.outputs.artifact-name }}.uf2" + cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2" elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ] then - cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ steps.variables.outputs.artifact-name }}.${{ inputs.fallback_binary }}" + cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}" fi - - name: Archive (${{ steps.variables.outputs.display-name }}) - uses: actions/upload-artifact@v2 + - name: Archive (${{ env.display_name }}) + uses: actions/upload-artifact@v3 with: - name: firmware + name: ${{ inputs.archive_name }} path: build/artifacts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 999aad3a7be..92df03c3cb8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,9 +24,9 @@ jobs: include: ${{ fromJSON(needs.compile-matrix.outputs.include-list) }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache west modules - uses: actions/cache@v2 + uses: actions/cache@v3.0.2 env: cache-name: cache-zephyr-modules with: @@ -35,11 +35,11 @@ jobs: tools/ zephyr/ bootloader/ - key: 4-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }} restore-keys: | - 4-${{ runner.os }}-build-${{ env.cache-name }}- - 4-${{ runner.os }}-build- - 4-${{ runner.os }}- + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- timeout-minutes: 2 continue-on-error: true - name: Initialize workspace (west init) @@ -71,7 +71,7 @@ jobs: for (const shieldArgs of buildShieldArgs) { try { - const output = execSync(`west build -s app -p -b ${{ matrix.board }} -- ${shieldArgs.shield ? '-DSHIELD=' + shieldArgs.shield : ''} ${shieldArgs['cmake-args'] || ''}`); + const output = execSync(`west build -s app -p -b ${{ matrix.board }} -- ${shieldArgs.shield ? '-DSHIELD="' + shieldArgs.shield + '"' : ''} ${shieldArgs['cmake-args'] || ''}`); console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Build`) console.log(output.toString()); @@ -151,7 +151,7 @@ jobs: core-include: ${{ steps.core-list.outputs.result }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v2 with: @@ -180,7 +180,7 @@ jobs: boards-include: ${{ steps.boards-list.outputs.result }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v2 with: @@ -246,6 +246,9 @@ jobs: return hm.requires.flatMap(i => metadata.interconnects[i].boards.flatMap(b => boardAndShield(b, hm)) ); + } else { + console.warn("Unhandled shield without keys"); + return []; } break; case "interconnect": @@ -304,7 +307,7 @@ jobs: organized-metadata: ${{ steps.organize-metadata.outputs.result }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v2 with: diff --git a/.github/workflows/clang-format-lint.yml b/.github/workflows/clang-format-lint.yml index 375bcd4e521..8c2cfbcfced 100644 --- a/.github/workflows/clang-format-lint.yml +++ b/.github/workflows/clang-format-lint.yml @@ -22,7 +22,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: DoozyX/clang-format-lint-action@v0.13 with: source: "./app" diff --git a/.github/workflows/doc-checks.yml b/.github/workflows/doc-checks.yml index a9b2d5ae0f6..d048a03e0ab 100644 --- a/.github/workflows/doc-checks.yml +++ b/.github/workflows/doc-checks.yml @@ -14,7 +14,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: bahmutov/npm-install@v1 with: working-directory: docs @@ -24,7 +24,7 @@ jobs: prettier: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: bahmutov/npm-install@v1 with: working-directory: docs @@ -34,7 +34,7 @@ jobs: typecheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: bahmutov/npm-install@v1 with: working-directory: docs diff --git a/.github/workflows/hardware-metadata-validation.yml b/.github/workflows/hardware-metadata-validation.yml index 7b5ec92719f..c6566feb932 100644 --- a/.github/workflows/hardware-metadata-validation.yml +++ b/.github/workflows/hardware-metadata-validation.yml @@ -18,8 +18,8 @@ jobs: check-metadata-format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - uses: bahmutov/npm-install@v1 with: working-directory: app @@ -31,7 +31,7 @@ jobs: container: image: docker.io/zmkfirmware/zmk-dev-arm:3.0 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies run: pip install -r app/scripts/requirements.txt - name: West init diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 61bf71831d0..38c61eeaf56 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Find test directories id: test-dirs run: | @@ -36,9 +36,9 @@ jobs: image: docker.io/zmkfirmware/zmk-build-arm:3.0 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache west modules - uses: actions/cache@v2 + uses: actions/cache@v3.0.2 env: cache-name: cache-zephyr-modules with: @@ -47,11 +47,11 @@ jobs: tools/ zephyr/ bootloader/ - key: 4-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }} restore-keys: | - 4-${{ runner.os }}-build-${{ env.cache-name }}- - 4-${{ runner.os }}-build- - 4-${{ runner.os }}- + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- timeout-minutes: 2 continue-on-error: true - name: Initialize workspace (west init) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 1492be16c83..da6554951e2 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,18 +1,16 @@ cmake_minimum_required(VERSION 3.13.1) set(CONFIG_APPLICATION_DEFINED_SYSCALL true) -list(APPEND BOARD_ROOT ${CMAKE_SOURCE_DIR}) -list(APPEND DTS_ROOT ${CMAKE_SOURCE_DIR}) # Add our custom Zephyr module for drivers w/ syscalls, etc. list(APPEND DTS_ROOT ${CMAKE_SOURCE_DIR}/drivers/zephyr) +set(ZephyrBuildConfiguration_ROOT ${CMAKE_SOURCE_DIR}/cmake) + list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/drivers ) -include(cmake/zmk_config.cmake) - # Find Zephyr. This also loads Zephyr's build system. find_package(Zephyr REQUIRED HINTS ../zephyr) project(zmk) @@ -26,26 +24,28 @@ target_sources(app PRIVATE src/stdlib.c) target_sources(app PRIVATE src/activity.c) target_sources(app PRIVATE src/kscan.c) target_sources(app PRIVATE src/matrix_transform.c) -target_sources(app PRIVATE src/hid.c) +target_sources(app PRIVATE src/mouse/key_listener.c) +target_sources(app PRIVATE src/mouse/main.c) +target_sources(app PRIVATE src/mouse/tick_listener.c) target_sources(app PRIVATE src/sensors.c) target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/wpm.c) target_sources(app PRIVATE src/event_manager.c) target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/ext_power_generic.c) target_sources(app PRIVATE src/events/activity_state_changed.c) target_sources(app PRIVATE src/events/position_state_changed.c) -target_sources(app PRIVATE src/events/layer_state_changed.c) -target_sources(app PRIVATE src/events/keycode_state_changed.c) -target_sources(app PRIVATE src/events/modifiers_state_changed.c) -target_sources(app PRIVATE src/events/endpoint_selection_changed.c) target_sources(app PRIVATE src/events/sensor_event.c) +target_sources(app PRIVATE src/events/mouse_button_state_changed.c) +target_sources(app PRIVATE src/events/mouse_move_state_changed.c) +target_sources(app PRIVATE src/events/mouse_tick.c) +target_sources(app PRIVATE src/events/mouse_scroll_state_changed.c) target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/events/wpm_state_changed.c) -target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c) -target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c) target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/events/usb_conn_state_changed.c) target_sources(app PRIVATE src/behaviors/behavior_reset.c) target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/behaviors/behavior_ext_power.c) -if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) +if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL) + target_sources(app PRIVATE src/hid.c) target_sources(app PRIVATE src/behaviors/behavior_key_press.c) + target_sources_ifdef(CONFIG_ZMK_BEHAVIOR_KEY_TOGGLE app PRIVATE src/behaviors/behavior_key_toggle.c) target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c) target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c) target_sources(app PRIVATE src/behaviors/behavior_caps_word.c) @@ -54,36 +54,47 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c) target_sources(app PRIVATE src/behaviors/behavior_mod_morph.c) target_sources(app PRIVATE src/behaviors/behavior_outputs.c) - target_sources(app PRIVATE src/behaviors/behavior_tap_dance.c) target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c) target_sources(app PRIVATE src/behaviors/behavior_to_layer.c) target_sources(app PRIVATE src/behaviors/behavior_transparent.c) target_sources(app PRIVATE src/behaviors/behavior_none.c) target_sources(app PRIVATE src/behaviors/behavior_sensor_rotate_key_press.c) + target_sources(app PRIVATE src/behaviors/behavior_mouse_key_press.c) + target_sources(app PRIVATE src/behaviors/behavior_mouse_move.c) + target_sources(app PRIVATE src/behaviors/behavior_mouse_scroll.c) target_sources(app PRIVATE src/combo.c) + target_sources(app PRIVATE src/behaviors/behavior_tap_dance.c) target_sources(app PRIVATE src/behavior_queue.c) target_sources(app PRIVATE src/conditional_layer.c) + target_sources(app PRIVATE src/endpoints.c) + target_sources(app PRIVATE src/events/endpoint_selection_changed.c) + target_sources(app PRIVATE src/hid_listener.c) target_sources(app PRIVATE src/keymap.c) + target_sources(app PRIVATE src/events/layer_state_changed.c) + target_sources(app PRIVATE src/events/modifiers_state_changed.c) + target_sources(app PRIVATE src/events/keycode_state_changed.c) + + if (CONFIG_ZMK_BLE) + target_sources(app PRIVATE src/events/ble_active_profile_changed.c) + target_sources(app PRIVATE src/behaviors/behavior_bt.c) + target_sources(app PRIVATE src/ble.c) + target_sources(app PRIVATE src/hog.c) + endif() endif() + target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior_rgb_underglow.c) target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/behaviors/behavior_backlight.c) -target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/behaviors/behavior_bt.c) -target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c) + +target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c) -if (CONFIG_ZMK_SPLIT_BLE AND (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)) - target_sources(app PRIVATE src/split_listener.c) - target_sources(app PRIVATE src/split/bluetooth/service.c) -endif() -if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) - target_sources(app PRIVATE src/split/bluetooth/central.c) -endif() + +target_sources_ifdef(CONFIG_ZMK_SPLIT app PRIVATE src/events/split_peripheral_status_changed.c) +add_subdirectory(src/split) + target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/usb.c) target_sources_ifdef(CONFIG_ZMK_USB app PRIVATE src/usb_hid.c) -target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c) target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c) target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/backlight.c) -target_sources(app PRIVATE src/endpoints.c) -target_sources(app PRIVATE src/hid_listener.c) target_sources(app PRIVATE src/main.c) add_subdirectory(src/display/) diff --git a/app/Kconfig b/app/Kconfig index 9b47c4c21fb..7a58f8406be 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -25,6 +25,18 @@ config USB_DEVICE_PID config USB_DEVICE_MANUFACTURER default "ZMK Project" +config BT_DIS_PNP_VID + default 0x1D50 + +config BT_DIS_PNP_PID + default 0x615E + +config BT_DIS_MODEL + default ZMK_KEYBOARD_NAME + +config BT_DIS_MANUF + default "ZMK Project" + menu "HID" choice ZMK_HID_REPORT_TYPE @@ -127,6 +139,10 @@ config ZMK_BLE_CONSUMER_REPORT_QUEUE_SIZE int "Max number of consumer HID reports to queue for sending over BLE" default 5 +config ZMK_BLE_MOUSE_REPORT_QUEUE_SIZE + int "Max number of mouse HID reports to queue for sending over BLE" + default 20 + config ZMK_BLE_CLEAR_BONDS_ON_START bool "Configuration that clears all bond information from the keyboard on startup." default n @@ -166,108 +182,7 @@ endmenu # HID endmenu -menu "Split Support" - -config ZMK_SPLIT - bool "Split keyboard support" - -if ZMK_SPLIT - -menuconfig ZMK_SPLIT_BLE - bool "Split keyboard support via BLE transport" - depends on ZMK_BLE - default y - select BT_USER_PHY_UPDATE - select BT_AUTO_PHY_UPDATE - -if ZMK_SPLIT_BLE - -menuconfig ZMK_SPLIT_BLE_ROLE_CENTRAL - bool "Central" - select BT_CENTRAL - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC - -if ZMK_SPLIT_BLE_ROLE_CENTRAL - -config ZMK_SPLIT_BLE_CENTRAL_POSITION_QUEUE_SIZE - int "Max number of key position state events to queue when received from peripherals" - default 5 - -config ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_STACK_SIZE - int "BLE split central write thread stack size" - default 512 - -config ZMK_BLE_SPLIT_CENTRAL_SPLIT_RUN_QUEUE_SIZE - int "Max number of behavior run events to queue to send to the peripheral(s)" - default 5 - -endif - -if !ZMK_SPLIT_BLE_ROLE_CENTRAL - -config ZMK_SPLIT_BLE_PERIPHERAL_STACK_SIZE - int "BLE split peripheral notify thread stack size" - default 650 - -config ZMK_SPLIT_BLE_PERIPHERAL_PRIORITY - int "BLE split peripheral notify thread priority" - default 5 - -config ZMK_SPLIT_BLE_PERIPHERAL_POSITION_QUEUE_SIZE - int "Max number of key position state events to queue to send to the central" - default 10 - -config ZMK_USB - default n - -config BT_MAX_PAIRED - default 1 - -config BT_MAX_CONN - default 1 - -config BT_PERIPHERAL_PREF_MAX_INT - default 6 - -#!ZMK_SPLIT_BLE_ROLE_CENTRAL -endif - -#ZMK_SPLIT_BLE -endif - -#ZMK_SPLIT -endif - -if ZMK_BLE - -if ZMK_SPLIT_BLE && ZMK_SPLIT_BLE_ROLE_CENTRAL - -config BT_MAX_CONN - default 6 - -config BT_MAX_PAIRED - default 6 - -#ZMK_SPLIT_BLE && ZMK_SPLIT_BLE_ROLE_CENTRAL -endif - -if !ZMK_SPLIT_BLE - -config BT_MAX_CONN - default 5 - -config BT_MAX_PAIRED - default 5 - -#!ZMK_SPLIT_BLE -endif - -#ZMK_BLE -endif - -#Split Support -endmenu +rsource "src/split/Kconfig" #Basic Keyboard Setup endmenu @@ -344,6 +259,13 @@ config ZMK_RGB_UNDERGLOW_ON_START bool "RGB underglow starts on by default" default y +config ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE + bool "Turn off RGB underglow when keyboard goes into idle state" + +config ZMK_RGB_UNDERGLOW_AUTO_OFF_USB + bool "Turn off RGB underglow when USB is disconnected" + depends on USB_DEVICE_STACK + #ZMK_RGB_UNDERGLOW endif @@ -379,6 +301,13 @@ endif #Display/LED Options endmenu +menu "Mouse Options" + +rsource "src/mouse/Kconfig" + +#Mouse Options +endmenu + menu "Power Management" config ZMK_IDLE_TIMEOUT @@ -431,6 +360,12 @@ config ZMK_BEHAVIORS_QUEUE_SIZE int "Maximum number of behaviors to allow queueing from a macro or other complex behavior" default 64 +DT_COMPAT_ZMK_BEHAVIOR_KEY_TOGGLE := zmk,behavior-key-toggle + +config ZMK_BEHAVIOR_KEY_TOGGLE + bool + default $(dt_compat_enabled,$(DT_COMPAT_ZMK_BEHAVIOR_KEY_TOGGLE)) + endmenu menu "Advanced" @@ -518,6 +453,11 @@ config ZMK_SETTINGS_SAVE_DEBOUNCE #SETTINGS endif +config ZMK_BATTERY_REPORT_INTERVAL + depends on ZMK_BLE + int "Battery level report interval in seconds" + default 60 + #Advanced endmenu diff --git a/app/boards/arm/bdn9/bdn9_rev2.dts b/app/boards/arm/bdn9/bdn9_rev2.dts index 8a66be070cc..e75893d6469 100644 --- a/app/boards/arm/bdn9/bdn9_rev2.dts +++ b/app/boards/arm/bdn9/bdn9_rev2.dts @@ -72,7 +72,7 @@ &spi2 { status = "okay"; - pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>; + pinctrl-0 = <&spi2_sck_pb13 &spi2_mosi_pb15>; pinctrl-names = "default"; led_strip: ws2812@0 { diff --git a/app/boards/arm/mikoto/mikoto_520.dts b/app/boards/arm/mikoto/mikoto_520.dts index 44321e792fa..49d9d6beb33 100644 --- a/app/boards/arm/mikoto/mikoto_520.dts +++ b/app/boards/arm/mikoto/mikoto_520.dts @@ -38,7 +38,7 @@ vbatt: vbatt { compatible = "zmk,battery-voltage-divider"; label = "BATTERY"; - io-channels = <&adc 2>; + io-channels = <&adc 1>; output-ohms = <10000000>; full-ohms = <(10000000 + 4000000)>; }; diff --git a/app/boards/arm/nrfmicro/Kconfig b/app/boards/arm/nrfmicro/Kconfig index 35019722315..12b06621781 100644 --- a/app/boards/arm/nrfmicro/Kconfig +++ b/app/boards/arm/nrfmicro/Kconfig @@ -2,9 +2,9 @@ config BOARD_ENABLE_DCDC bool "Enable DCDC mode" select SOC_DCDC_NRF52X default y - depends on (BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13) + depends on (BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833) config BOARD_NRFMICRO_CHARGER bool "Enable battery charger" default y - depends on (BOARD_NRFMICRO_13) + depends on (BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833) diff --git a/app/boards/arm/nrfmicro/Kconfig.board b/app/boards/arm/nrfmicro/Kconfig.board index 36b2d55e8bc..244242a9360 100644 --- a/app/boards/arm/nrfmicro/Kconfig.board +++ b/app/boards/arm/nrfmicro/Kconfig.board @@ -14,3 +14,7 @@ config BOARD_NRFMICRO_11_FLIPPED config BOARD_NRFMICRO_13 bool "nrfmicro_13" depends on SOC_NRF52840_QIAA + +config BOARD_NRFMICRO_13_52833 + bool "nrfmicro_13_52833" + depends on SOC_NRF52833_QIAA diff --git a/app/boards/arm/nrfmicro/Kconfig.defconfig b/app/boards/arm/nrfmicro/Kconfig.defconfig index 159d9ade014..751d592b955 100644 --- a/app/boards/arm/nrfmicro/Kconfig.defconfig +++ b/app/boards/arm/nrfmicro/Kconfig.defconfig @@ -3,7 +3,7 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT -if BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 +if BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833 config BOARD default "nrfmicro" @@ -27,11 +27,11 @@ config ZMK_USB config PINMUX default y -if BOARD_NRFMICRO_13 +if BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833 config BOARD_NRFMICRO_CHARGER default y -endif # BOARD_NRFMICRO_13 +endif # BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833 -endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 +endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833 diff --git a/app/boards/arm/nrfmicro/arduino_pro_micro_pins_52833.dtsi b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_52833.dtsi new file mode 100644 index 00000000000..651edb94166 --- /dev/null +++ b/app/boards/arm/nrfmicro/arduino_pro_micro_pins_52833.dtsi @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + + +/ { + pro_micro: connector { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 8 0> /* D0 */ + , <1 0 &gpio0 6 0> /* D1 */ + , <2 0 &gpio0 15 0> /* D2 */ + , <3 0 &gpio0 17 0> /* D3 */ + , <4 0 &gpio0 20 0> /* D4/A6 */ + , <5 0 &gpio0 13 0> /* D5 */ + , <6 0 &gpio0 24 0> /* D6/A7 */ + , <7 0 &gpio0 9 0> /* D7 */ + , <8 0 &gpio0 10 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio1 4 0> /* D10/A10 */ + , <16 0 &gpio0 28 0> /* D16 */ + , <14 0 &gpio0 3 0> /* D14 */ + , <15 0 &gpio1 5 0> /* D15 */ + , <18 0 &gpio0 2 0> /* D18/A0 */ + , <19 0 &gpio0 29 0> /* D19/A1 */ + , <20 0 &gpio0 31 0> /* D20/A2 */ + , <21 0 &gpio0 30 0> /* D21/A3 */ + ; + }; + + pro_micro_a: connector_a { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 2 0> /* D18/A0 */ + , <1 0 &gpio0 29 0> /* D19/A1 */ + , <2 0 &gpio0 31 0> /* D20/A2 */ + , <3 0 &gpio0 30 0> /* D21/A3 */ + , <6 0 &gpio0 20 0> /* D4/A6 */ + , <7 0 &gpio0 24 0> /* D6/A7 */ + , <8 0 &gpio0 10 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio1 11 0> /* D10/A10 */ + ; + }; +}; + + +pro_micro_d: &pro_micro {}; +pro_micro_i2c: &i2c0 {}; +pro_micro_spi: &spi0 {}; +pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/nrfmicro/nrfmicro_13_52833.dts b/app/boards/arm/nrfmicro/nrfmicro_13_52833.dts new file mode 100644 index 00000000000..7f833ff555f --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_13_52833.dts @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include "arduino_pro_micro_pins_52833.dtsi" + +/ { + model = "nrfmicro"; + compatible = "joric,nrfmicro"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &cdc_acm_uart; + zmk,battery = &vbatt; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + + ext-power { + compatible = "zmk,ext-power-generic"; + label = "EXT_POWER"; + control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + }; + + vbatt: vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "BATTERY"; + io-channels = <&adc 2>; + output-ohms = <2000000>; + full-ohms = <(2000000 + 820000)>; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + sda-pin = <15>; + scl-pin = <17>; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + tx-pin = <6>; + rx-pin = <8>; +}; + +&usbd { + status = "okay"; + cdc_acm_uart: cdc_acm_uart { + compatible = "zephyr,cdc-acm-uart"; + label = "CDC_ACM_0"; + }; +}; + + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + sd_partition: partition@0 { + label = "softdevice"; + reg = <0x00000000 0x00026000>; + }; + code_partition: partition@26000 { + label = "code_partition"; + reg = <0x00026000 0x00046000>; + }; + + /* + * The flash starting at 0x0006c000 and ending at + * 0x00073fff is reserved for use by the application. + */ + + /* + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@6c000 { + label = "storage"; + reg = <0x0006c000 0x00008000>; + }; + + boot_partition: partition@74000 { + label = "adafruit_boot"; + reg = <0x00074000 0x0000c000>; + }; + }; +}; diff --git a/app/boards/arm/nrfmicro/nrfmicro_13_52833.yaml b/app/boards/arm/nrfmicro/nrfmicro_13_52833.yaml new file mode 100644 index 00000000000..768a59c9c40 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_13_52833.yaml @@ -0,0 +1,15 @@ +identifier: nrfmicro_13_52833 +name: nrfmicro_13_52833 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/nrfmicro/nrfmicro_13_52833.zmk.yml b/app/boards/arm/nrfmicro/nrfmicro_13_52833.zmk.yml new file mode 100644 index 00000000000..757ff860a1c --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_13_52833.zmk.yml @@ -0,0 +1,10 @@ +file_format: "1" +id: nrfmicro_13_52833 +name: nRFMicro 1.3/1.4 (nRF52833) +type: board +arch: arm +outputs: + - usb + - ble +url: https://github.com/joric/nrfmicro/ +exposes: [pro_micro] diff --git a/app/boards/arm/nrfmicro/nrfmicro_13_52833_defconfig b/app/boards/arm/nrfmicro/nrfmicro_13_52833_defconfig new file mode 100644 index 00000000000..112e0344ae4 --- /dev/null +++ b/app/boards/arm/nrfmicro/nrfmicro_13_52833_defconfig @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52833_QIAA=y +CONFIG_BOARD_NRFMICRO_13_52833=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_BUILD_OUTPUT_UF2=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y +CONFIG_CLOCK_CONTROL_NRF=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y diff --git a/app/boards/arm/nrfmicro/pinmux.c b/app/boards/arm/nrfmicro/pinmux.c index dc3bf6c235e..ef5b5521324 100644 --- a/app/boards/arm/nrfmicro/pinmux.c +++ b/app/boards/arm/nrfmicro/pinmux.c @@ -14,7 +14,7 @@ static int pinmux_nrfmicro_init(const struct device *port) { ARG_UNUSED(port); -#if CONFIG_BOARD_NRFMICRO_13 +#if (CONFIG_BOARD_NRFMICRO_13 || CONFIG_BOARD_NRFMICRO_13_52833) const struct device *p0 = device_get_binding("GPIO_0"); #if CONFIG_BOARD_NRFMICRO_CHARGER gpio_pin_configure(p0, 5, GPIO_OUTPUT); diff --git a/app/boards/arm/planck/planck_rev6.keymap b/app/boards/arm/planck/planck_rev6.keymap index 47e63dc0a35..bbfb770e3a9 100644 --- a/app/boards/arm/planck/planck_rev6.keymap +++ b/app/boards/arm/planck/planck_rev6.keymap @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + #include #include @@ -6,16 +12,34 @@ compatible = "zmk,keymap"; default_layer { -// ----------------------------------------------------------------------------------------- -// | TAB | Q | W | E | R | T | Y | U | I | O | P | BSPC | -// | ESC | A | S | D | F | G | H | J | K | L | ; | ' | -// | SHIFT | Z | X | C | V | B | N | M | , | . | / | RET | -// | FN | LGUI | LALT | LCTL | LOWR | SPACE | RAIS | LARW | DARW | UARW | RARW | + // ----------------------------------------------------------------------------------------- + // | TAB | Q | W | E | R | T | Y | U | I | O | P | BSPC | + // | ESC | A | S | D | F | G | H | J | K | L | ; | ' | + // | SHIFT | Z | X | C | V | B | N | M | , | . | / | RET | + // | | LCTL | LALT | LGUI | LOWR | SPACE | RAIS | LARW | DARW | UARW | RARW | + bindings = < + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC + &kp ESC &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SLASH &kp RET + &trans &kp LCTL &kp LALT &kp LGUI &mo 1 &trans &kp SPACE &mo 2 &kp LEFT &kp DOWN &kp UP &kp RIGHT + >; + }; + + lower { + bindings = < + &kp LS(GRAVE) &kp LS(N1) &kp LS(N2) &kp LS(N3) &kp LS(N4) &kp LS(N5) &kp LS(N6) &kp LS(N7) &kp LS(N8) &kp LS(N9) &kp LS(N0) &kp DEL + &kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE + &trans &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp LS(HASH) &kp LS(BSLH) &kp HOME &kp END &trans + &trans &trans &trans &trans &trans &trans &trans &trans &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PP + >; + }; + + raise { bindings = < - &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp DEL - &kp ESC &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT - &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp BSLH &kp RET - &trans &kp LGUI &kp LALT &kp LCTRL &trans &trans &kp SPACE &trans &kp LEFT &kp DOWN &kp UP &kp RIGHT + &kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC + &kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH + &trans &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp HASH &kp BSLH &kp PG_UP &kp PG_DN &trans + &reset &bootloader &trans &trans &trans &trans &trans &trans &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PP >; }; }; diff --git a/app/boards/arm/puchi_ble/CMakeLists.txt b/app/boards/arm/puchi_ble/CMakeLists.txt new file mode 100644 index 00000000000..12cf9b1cf1a --- /dev/null +++ b/app/boards/arm/puchi_ble/CMakeLists.txt @@ -0,0 +1,6 @@ + +if(CONFIG_PINMUX) +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) +endif() \ No newline at end of file diff --git a/app/boards/arm/puchi_ble/Kconfig b/app/boards/arm/puchi_ble/Kconfig new file mode 100644 index 00000000000..719c3845721 --- /dev/null +++ b/app/boards/arm/puchi_ble/Kconfig @@ -0,0 +1,3 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + diff --git a/app/boards/arm/puchi_ble/Kconfig.board b/app/boards/arm/puchi_ble/Kconfig.board new file mode 100644 index 00000000000..0763888513f --- /dev/null +++ b/app/boards/arm/puchi_ble/Kconfig.board @@ -0,0 +1,8 @@ +# Puchi-BLE board configuration + +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config BOARD_PUCHI_BLE_v1 + bool "puchi_ble_v1" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/puchi_ble/Kconfig.defconfig b/app/boards/arm/puchi_ble/Kconfig.defconfig new file mode 100644 index 00000000000..94d12c17b63 --- /dev/null +++ b/app/boards/arm/puchi_ble/Kconfig.defconfig @@ -0,0 +1,28 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if BOARD_PUCHI_BLE_v1 + +config BOARD + default "puchi_ble" + +if USB_DEVICE_STACK + +config USB_NRFX + default y + +endif # USB_DEVICE_STACK + +config BT_CTLR + default BT + +config ZMK_BLE + default y + +config ZMK_USB + default y + +config PINMUX + default y + +endif # BOARD_PUCHI_BLE_v1 diff --git a/app/boards/arm/puchi_ble/arduino_pro_micro_pins.dtsi b/app/boards/arm/puchi_ble/arduino_pro_micro_pins.dtsi new file mode 100644 index 00000000000..ed3317f1c73 --- /dev/null +++ b/app/boards/arm/puchi_ble/arduino_pro_micro_pins.dtsi @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + + +/ { + pro_micro: connector { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 8 0> /* D0 */ + , <1 0 &gpio0 6 0> /* D1 */ + , <2 0 &gpio0 15 0> /* D2 */ + , <3 0 &gpio0 17 0> /* D3 */ + , <4 0 &gpio0 20 0> /* D4/A6 */ + , <5 0 &gpio0 13 0> /* D5 */ + , <6 0 &gpio0 24 0> /* D6/A7 */ + , <7 0 &gpio0 9 0> /* D7 */ + , <8 0 &gpio0 10 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio1 11 0> /* D10/A10 */ + , <16 0 &gpio0 28 0> /* D16 */ + , <14 0 &gpio0 3 0> /* D14 */ + , <15 0 &gpio1 13 0> /* D15 */ + , <18 0 &gpio0 2 0> /* D18/A0 */ + , <19 0 &gpio0 29 0> /* D19/A1 */ + , <20 0 &gpio0 31 0> /* D20/A2 */ + , <21 0 &gpio0 30 0> /* D21/A3 */ + ; + }; + + pro_micro_a: connector_a { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 2 0> /* D18/A0 */ + , <1 0 &gpio0 29 0> /* D19/A1 */ + , <2 0 &gpio0 31 0> /* D20/A2 */ + , <3 0 &gpio0 30 0> /* D21/A3 */ + , <6 0 &gpio0 20 0> /* D4/A6 */ + , <7 0 &gpio0 24 0> /* D6/A7 */ + , <8 0 &gpio0 10 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio1 11 0> /* D10/A10 */ + ; + }; +}; + + +pro_micro_d: &pro_micro {}; +pro_micro_i2c: &i2c0 {}; +pro_micro_spi: &spi0 {}; +pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/puchi_ble/board.cmake b/app/boards/arm/puchi_ble/board.cmake new file mode 100644 index 00000000000..3b5c4aeafa1 --- /dev/null +++ b/app/boards/arm/puchi_ble/board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") +include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/app/boards/arm/puchi_ble/pinmux.c b/app/boards/arm/puchi_ble/pinmux.c new file mode 100644 index 00000000000..78cea3141f8 --- /dev/null +++ b/app/boards/arm/puchi_ble/pinmux.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include +#include + +static int pinmux_puchi_ble_init(const struct device *port) { + ARG_UNUSED(port); + +#if CONFIG_BOARD_PUCHI_BLE_v1 + const struct device *p0 = device_get_binding("GPIO_0"); +#if CONFIG_BOARD_PUCHI_BLE_CHARGER + gpio_pin_configure(p0, 5, GPIO_OUTPUT); + gpio_pin_set(p0, 5, 0); +#else + gpio_pin_configure(p0, 5, GPIO_INPUT); +#endif +#endif + return 0; +} + +SYS_INIT(pinmux_puchi_ble_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/app/boards/arm/puchi_ble/puchi_ble_v1.dts b/app/boards/arm/puchi_ble/puchi_ble_v1.dts new file mode 100644 index 00000000000..e324cccc1dc --- /dev/null +++ b/app/boards/arm/puchi_ble/puchi_ble_v1.dts @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include "arduino_pro_micro_pins.dtsi" + +/ { + model = "puchi_ble"; + compatible = "puchi_ble"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &cdc_acm_uart; + zmk,battery = &vbatt; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + + ext-power { + compatible = "zmk,ext-power-generic"; + label = "EXT_POWER"; + control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + }; + + vbatt: vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "BATTERY"; + io-channels = <&adc 2>; + output-ohms = <2000000>; + full-ohms = <(2000000 + 820000)>; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + sda-pin = <15>; + scl-pin = <17>; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + tx-pin = <6>; + rx-pin = <8>; +}; + +&usbd { + status = "okay"; + cdc_acm_uart: cdc_acm_uart { + compatible = "zephyr,cdc-acm-uart"; + label = "CDC_ACM_0"; + }; +}; + + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + sd_partition: partition@0 { + label = "softdevice"; + reg = <0x00000000 0x00026000>; + }; + code_partition: partition@26000 { + label = "code_partition"; + reg = <0x00026000 0x000c6000>; + }; + + /* + * The flash starting at 0x000ec000 and ending at + * 0x000f3fff is reserved for use by the application. + */ + + /* + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@ec000 { + label = "storage"; + reg = <0x000ec000 0x00008000>; + }; + + boot_partition: partition@f4000 { + label = "adafruit_boot"; + reg = <0x000f4000 0x0000c000>; + }; + }; +}; diff --git a/app/boards/arm/puchi_ble/puchi_ble_v1.yaml b/app/boards/arm/puchi_ble/puchi_ble_v1.yaml new file mode 100644 index 00000000000..18770722242 --- /dev/null +++ b/app/boards/arm/puchi_ble/puchi_ble_v1.yaml @@ -0,0 +1,15 @@ +identifier: puchi_ble_v1 +name: puchi_ble_v1 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/puchi_ble/puchi_ble_v1.zmk.yml b/app/boards/arm/puchi_ble/puchi_ble_v1.zmk.yml new file mode 100644 index 00000000000..f3114008043 --- /dev/null +++ b/app/boards/arm/puchi_ble/puchi_ble_v1.zmk.yml @@ -0,0 +1,10 @@ +file_format: "1" +id: puchi_ble_v1 +name: Puchi-BLE V1 +type: board +arch: arm +outputs: + - usb + - ble +url: https://keycapsss.com/keyboard-parts/mcu-controller/202/puchi-ble-wireless-microcontroller +exposes: [pro_micro] diff --git a/app/boards/arm/puchi_ble/puchi_ble_v1_defconfig b/app/boards/arm/puchi_ble/puchi_ble_v1_defconfig new file mode 100644 index 00000000000..e32886d0596 --- /dev/null +++ b/app/boards/arm/puchi_ble/puchi_ble_v1_defconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_PUCHI_BLE_v1=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_BUILD_OUTPUT_UF2=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y +CONFIG_CLOCK_CONTROL_NRF=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y diff --git a/app/boards/seeeduino_xiao_ble.conf b/app/boards/seeeduino_xiao_ble.conf index 92367028cbe..205f67e9127 100644 --- a/app/boards/seeeduino_xiao_ble.conf +++ b/app/boards/seeeduino_xiao_ble.conf @@ -6,3 +6,10 @@ CONFIG_UART_INTERRUPT_DRIVEN=n CONFIG_ZMK_USB=y CONFIG_ZMK_BLE=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y \ No newline at end of file diff --git a/app/boards/shields/a_dux/Kconfig.defconfig b/app/boards/shields/a_dux/Kconfig.defconfig index 3d77a5f8423..53cd1986517 100644 --- a/app/boards/shields/a_dux/Kconfig.defconfig +++ b/app/boards/shields/a_dux/Kconfig.defconfig @@ -6,7 +6,7 @@ if SHIELD_A_DUX_LEFT config ZMK_KEYBOARD_NAME default "A. Dux" -config ZMK_SPLIT_BLE_ROLE_CENTRAL +config ZMK_SPLIT_ROLE_CENTRAL default y endif diff --git a/app/boards/shields/a_dux/a_dux.dtsi b/app/boards/shields/a_dux/a_dux.dtsi index 4c28d655bb6..4840227ccde 100644 --- a/app/boards/shields/a_dux/a_dux.dtsi +++ b/app/boards/shields/a_dux/a_dux.dtsi @@ -29,23 +29,23 @@ compatible = "zmk,kscan-gpio-direct"; label = "KSCAN"; input-gpios = - <&pro_micro_d 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_a 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_a 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_a 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_a 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_d 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + <&pro_micro 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 20 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> ; }; diff --git a/app/boards/shields/bfo9000/Kconfig.defconfig b/app/boards/shields/bfo9000/Kconfig.defconfig index c927ea2d3e2..7e9ccf9ce5b 100644 --- a/app/boards/shields/bfo9000/Kconfig.defconfig +++ b/app/boards/shields/bfo9000/Kconfig.defconfig @@ -6,7 +6,7 @@ if SHIELD_BFO9000_LEFT config ZMK_KEYBOARD_NAME default "BFO-9000" -config ZMK_SPLIT_BLE_ROLE_CENTRAL +config ZMK_SPLIT_ROLE_CENTRAL default y endif diff --git a/app/boards/shields/clog/Kconfig.defconfig b/app/boards/shields/clog/Kconfig.defconfig index 60ef47e4aab..1ca779f3ff1 100644 --- a/app/boards/shields/clog/Kconfig.defconfig +++ b/app/boards/shields/clog/Kconfig.defconfig @@ -6,7 +6,7 @@ if SHIELD_CLOG_LEFT config ZMK_KEYBOARD_NAME default "Clog" -config ZMK_SPLIT_BLE_ROLE_CENTRAL +config ZMK_SPLIT_ROLE_CENTRAL default y endif diff --git a/app/boards/shields/corne/Kconfig.defconfig b/app/boards/shields/corne/Kconfig.defconfig index 35bc29910ae..9160555ca31 100644 --- a/app/boards/shields/corne/Kconfig.defconfig +++ b/app/boards/shields/corne/Kconfig.defconfig @@ -3,7 +3,7 @@ if SHIELD_CORNE_LEFT config ZMK_KEYBOARD_NAME default "Corne" -config ZMK_SPLIT_BLE_ROLE_CENTRAL +config ZMK_SPLIT_ROLE_CENTRAL default y endif @@ -12,7 +12,7 @@ if SHIELD_CORNE_LEFT || SHIELD_CORNE_RIGHT config ZMK_SPLIT default y - + if ZMK_DISPLAY config I2C @@ -28,12 +28,6 @@ endif # ZMK_DISPLAY if LVGL -config LVGL_HOR_RES_MAX - default 128 - -config LVGL_VER_RES_MAX - default 32 - config LVGL_VDB_SIZE default 64 diff --git a/app/boards/shields/corne/boards/nrfmicro_13.overlay b/app/boards/shields/corne/boards/nrfmicro_13.overlay new file mode 100644 index 00000000000..b2e5d04edfc --- /dev/null +++ b/app/boards/shields/corne/boards/nrfmicro_13.overlay @@ -0,0 +1,39 @@ +#include + + +&spi1 { + + compatible = "nordic,nrf-spim"; + /* Cannot be used together with i2c0. */ + status = "okay"; + mosi-pin = <6>; //gpio 0.06 + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <5>; + miso-pin = <7>; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; + spi-max-frequency = <5250000>; + + /* WS2812 */ + chain-length = <27>; /* number of LEDs */ + spi-one-frame = <0x70>; /* make sure to configure this properly for your SOC */ + spi-zero-frame = <0x40>; /* make sure to configure this properly for your SOC */ + color-mapping = ; + }; +}; + +/ { + + chosen { + zmk,underglow = &led_strip; + zmk,battery = &vbatt; + }; + +}; diff --git a/app/boards/shields/corne/corne.conf b/app/boards/shields/corne/corne.conf index 974243c8aea..27fc79f741e 100644 --- a/app/boards/shields/corne/corne.conf +++ b/app/boards/shields/corne/corne.conf @@ -1,6 +1,36 @@ # Uncomment the following lines to enable the Corne RGB Underglow -# CONFIG_ZMK_RGB_UNDERGLOW=y -# CONFIG_WS2812_STRIP=y +CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific to the LEDs you're using +CONFIG_WS2812_STRIP=y # Uncomment the following line to enable the Corne OLED Display -# CONFIG_ZMK_DISPLAY=y +CONFIG_ZMK_DISPLAY=y +#CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=n + +# Enable a widget to show words per minute +# CONFIG_ZMK_WIDGET_WPM_STATUS=n + +# CONFIG_ZMK_WIDGET_LAYER_STATUS=n +# CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS=n + +# Bongo cat +# CONFIG_ZMK_WIDGET_BONGO_CAT=y + +# Mouse key +CONFIG_ZMK_MOUSE=y + + + + + +# OLED Reverse "black on white" or "white on black" +CONFIG_SSD1306_REVERSE_MODE=y + +# Milliseconds of inactivity before entering idle state (10 minute) +CONFIG_ZMK_IDLE_TIMEOUT=600000 + +# Enable deep sleep support +CONFIG_ZMK_SLEEP=y + +# Milliseconds of inactivity before entering deep sleep (15 minutes) +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 diff --git a/app/boards/shields/corne/corne.keymap b/app/boards/shields/corne/corne.keymap index 53218a860c6..7806161a765 100644 --- a/app/boards/shields/corne/corne.keymap +++ b/app/boards/shields/corne/corne.keymap @@ -3,54 +3,121 @@ * * SPDX-License-Identifier: MIT */ +/* THIS FILE WAS GENERATED! + * + * This file was generated automatically. You may or may not want to + * edit it directly + */ #include #include #include +#include +#include +#include +#include +#include +#define LOWER 1 +#define RAISE 2 +#define SHIFT 3 +#define OPTION 4 +#define LOCK 5 +&mmv { + time-to-max-speed-ms = <1000>; + acceleration-exponent=<1>; +}; +&mwh { + time-to-max-speed-ms = <2000>; + acceleration-exponent=<0>; +}; / { - keymap { - compatible = "zmk,keymap"; + behaviors { + hm: homerow_mods { + compatible = "zmk,behavior-hold-tap"; + label = "homerow mods"; + #binding-cells = <2>; + tapping_term_ms = <200>; + flavor = "tap-preferred"; + bindings = + <&kp>, + <&kp>; + }; + }; + + conditional_layers { + compatible = "zmk,conditional-layers"; + + tri_layer { + if-layers = ; + then-layer =