Skip to content

Instantly share code, notes, and snippets.

@ypsilon-takai
Last active April 16, 2022 14:54
Show Gist options
  • Save ypsilon-takai/2825718a7a1adfb9c56354af8659595c to your computer and use it in GitHub Desktop.
Save ypsilon-takai/2825718a7a1adfb9c56354af8659595c to your computer and use it in GitHub Desktop.
ZMKファームウェアの使いかた

ZMKの使いかた:GitHubのActionで作る編

情報

ZMKのドキュメントはよく作られていてここにある。

ファームウェアーを作る

ZMKでファームを作る方法は2つある。 1つはGitHubのActionを使う方法で、サポートしているHWを使うのであれば、キーマップを作るだけでファームを作ることができる。

Github Actionを使う

手順については(ここ)[https://zmk.dev/docs/user-setup#summary]を参照。

対象としているシステムは明言していないが、環境作成要のスクリプトとして.sh と .ps1 が用意されているので,Linux, Mac, Windows で利用可能だろうと思われる。

  1. githubのリポジトリを作る 空でよい
  2. スクリプトを実行 bash -c "$(curl -fsSL https://zmk.dev/setup.sh)" ダウンロードしてみると、なかなか複雑なシェルスクリプトです。 大砲HWの変更などもありそうですから、上記のコマンドのままつかうのがよさそうです。

実行時のログ

bash -c "$(curl -fsSL https://zmk.dev/setup.sh)"

Keyboard Selection:
1) 2% Milk                   15) CRBN Featherlight         29) Kyria 
...
Pick a keyboard: 13

MCU Board Selection:
1) BlueMicro840 v1           4) nice!nano v2             
...
Pick an MCU board: 4
Copy in the stock keymap for customization? [Yn]: Y
GitHub Username (leave empty to skip GitHub repo creation):

Preparing a user config for:
* MCU Board: nice_nano_v2
* Shield(s): corne_left corne_right
* Copy Keymap?: ✓

Continue? [Yn]: Y
Cloning into 'zmk-config'...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 30 (delta 5), reused 22 (delta 3), pack-reused 0
Unpacking objects: 100% (30/30), 5.26 KiB | 41.00 KiB/s, done.
~/workspace/keyboard/crkbd/zmk-config/config ~/workspace/keyboard/crkbd/zmk-config
Downloading config file (https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/corne/corne.conf)
Downloading keymap file (https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/corne/corne.keymap)
~/workspace/keyboard/crkbd/zmk-config
Initialized empty Git repository in /home/yosi/workspace/keyboard/crkbd/zmk-config/.git/
[master (root-commit) 4b26e7c] Initial User Config.
5 files changed, 182 insertions(+)
create mode 100644 .github/workflows/build.yml
create mode 100644 build.yaml
create mode 100644 config/corne.conf
create mode 100644 config/corne.keymap
create mode 100644 config/west.yml

できあがったディレクトリはこのような構成

─ zmk-config
├── build.yaml
└── config
    ├── corne.conf
    ├── corne.keymap
    └── west.yml

僕の使っているリポジトリはここです。

  1. キーマップの変更 生成されたキーマップファイル(corne.keymap)を編集して好みの配列にする。

  2. githubにプッシュしてファームを生成 githubにプッシュすると、定義されたActionが動いてファームがGitHub上に生成されます。

nice!nanoにファームを転送する

nice!nanoにファームを転送する方法は、他のボードが必要としているような外部のツールが不要になっていて、簡単です。

PCにUSBで接続した状態で、リセットボタンをダブルクリックします。 すると、リセットされて、ボードがUSBストレージとしてPC側から見えるようになります。

この状態でファームを転送すると、ボードにロードされ、自動で再起動がかかります。

これでファームの読込みは終了です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment