aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2024-02-24 20:03:05 -0700
committerJack Sangdahl <[email protected]>2024-02-24 20:03:05 -0700
commitdb727a2a8f11d4bc902962758e8fa55da900c4fd (patch)
tree8716c2eee2ca092a07059886c0b0d1cabc7deb74
parent63ecc3f8801c12899158d13f51348e8ea9a63a7c (diff)
downloadzmk_build-db727a2a8f11d4bc902962758e8fa55da900c4fd.tar.gz
zmk_build-db727a2a8f11d4bc902962758e8fa55da900c4fd.zip
update build script
-rw-r--r--.editorconfig5
-rwxr-xr-xbuild.sh143
-rw-r--r--config/revxlp.conf (renamed from revxlp/revxlp.conf)0
-rw-r--r--config/revxlp.keymap99
4 files changed, 150 insertions, 97 deletions
diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 700021d..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,5 +0,0 @@
-root = true
-[*]
-charset = utf-8
-indent_style = space
-indent_size = 2
diff --git a/build.sh b/build.sh
index 231beb9..ac7fcd2 100755
--- a/build.sh
+++ b/build.sh
@@ -1,99 +1,58 @@
#!/bin/sh
-ZSDK_VERSION=0.13.2
-LINK=~/waffle_git/zmk/app/boards/shields/revxlp
-CONFIG_DIR=~/waffle_git/zmk-build/config
ZMK_DIR=~/waffle_git/zmk
-
-update() {
- (cd $ZMK_DIR ; git pull ; west update)
- wget "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-linux-x86_64-setup.run"
- chmod +x zephyr-toolchain-arm-${ZSDK_VERSION}-linux-x86_64-setup.run
- ./zephyr-toolchain-arm-${ZSDK_VERSION}-linux-x86_64-setup.run -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION}
- rm zephyr-toolchain-arm-${ZSDK_VERSION}-linux-x86_64-setup.run
-}
-
-read -p "update? (y/n) " -n 1 -r
-if [[ $REPLY =~ ^[Yy]$ ]]
-then
- update
-fi
+source $ZMK_DIR/.venv/bin/activate
build() {
- (cd $ZMK_DIR/app
- west build -p -b $1 -- -DSHIELD=$2 -DZMK_CONFIG="$3" 1> /dev/null
- cp build/zephyr/zmk.uf2 ~/$2_$1.uf2
- )
-}
+ printf "building $1 for $2...\n"
+ (cd $ZMK_DIR/app
+ west build -p always -b $2 -- -DSHIELD=$1 \
+ -DZMK_CONFIG="$HOME/waffle_git/zmk-build/config" \
+ &> /dev/null
-flash() {
- read -p "flash? (y/n) " -n 1 -r
- if [[ $REPLY =~ ^[Yy]$ ]]; then
- if (( $3 )); then
- printf "\nflashing left half...\n"
- fi
- sleep 10
- doas mount /dev/sdb /tmp/disk
- doas cp ~/$1.uf2 /tmp/disk
- doas umount /dev/sdb
- printf "success :^)"
- if (( $3 )); then
- printf "\nflashing right half...\n"
- sleep 30
- doas mount /dev/sdb /tmp/disk
- doas cp ~/$2.uf2 /tmp/disk
- doas umount /dev/sdb
- printf "success :^)"
- fi
- fi
+ read -p "flash? (y/n) " yn
+ case $yn in
+ [Yy]*)
+ printf "enter bootloader...\n"
+ mkdir tmp
+ sleep 10
+ doas mount /dev/sdb tmp
+ doas cp build/zephyr/zmk.uf2 tmp
+ doas umount /dev/sdb
+ rmdir tmp
+ ;;
+ [Nn]*) cp build/zephyr/zmk.uf2 ~/$1.uf2 ;;
+ * ) printf "invalid entry\n" ;;
+ esac
+ )
+ printf "complete\n"
}
-printf "\n"
-PS3="choose keyboard to build: "
-options=("corne" "revxlp" "sweep" "settings reset" "quit")
-select opt in "${options[@]}"
-do
- case $opt in
- "corne")
- printf "building corne firmware...\n"
- build nice_nano corne_left $CONFIG_DIR
- build nice_nano_v2 corne_right $CONFIG_DIR
- flash corne_left_nice_nano corne_right_nice_nano_v2 2
- printf "\ncomplete :^)"
- break
- ;;
- "revxlp")
- printf "building revxlp firmware...\n"
- cp config/corne.keymap revxlp/revxlp.keymap
- cp util.h $ZMK_DIR/app/boards/shields
- if [ ! -L $LINK ]; then
- ln -s ~/waffle_git/zmk-build/revxlp $LINK
- fi
- build seeeduino_xiao_ble revxlp
- rm revxlp/revxlp.keymap
- rm $ZMK_DIR/app/boards/shields/util.h
- flash revxlp_seeduino_xiao_ble
- printf "\ncomplete :^)"
- break
- ;;
- "sweep")
- printf "building aurora sweep firmware...\n"
- build nice_nano_v2 splitkb_aurora_sweep_left $CONFIG_DIR
- build nice_nano_v2 splitkb_aurora_sweep_right $CONFIG_DIR
- flash splitkb_aurora_sweep_left_nice_nano_v2 splitkb_aurora_sweep_right_nice_nano_v2 2
- printf "\ncomplete :^)"
- break
- ;;
- "settings reset")
- printf "building settings reset firmware...\n"
- build nice_nano settings_reset v1
- build nice_nano_v2 settings_reset v2
- build seeeduino_xiao_ble settings_reset xiao
- printf "\ncomplete :^)"
- break
- ;;
- "quit")
- break
- ;;
- *) printf "invalid option: $REPLY";;
- esac
-done
+printf "firmware to build...\n"
+printf "(1) corne\t(2) revxlp\t(3) sweep\t(4) settings reset:\t"
+read opt;
+case $opt in
+ 1)
+ build corne_left nice_nano
+ build corne_right nice_nano_v2
+ ;;
+ 2)
+ build revxlp seeeduino_xiao_ble
+ ;;
+ 3)
+ build splitkb_aurora_sweep_left nice_nano_v2
+ build splitkb_aurora_sweep_right nice_nano_v2
+ ;;
+ 4)
+ printf "select microcontroller...\n"
+ printf "(1) nice nano\t(2) nice nano v2\t(3) xiao ble:\t"
+ read val;
+ case $val in
+ 1) MCU="nice_nano" ;;
+ 2) MCU="nice_nano_v2" ;;
+ 3) MCU="seeeduino_xiao_ble" ;;
+ *) printf "invalid entry\n" ;;
+ esac
+ build settings_reset $MCU
+ ;;
+ *) printf "invalid entry\n" ;;
+esac
diff --git a/revxlp/revxlp.conf b/config/revxlp.conf
index dfa521c..dfa521c 100644
--- a/revxlp/revxlp.conf
+++ b/config/revxlp.conf
diff --git a/config/revxlp.keymap b/config/revxlp.keymap
new file mode 100644
index 0000000..9c1ea89
--- /dev/null
+++ b/config/revxlp.keymap
@@ -0,0 +1,99 @@
+// Copyright 2022 jack (@waffle87)
+// SPDX-License-Identifier: MIT
+
+#include <behaviors.dtsi>
+#include <dt-bindings/zmk/keys.h>
+#include <dt-bindings/zmk/bt.h>
+#include "util.h"
+
+&lt {
+ tapping-term-ms = <100>;
+};
+
+/ {
+ keymap {
+ compatible = "zmk,keymap";
+ 0 {
+ bindings = <
+ &none &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &none
+ &none HRML(A, S, D, F) &kp G &kp H HRMR(J, K, L, SEMI) &none
+ &none &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &trans
+ &updir &lt 1 ESC &kp SPACE &kp BSPC &lt 2 RS(RC(V)) &pnp
+ >;
+ };
+ 1 {
+ bindings = <
+ &trans &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &trans
+ &trans HRML(EXCL, AT, HASH, DLLR) &kp PRCNT &kp CARET HRMR(AMPS, ASTRK, LPAR, RPAR) &trans
+ &trans &kp C_VOL_DN &kp TAB &kp CAPS &kp TILDE &kp GRAVE &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp C_VOL_UP &trans
+ &none &trans &none &none &none &none
+ >;
+ };
+ 2 {
+ bindings = <
+ &trans &bootloader &bt BT_NXT &none &none &none &none &none &none &none &none &trans
+ &trans &bt BT_CLR &bt BT_PRV &none &none &none &none &none &none &none &none &trans
+ &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &trans
+ &none &none &none &none &trans &none
+ >;
+ };
+ };
+
+ behaviors {
+ hm: homerow_mods {
+ compatible = "zmk,behavior-hold-tap";
+ label = "HOMEROW_MODS";
+ #binding-cells = <2>;
+ tapping-term-ms = <130>;
+ quick-tap-ms = <160>;
+ flavor = "tap-preferred";
+ bindings = <&kp>, <&kp>;
+ };
+
+ pnp: play_next_prev {
+ compatible = "zmk,behavior-tap-dance";
+ label = "PLAY_NEXT_PREV";
+ #binding-cells = <0>;
+ tapping-term-ms = <210>;
+ bindings = <&kp C_PLAY>, <&kp C_NEXT>, <&kp C_PREV>;
+ };
+ TAP_DANCE(bsls_pipe, &kp BSLH, &kp PIPE)
+ TAP_DANCE(quot_dquo, &kp SQT, &kp DQT)
+ TAP_DANCE(cbrkt, &kp LBRC, &kp RBRC)
+ TAP_DANCE(brkt, &kp LBKT, &kp RBKT)
+ TAP_DANCE(min_dash, &kp MINUS, &emdash)
+ };
+
+ macros {
+ updir: updir {
+ label = "UP_DIR";
+ compatible = "zmk,behavior-macro";
+ #binding-cells = <0>;
+ bindings = <&macro_tap &kp DOT &kp DOT &kp FSLH>;
+ };
+ emdash: emdash {
+ label = "EM_DASH";
+ compatible = "zmk,behavior-macro";
+ #binding-cells = <0>;
+ bindings = <&macro_press &kp LSHFT &kp LCTRL>,
+ <&macro_tap &kp U &kp N2 &kp N0 &kp N1 &kp N4>,
+ <&macro_release &kp LSHFT &kp LCTRL>;
+ };
+ };
+
+ combos {
+ compatible = "zmk,combos";
+ // name output pos.
+ COMBO(ru_ent, &kp RET, 4 7)
+ COMBO(dk_eql, &kp EQUAL, 15 20)
+ COMBO(gh_quot, &td_quot_dquo, 17 18)
+ COMBO(ty_coln, &kp COLON, 5 6)
+ COMBO(bn_unds, &kp UNDER, 29 30)
+ COMBO(er_cbkt, &td_cbrkt, 3 4)
+ COMBO(ui_brkt, &td_brkt, 7 8)
+ COMBO(ccom_plus, &kp PLUS, 27 32)
+ COMBO(ei_bsls, &td_bsls_pipe, 3 8)
+ COMBO(vm_mins, &td_min_dash, 28 31)
+ COMBO(fj_capw, &caps_word, 16 19)
+ };
+};