Compare commits

..

5 Commits

Author SHA1 Message Date
8d870812a3 Add instructions for building locally 2024-06-05 20:18:20 -07:00
6b8cb53402 Remove github actions workflows
These don't seem to work when running on Gitea, so let's just prevent
them from running.
2024-06-05 20:18:20 -07:00
cb75a136dd Initial configuration for the Pseudacris board
Some checks failed
Hardware Metadata Validation / validate-metadata (push) Successful in 8m5s
pre-commit / pre-commit (push) Failing after 43s
2024-06-05 08:02:48 -07:00
6cb4d21879 Add missing and fix some existing keys 2024-06-05 08:02:48 -07:00
febfa887dd Initial shield config and keymap for Chrysemys 2024-06-05 08:02:48 -07:00
27 changed files with 1045 additions and 889 deletions

View File

@ -1,10 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/docs"
schedule:
interval: "daily"

View File

@ -1,15 +0,0 @@
<!-- If you're adding a board/shield please fill out this check-list, otherwise you can delete it -->
## Board/Shield Check-list
- [ ] This board/shield is tested working on real hardware
- [ ] Definitions follow the general style of other shields/boards upstream ([Reference](https://zmk.dev/docs/development/new-shield))
- [ ] `.zmk.yml` metadata file added
- [ ] Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
- [ ] General consistent formatting of DeviceTree files
- [ ] Keymaps do not use deprecated key defines (Check using the [upgrader tool](https://zmk.dev/docs/codes/keymap-upgrader))
- [ ] `&pro_micro` used in favor of `&pro_micro_d/a` if applicable
- [ ] If split, no name added for the right/peripheral half
- [ ] Kconfig.defconfig file correctly wraps _all_ configuration in conditional on the shield symbol
- [ ] `.conf` file has optional extra features commented out
- [ ] Keyboard/PCB is part of a shipped group buy or is generally available in stock to purchase (OSH/personal projects without general availability should create a zmk-config repo instead)

View File

@ -1,78 +0,0 @@
name: BLE Tests
on:
push:
paths:
- ".github/workflows/ble-test.yml"
- "app/tests/ble/**"
- "app/src/**"
- "app/run-ble-test.sh"
pull_request:
paths:
- ".github/workflows/ble-test.yml"
- "app/tests/ble/**"
- "app/src/**"
- "app/run-ble-test.sh"
jobs:
collect-tests:
outputs:
test-dirs: ${{ steps.test-dirs.outputs.test-dirs }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find test directories
id: test-dirs
run: |
cd app/tests/ble
export TESTS=$(ls -d * | grep -v central | jq -R -s -c 'split("\n")[:-1]')
echo "test-dirs=${TESTS}" > $GITHUB_OUTPUT
run-tests:
needs: collect-tests
strategy:
matrix:
test: ${{ fromJSON(needs.collect-tests.outputs.test-dirs) }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:3.5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache west modules
uses: actions/cache@v4
env:
cache-name: cache-zephyr-modules
with:
path: |
modules/
tools/
zephyr/
bootloader/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
timeout-minutes: 2
continue-on-error: true
- name: Initialize workspace (west init)
run: west init -l app
- name: Enable babblesim group filter
run: west config manifest.group-filter -- +babblesim
- name: Update modules (west update)
run: west update
- name: Export Zephyr CMake package (west zephyr-export)
run: west zephyr-export
- name: Build BabbleSim components
working-directory: tools/bsim
run: make everything
- name: Test ${{ matrix.test }}
working-directory: app
run: BSIM_COMPONENTS_PATH="${GITHUB_WORKSPACE}/tools/bsim/components" BSIM_OUT_PATH="${GITHUB_WORKSPACE}/tools/bsim" ./run-ble-test.sh tests/ble/${{ matrix.test }}
- name: Archive artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.test }}-log-files"
path: app/build/**/*.log

View File

@ -1,182 +0,0 @@
name: Reusable user config build
on:
workflow_call:
inputs:
build_matrix_path:
description: "Path to the build matrix file"
default: "build.yaml"
required: false
type: string
config_path:
description: "Path to the config directory"
default: "config"
required: false
type: string
fallback_binary:
description: "Fallback binary format, if no *.uf2 file was built"
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:
build_matrix: ${{ env.build_matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install yaml2json
run: python3 -m pip install remarshal
- name: Fetch Build Matrix
run: |
echo "build_matrix=$(yaml2json '${{ inputs.build_matrix_path }}' | jq -c .)" >> $GITHUB_ENV
yaml2json "${{ inputs.build_matrix_path }}" | jq
build:
runs-on: ubuntu-latest
container:
image: zmkfirmware/zmk-build-arm:stable
needs: matrix
name: Build
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.build_matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create build directory
run: |
echo "build_dir=$(mktemp -d)" >> $GITHUB_ENV
- name: Prepare variables
shell: sh -x {0}
env:
board: ${{ matrix.board }}
shield: ${{ matrix.shield }}
artifact_name: ${{ matrix.artifact-name }}
snippet: ${{ matrix.snippet }}
run: |
if [ -e zephyr/module.yml ]; then
export zmk_load_arg=" -DZMK_EXTRA_MODULES='${GITHUB_WORKSPACE}'"
new_tmp_dir="${TMPDIR:-/tmp}/zmk-config"
mkdir -p "${new_tmp_dir}"
echo "base_dir=${new_tmp_dir}" >> $GITHUB_ENV
else
echo "base_dir=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
fi
if [ -n "${snippet}" ]; then
extra_west_args="-S \"${snippet}\""
fi
echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV
echo "extra_west_args=${extra_west_args}" >> $GITHUB_ENV
echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}${zmk_load_arg}" >> $GITHUB_ENV
echo "display_name=${shield:+$shield - }${board}" >> $GITHUB_ENV
echo "artifact_name=${artifact_name:-${shield:+$shield-}${board}-zmk}" >> $GITHUB_ENV
- name: Copy config files to isolated temporary directory
run: |
if [ "${{ env.base_dir }}" != "${GITHUB_WORKSPACE}" ]; then
mkdir "${{ env.base_dir }}/${{ inputs.config_path }}"
cp -R ${{ inputs.config_path }}/* "${{ env.base_dir }}/${{ inputs.config_path }}/"
fi
- name: Cache west modules
uses: actions/cache@v4
continue-on-error: true
env:
cache_name: cache-zephyr-${{ env.zephyr_version }}-modules
with:
path: |
${{ env.base_dir }}/modules/
${{ env.base_dir }}/tools/
${{ env.base_dir }}/zephyr/
${{ env.base_dir }}/bootloader/
${{ env.base_dir }}/zmk/
key: ${{ runner.os }}-build-${{ env.cache_name }}-${{ hashFiles('**/west.yml', '**/build.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache_name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: West Init
working-directory: ${{ env.base_dir }}
run: west init -l "${{ env.base_dir }}/${{ inputs.config_path }}"
- name: West Update
working-directory: ${{ env.base_dir }}
run: west update
- name: West Zephyr export
working-directory: ${{ env.base_dir }}
run: west zephyr-export
- name: West Build (${{ env.display_name }})
working-directory: ${{ env.base_dir }}
shell: sh -x {0}
run: west build -s zmk/app -d "${{ env.build_dir }}" -b "${{ matrix.board }}" ${{ env.extra_west_args }} -- -DZMK_CONFIG=${{ env.base_dir }}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }}
- name: ${{ env.display_name }} Kconfig file
run: |
if [ -f "${{ env.build_dir }}/zephyr/.config" ]
then
grep -v -e "^#" -e "^$" "${{ env.build_dir }}/zephyr/.config" | sort
else
echo "No Kconfig output"
fi
if: ${{ !cancelled() }}
- name: ${{ env.display_name }} Devicetree file
run: |
if [ -f "${{ env.build_dir }}/zephyr/zephyr.dts" ]
then
cat "${{ env.build_dir }}/zephyr/zephyr.dts"
elif [ -f "${{ env.build_dir }}/zephyr/zephyr.dts.pre" ]
then
cat -s "${{ env.build_dir }}/zephyr/zephyr.dts.pre"
else
echo "No Devicetree output"
fi
if: ${{ !cancelled() }}
- name: Rename artifacts
shell: sh -x {0}
run: |
mkdir "${{ env.build_dir }}/artifacts"
if [ -f "${{ env.build_dir }}/zephyr/zmk.uf2" ]
then
cp "${{ env.build_dir }}/zephyr/zmk.uf2" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}.uf2"
elif [ -f "${{ env.build_dir }}/zephyr/zmk.${{ inputs.fallback_binary }}" ]
then
cp "${{ env.build_dir }}/zephyr/zmk.${{ inputs.fallback_binary }}" "${{ env.build_dir }}/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}"
fi
- name: Archive (${{ env.display_name }})
uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.artifact_name }}
path: ${{ env.build_dir }}/artifacts
merge:
runs-on: ubuntu-latest
needs: build
name: Merge Output Artifacts
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: ${{ inputs.archive_name }}
pattern: artifact-*
delete-merged: true

View File

@ -1,438 +0,0 @@
name: Build
on:
push:
paths:
- ".github/workflows/build.yml"
- "app/**"
pull_request:
paths:
- ".github/workflows/build.yml"
- "app/**"
schedule:
- cron: "22 4 * * *"
jobs:
build:
if: ${{ always() }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:3.5
needs: compile-matrix
strategy:
matrix:
include: ${{ fromJSON(needs.compile-matrix.outputs.include-list) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache west modules
uses: actions/cache@v4
env:
cache-name: cache-zephyr-modules
with:
path: |
modules/
tools/
zephyr/
bootloader/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
timeout-minutes: 2
continue-on-error: true
- name: Initialize workspace (west init)
run: west init -l app
- name: Update modules (west update)
run: west update
- name: Export Zephyr CMake package (west zephyr-export)
run: west zephyr-export
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "14.x"
- name: Install @actions/artifact
run: npm install @actions/artifact
- name: Build
uses: actions/github-script@v7
id: boards-list
with:
script: |
const fs = require('fs');
const execSync = require('child_process').execSync;
const buildShieldArgs = JSON.parse(`${{ matrix.shieldArgs }}`);
let error = false;
for (const shieldArgs of buildShieldArgs) {
try {
console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Build`)
const output = execSync(`west build -s app -p -b ${{ matrix.board }} -- ${shieldArgs.shield ? '-DSHIELD="' + shieldArgs.shield + '"' : ''} ${shieldArgs['cmake-args'] || ''}`);
console.log(output.toString());
} catch (e) {
console.error(`::error::Failed to build ${{ matrix.board }} ${shieldArgs.shield} ${shieldArgs['cmake-args']}`);
console.error(e);
error = true;
} finally {
console.log('::endgroup::');
}
}
if (error) {
throw new Error('Failed to build one or more configurations');
}
- name: Upload artifacts
uses: actions/github-script@v7
continue-on-error: ${{ github.event_name == 'pull_request' }}
id: boards-upload
with:
script: |
const fs = require('fs');
const {default: artifact} = require('@actions/artifact');
const buildShieldArgs = JSON.parse(`${{ matrix.shieldArgs }}`);
let error = false;
for (const shieldArgs of buildShieldArgs) {
try {
console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Upload`)
const fileExtensions = ["hex", "uf2"];
const files = fileExtensions
.map(extension => "build/zephyr/zmk." + extension)
.filter(path => fs.existsSync(path));
const rootDirectory = 'build/zephyr';
const options = {
continueOnError: true
}
const cmakeName = shieldArgs['cmake-args'] ? '-' + (shieldArgs.nickname || shieldArgs['cmake-args'].split(' ').join('')) : '';
const artifactName = `${{ matrix.board }}${shieldArgs.shield ? '-' + shieldArgs.shield : ''}${cmakeName}-zmk`;
await artifact.uploadArtifact(artifactName, files, rootDirectory, options);
} catch (e) {
console.error(`::error::Failed to upload ${{ matrix.board }} ${shieldArgs.shield} ${shieldArgs['cmake-args']}`);
console.error(e);
error = true;
} finally {
console.log('::endgroup::');
}
}
if (error) {
throw new Error('Failed to build one or more configurations');
}
compile-matrix:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [core-coverage, board-changes, nightly]
outputs:
include-list: ${{ steps.compile-list.outputs.result }}
steps:
- name: Join build lists
uses: actions/github-script@v7
id: compile-list
with:
script: |
const coreCoverage = `${{ needs.core-coverage.outputs.core-include }}` || "[]";
const boardChanges = `${{ needs.board-changes.outputs.boards-include }}` || "[]";
const nightly = `${{ needs.nightly.outputs.nightly-include }}` || "[]";
const combined = [
...JSON.parse(coreCoverage),
...JSON.parse(boardChanges),
...JSON.parse(nightly)
];
const combinedUnique = [...new Map(combined.map(el => [JSON.stringify(el), el])).values()];
const perBoard = {};
for (const configuration of combinedUnique) {
if (!perBoard[configuration.board])
perBoard[configuration.board] = [];
perBoard[configuration.board].push({
shield: configuration.shield,
'cmake-args': configuration['cmake-args'],
nickname: configuration.nickname
})
}
return Object.entries(perBoard).map(([board, shieldArgs]) => ({
board,
shieldArgs: JSON.stringify(shieldArgs),
}));
core-coverage:
if: ${{ needs.get-changed-files.outputs.core-changes == 'true' }}
runs-on: ubuntu-latest
needs: get-changed-files
outputs:
core-include: ${{ steps.core-list.outputs.result }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "14.x"
- name: Install js-yaml
run: npm install js-yaml
- uses: actions/github-script@v7
id: core-list
with:
script: |
const fs = require('fs');
const yaml = require('js-yaml');
const coreCoverage = yaml.load(fs.readFileSync('app/core-coverage.yml', 'utf8'));
let include = coreCoverage.board.flatMap(board =>
coreCoverage.shield.map(shield => ({ board, shield }))
);
return [...include, ...coreCoverage.include];
board-changes:
if: ${{ needs.get-changed-files.outputs.board-changes == 'true' }}
runs-on: ubuntu-latest
needs: [get-grouped-hardware, get-changed-files]
outputs:
boards-include: ${{ steps.boards-list.outputs.result }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "14.x"
- name: Install js-yaml
run: npm install js-yaml
- uses: actions/github-script@v7
id: boards-list
with:
script: |
const fs = require('fs');
const yaml = require('js-yaml');
const changedFiles = JSON.parse(`${{ needs.get-changed-files.outputs.changed-files }}`);
const metadata = JSON.parse(`${{ needs.get-grouped-hardware.outputs.organized-metadata }}`);
const boardChanges = new Set(changedFiles.filter(f => f.startsWith('app/boards')).map(f => f.split('/').slice(0, 4).join('/')));
return (await Promise.all([...boardChanges].flatMap(async bc => {
const globber = await glob.create(bc + "/*.zmk.yml");
const files = await globber.glob();
const aggregated = files.flatMap((f) =>
yaml.loadAll(fs.readFileSync(f, "utf8"))
);
const boardAndShield = (b, s) => {
if (s.siblings) {
return s.siblings.map(shield => ({
board: b.id,
shield,
}));
} else {
return {
board: b.id,
shield: s.id
};
}
}
return aggregated.flatMap(hm => {
switch (hm.type) {
case "board":
if (hm.features && hm.features.includes("keys")) {
if (hm.siblings) {
return hm.siblings.map(board => ({
board,
}));
} else {
return {
board: hm.id
};
}
} else if (hm.exposes) {
return hm.exposes.flatMap(i =>
metadata.interconnects[i].shields.flatMap(s => boardAndShield(hm, s))
);
} else {
console.error("Board without keys or interconnect");
}
break;
case "shield":
if (hm.features && hm.features.includes("keys")) {
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":
return [];
}
});
}))).flat();
nightly:
if: ${{ github.event_name == 'schedule' }}
runs-on: ubuntu-latest
needs: get-grouped-hardware
outputs:
nightly-include: ${{ steps.nightly-list.outputs.result }}
steps:
- name: Create nightly list
uses: actions/github-script@v7
id: nightly-list
with:
script: |
const metadata = JSON.parse(`${{ needs.get-grouped-hardware.outputs.organized-metadata }}`);
let includeOnboard = metadata.onboard.flatMap(b => {
if (b.siblings) {
return b.siblings.map(board => ({
board,
}));
} else {
return {
board: b.id,
};
}
});
let includeInterconnect = Object.values(metadata.interconnects).flatMap(i =>
i.boards.flatMap(b =>
i.shields.flatMap(s => {
if (s.siblings) {
return s.siblings.map(shield => ({
board: b.id,
shield,
}));
} else {
return {
board: b.id,
shield: s.id,
};
}
})
)
);
return [...includeOnboard, ...includeInterconnect];
get-grouped-hardware:
runs-on: ubuntu-latest
outputs:
organized-metadata: ${{ steps.organize-metadata.outputs.result }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "14.x"
- name: Install js-yaml
run: npm install js-yaml
- name: Aggregate Metadata
uses: actions/github-script@v7
id: aggregate-metadata
with:
script: |
const fs = require('fs');
const yaml = require('js-yaml');
const globber = await glob.create("app/boards/**/*.zmk.yml");
const files = await globber.glob();
const aggregated = files.flatMap((f) =>
yaml.loadAll(fs.readFileSync(f, "utf8"))
);
return JSON.stringify(aggregated).replace(/\\/g,"\\\\").replace(/`/g,"\\`");
result-encoding: string
- name: Organize Metadata
uses: actions/github-script@v7
id: organize-metadata
with:
script: |
const hardware = JSON.parse(`${{ steps.aggregate-metadata.outputs.result }}`);
const grouped = hardware.reduce((agg, hm) => {
switch (hm.type) {
case "board":
if (hm.features && hm.features.includes("keys")) {
agg.onboard.push(hm);
} else if (hm.exposes) {
hm.exposes.forEach((element) => {
let ic = agg.interconnects[element] || {
boards: [],
shields: [],
};
ic.boards.push(hm);
agg.interconnects[element] = ic;
});
} else {
console.error("Board without keys or interconnect");
}
break;
case "shield":
if (hm.features && hm.features.includes("keys")) {
hm.requires.forEach((id) => {
let ic = agg.interconnects[id] || { boards: [], shields: [] };
ic.shields.push(hm);
agg.interconnects[id] = ic;
});
}
break;
case "interconnect":
let ic = agg.interconnects[hm.id] || { boards: [], shields: [] };
ic.interconnect = hm;
agg.interconnects[hm.id] = ic;
break;
}
return agg;
},
{ onboard: [], interconnects: {} });
return JSON.stringify(grouped).replace(/\\/g,"\\\\").replace(/`/g,"\\`");
result-encoding: string
get-changed-files:
if: ${{ github.event_name != 'schedule' }}
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.changed-files.outputs.all_changed_files }}
board-changes: ${{ steps.board-changes.outputs.result }}
core-changes: ${{ steps.core-changes.outputs.result }}
steps:
- uses: tj-actions/changed-files@v42
id: changed-files
with:
json: true
escape_json: false
- uses: actions/github-script@v7
id: board-changes
with:
script: |
const changedFiles = JSON.parse(`${{ steps.changed-files.outputs.all_changed_files }}`);
const boardChanges = changedFiles.filter(f => f.startsWith('app/boards'));
return boardChanges.length ? 'true' : 'false';
result-encoding: string
- uses: actions/github-script@v7
id: core-changes
with:
script: |
const changedFiles = JSON.parse(`${{ steps.changed-files.outputs.all_changed_files }}`);
const boardChanges = changedFiles.filter(f => f.startsWith('app/boards'));
const appChanges = changedFiles.filter(f => f.startsWith('app'));
const ymlChanges = changedFiles.includes('.github/workflows/build.yml');
return boardChanges.length < appChanges.length || ymlChanges ? 'true' : 'false';
result-encoding: string

View File

@ -1,36 +0,0 @@
name: Docs Checks
on:
push:
paths:
- ".github/workflows/doc-checks.yml"
- "docs/**"
pull_request:
paths:
- ".github/workflows/doc-checks.yml"
- "docs/**"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bahmutov/npm-install@v1
with:
working-directory: docs
- name: ESLint
run: npm run lint
working-directory: docs
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bahmutov/npm-install@v1
with:
working-directory: docs
- name: Build
run: npm run build
working-directory: docs
- name: TypeScript check
run: npm run typecheck
working-directory: docs

View File

@ -1,34 +0,0 @@
name: Hardware Metadata Validation
on:
push:
paths:
- ".github/workflows/hardware-metadata-validation.yml"
- "schema/hardware-metadata.schema.json"
- "app/boards/**/*.zmk.yml"
- "app/scripts/west_commands/metadata.py"
pull_request:
paths:
- ".github/workflows/hardware-metadata-validation.yml"
- "schema/hardware-metadata.schema.json"
- "app/boards/**/*.zmk.yml"
- "app/scripts/west_commands/metadata.py"
jobs:
validate-metadata:
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-dev-arm:3.5
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pip install -r app/scripts/requirements.txt
- name: West init
run: west init -l app
- name: Update modules (west update)
run: west update
- name: Export Zephyr CMake package (west zephyr-export)
run: west zephyr-export
- name: Validate Hardware Metadata
working-directory: app
run: west metadata check

View File

@ -1,15 +0,0 @@
name: pre-commit
on:
pull_request:
push:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1

View File

@ -1,73 +0,0 @@
name: Tests
on:
push:
paths:
- ".github/workflows/test.yml"
- "app/tests/**"
- "app/src/**"
- "app/include/**"
pull_request:
paths:
- ".github/workflows/test.yml"
- "app/tests/**"
- "app/src/**"
- "app/include/**"
jobs:
collect-tests:
outputs:
test-dirs: ${{ steps.test-dirs.outputs.test-dirs }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find test directories
id: test-dirs
run: |
cd app/tests/
export TESTS=$(ls -d * | grep -v ble | jq -R -s -c 'split("\n")[:-1]')
echo "test-dirs=${TESTS}" >> $GITHUB_OUTPUT
run-tests:
needs: collect-tests
strategy:
matrix:
test: ${{ fromJSON(needs.collect-tests.outputs.test-dirs) }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:3.5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache west modules
uses: actions/cache@v4
env:
cache-name: cache-zephyr-modules
with:
path: |
modules/
tools/
zephyr/
bootloader/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('app/west.yml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
timeout-minutes: 2
continue-on-error: true
- name: Initialize workspace (west init)
run: west init -l app
- name: Update modules (west update)
run: west update
- name: Export Zephyr CMake package (west zephyr-export)
run: west zephyr-export
- name: Test ${{ matrix.test }}
working-directory: app
run: west test tests/${{ matrix.test }}
- name: Archive artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.test }}-log-files"
path: app/build/**/*.log

View File

@ -1,13 +1,41 @@
# Zephyr™ Mechanical Keyboard (ZMK) Firmware
# ZMK
[![Discord](https://img.shields.io/discord/719497620560543766)](https://zmk.dev/community/discord/invite)
[![Build](https://github.com/zmkfirmware/zmk/workflows/Build/badge.svg)](https://github.com/zmkfirmware/zmk/actions)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
NOTE: Try to keep the repo up to date as much as possible. Pull from the
upstream master and then rebase my branch on top of it.
[ZMK Firmware](https://zmk.dev/) is an open source ([MIT](LICENSE)) keyboard firmware built on the [Zephyr™ Project](https://www.zephyrproject.org/) Real Time Operating System (RTOS). ZMK's goal is to provide a modern, wireless, and powerful firmware free of licensing issues.
## Instructions for building
Check out the website to learn more: https://zmk.dev/.
1. Install devcontainer cli
You can also come join our [ZMK Discord Server](https://zmk.dev/community/discord/invite).
```sh
brew install devcontainer
```
2. Setup the devcontainer
```sh
devcontainer up --workspace-path . --docker-path $(which podman)
```
3. Initialize west (this takes a while)
```sh
devcontainer exec --workspace-path . --docker-path $(which podman)
west init -l app/
west update
```
4. Build the firmware
```sh
cd app
west build --pristine -b nice_nano_v2 -- -DSHIELD=chrysemys
```
5. Copy the uf2 file onto the root of the USB mass storage for the keyboard. The uf2 file can be found at `app/build/zephyr/zmk.uf2`.
## Documentation
- [Docker setup](https://zmk.dev/docs/development/setup/docker)
- [Building](https://zmk.dev/docs/development/build-flash)
To review features, check out the [feature overview](https://zmk.dev/docs/). ZMK is under active development, and new features are listed with the [enhancement label](https://github.com/zmkfirmware/zmk/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement) in GitHub. Please feel free to add 👍 to the issue description of any requests to upvote the feature.

View File

@ -0,0 +1,13 @@
# Copyright (c) 2022 Tony Grosinger
# SPDX-License-Identifier: MIT
config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_PSEUDACRIS
config BOARD_ENABLE_CHARGER
bool "Enable battery charger"
default y
depends on (BOARD_PSEUDACRIS)

View File

@ -0,0 +1,6 @@
# Copyright (c) 2022 Tony Grosinger
# SPDX-License-Identifier: MIT
config BOARD_PSEUDACRIS
bool "pseudacris"
depends on SOC_NRF52840_QIAA

View File

@ -0,0 +1,31 @@
# Copyright (c) 2022 Tony Grosinger
# SPDX-License-Identifier: MIT
if BOARD_PSEUDACRIS
config ZMK_KEYBOARD_NAME
default "pseudacris"
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
config BOARD_ENABLE_CHARGER
default y
endif # BOARD_PSEUDACRIS

View File

@ -0,0 +1,15 @@
# Pseudacris
Pseudacris is a hotswap 30% keyboard made by Tony Grosinger.
More details, including the BOM and PCB files can be found at https://git.sr.ht/~tgrosinger/keyboards/tree/main/item/pseudacris
## Building Pseudacris ZMK firmware
```bash
# From in this repo
cd app
west build -p -b pseudacris
# Built firmware output to app/build/zephyr/zmk.uf2
```

View File

@ -0,0 +1,7 @@
# Copyright (c) 2022 Tony Grosinger
# SPDX-License-Identifier: MIT
set(OPENOCD_NRF5_SUBFAMILY nrf52)
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <drivers/gpio.h>
#include <sys/sys_io.h>
#include <devicetree.h>
static int pinmux_pseudacris_init(const struct device *port) {
ARG_UNUSED(port);
const struct device *p0 = device_get_binding("GPIO_0");
#if CONFIG_BOARD_ENABLE_CHARGER
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
gpio_pin_set(p0, 5, 0);
#else
gpio_pin_configure(p0, 5, GPIO_INPUT);
#endif
return 0;
}
SYS_INIT(pinmux_pseudacris_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);

View File

@ -0,0 +1,172 @@
/*
* Copyright (c) 2022 Tony Grosinger
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/zmk/matrix_transform.h>
/ {
model = "pseudacris";
compatible = "pseudacris";
chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <7>;
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9)
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(5,5) RC(5,6) RC(5,7) RC(5,8) RC(5,9)
RC(6,2) RC(6,3) RC(6,4) RC(6,5) RC(6,6) RC(6,7)
>;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "row2col";
/*
* P0.13 - Left Matrix Top
* P0.22 - Left Matrix Middle
* P1.06 - Left Matrix Bottom
*
* P0.30 - Right Matrix Top
* P0.31 - Right Matrix Middle
* P1.11 - Right Matrix Bottom
*
* P0.10 - Thumbs
*/
row-gpios
= <&gpio0 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 31 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
/*
* P0.09 - Left Pinky
* P1.04 - Left Ring
* P1.02 - Left Middle
* P1.00 - Left Pointer
* P0.24 - Left Inner
* P0.29 - Right Inner
* P0.02 - Right Pointer
* P1.13 - Right Middle
* P0.28 - Right Ring
* P0.03 - Right Pinky
*/
col-gpios
= <&gpio0 9 GPIO_ACTIVE_HIGH>
, <&gpio1 4 GPIO_ACTIVE_HIGH>
, <&gpio1 2 GPIO_ACTIVE_HIGH>
, <&gpio1 0 GPIO_ACTIVE_HIGH>
, <&gpio0 24 GPIO_ACTIVE_HIGH>
, <&gpio0 29 GPIO_ACTIVE_HIGH>
, <&gpio0 2 GPIO_ACTIVE_HIGH>
, <&gpio1 13 GPIO_ACTIVE_HIGH>
, <&gpio0 28 GPIO_ACTIVE_HIGH>
, <&gpio0 3 GPIO_ACTIVE_HIGH>
;
};
ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
};
};
&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>;
};
};
};

View File

@ -0,0 +1,305 @@
/*
* Copyright (c) 2022 Tony Grosinger
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#define DEF_L 0
#define NUM_L 1
#define SYM_L 2
#define TMUX_L 3
// Using layer taps on thumbs, having quick tap as well helps w/ repeating space/backspace
&lt { quick_tap_ms = <200>; };
/ {
behaviors {
hm: homerow_mods {
compatible = "zmk,behavior-hold-tap";
label = "homerow mods";
#binding-cells = <2>;
tapping_term_ms = <225>;
flavor = "tap-preferred";
bindings = <&kp>, <&kp>;
};
};
combos {
compatible = "zmk,combos";
combo_backtick {
timeout-ms = <50>;
key-positions = <0 1>;
bindings = <&kp GRAVE>;
};
combo_esc {
timeout-ms = <50>;
key-positions = <1 11>;
bindings = <&kp ESC>;
};
combo_backspace {
timeout-ms = <50>;
key-positions = <11 12>;
bindings = <&kp BSPC>;
};
combo_tab {
timeout-ms = <50>;
key-positions = <12 13>;
bindings = <&kp TAB>;
};
combo_enter {
timeout-ms = <50>;
key-positions = <22 23>;
bindings = <&kp ENTER>;
};
combo_minus {
timeout-ms = <50>;
key-positions = <7 8>;
bindings = <&kp MINUS>;
};
combo_backslash {
timeout-ms = <50>;
key-positions = <8 9>;
bindings = <&kp BACKSLASH>;
};
combo_less_than {
timeout-ms = <50>;
key-positions = <15 16>;
bindings = <&kp LT>;
};
combo_greater_than {
timeout-ms = <50>;
key-positions = <17 18>;
bindings = <&kp GT>;
};
combo_colon {
timeout-ms = <50>;
key-positions = <16 17>;
bindings = <&kp COLON>;
};
combo_quote {
timeout-ms = <50>;
key-positions = <25 26>;
bindings = <&kp APOSTROPHE>;
};
combo_underscore {
timeout-ms = <50>;
key-positions = <26 27>;
bindings = <&kp UNDER>;
};
};
macros {
tmux_new: tmux_new {
label = "ZM_tmux_new";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp C>
;
};
tmux_zoom: tmux_zoom {
label = "ZM_tmux_zoom";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp Z>
;
};
tmux_scroll: tmux_scroll {
label = "ZM_tmux_scroll";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp LEFT_BRACKET>
;
};
tmux_pn_lt: tmux_pn_lt {
label = "ZM_tmux_pn_lt";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp LEFT>
;
};
tmux_pn_dn: tmux_pn_dn {
label = "ZM_tmux_pn_dn";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp DOWN>
;
};
tmux_pn_up: tmux_pn_up {
label = "ZM_tmux_pn_up";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp UP>
;
};
tmux_pn_rt: tmux_pn_rt {
label = "ZM_tmux_pn_rt";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp RIGHT>
;
};
tmux_wn_next: tmux_wn_next {
label = "ZM_tmux_wn_next";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp N>
;
};
tmux_wn_prev: tmux_wn_prev {
label = "ZM_tmux_wn_prev";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp P>
;
};
tmux_sp_v: tmux_sp_v {
label = "ZM_tmux_sp_v";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp PERCENT>
;
};
tmux_sp_h: tmux_sp_h {
label = "ZM_tmux_sp_h";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp DOUBLE_QUOTES>
;
};
vi_clip_cp: vi_clip_cp {
label = "ZM_vi_clip_cp";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp DOUBLE_QUOTES>
, <&macro_tap &kp PLUS>
, <&macro_tap &kp Y>
;
};
vi_clip_pst: vi_clip_pst {
label = "ZM_vi_clip_pst";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp DOUBLE_QUOTES>
, <&macro_tap &kp PLUS>
, <&macro_tap &kp P>
;
};
vi_macro: vi_macro {
label = "ZM_vi_macro";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp AT>
, <&macro_tap &kp Q>
;
};
vi_save: vi_save {
label = "ZM_vi_save";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp ESC>
, <&macro_tap &kp COLON &kp W &kp ENTER>
, <&macro_tap &kp LC(T)>
;
};
term_full: term_full {
label = "ZM_term_full";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(TILDE)>
;
};
desk_left: desk_left {
label = "ZM_desk_left";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(LG(LEFT))>
;
};
desk_right: desk_right {
label = "ZM_desk_right";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(LG(RIGHT))>
;
};
};
keymap {
compatible = "zmk,keymap";
// 0
// 10
// 20
default_layer {
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&hm LCTL A &kp S &kp D &kp F &kp G &kp H &hm LGUI J &kp K &kp L &hm RCTL SEMI
&hm LALT Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SLASH
&mo NUM_L &kp LSHIFT &kp ESC &mo TMUX_L &kp SPACE &mo SYM_L
>;
};
num_layer {
label = "Num";
bindings = <
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
&trans &desk_left &kp LG(E) &kp LG(R) &desk_right &trans &kp N4 &kp N5 &kp N6 &kp COLON
&kp F1 &kp F2 &kp F12 &kp F4 &kp F5 &trans &kp N1 &kp N2 &kp N3 &kp DOT
&none &none &none &none &none &kp N0
>;
};
sym_layer {
label = "Sym";
bindings = <
&kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp PLUS &kp EQUAL
&kp COLON &none &kp LPAR &kp RPAR &none &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans
&none &kp LBRC &kp LBKT &kp RBKT &kp RBRC &kp HOME &kp PG_DN &kp PG_UP &kp END &trans
&none &none &none &none &none &none
>;
};
tmux_layer {
label = "Tmux";
bindings = <
&vi_macro &vi_save &none &none &tmux_sp_v &vi_clip_cp &none &none &none &vi_clip_pst
&none &tmux_scroll &none &term_full &none &tmux_pn_lt &tmux_pn_dn &tmux_pn_up &tmux_pn_rt &tmux_sp_h
&tmux_zoom &none &tmux_new &none &none &tmux_wn_prev &none &none &tmux_wn_next &none
&none &kp DEL &none &none &none &none
>;
};
};
};

View File

@ -0,0 +1,15 @@
identifier: pseudacris
name: pseudacris
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View File

@ -0,0 +1,11 @@
file_format: "1"
id: pseudacris
name: pseudacris
type: board
arch: arm
features:
- keys
outputs:
- usb
- ble
url: https://git.sr.ht/~tgrosinger/keyboards/tree/main/item/pseudacris

View File

@ -0,0 +1,24 @@
# Copyright (c) 2022 Tony Grosinger
# SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_PSEUDACRIS=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

View File

@ -0,0 +1,9 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
if SHIELD_CHRYSEMYS
config ZMK_KEYBOARD_NAME
default "Chrysemys"
endif

View File

@ -0,0 +1,5 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config SHIELD_CHRYSEMYS
def_bool $(shields_list_contains,chrysemys)

View File

@ -0,0 +1,305 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#define DEF_L 0
#define NUM_L 1
#define SYM_L 2
#define TMUX_L 3
// Using layer taps on thumbs, having quick tap as well helps w/ repeating space/backspace
&lt { quick_tap_ms = <200>; };
/ {
behaviors {
hm: homerow_mods {
compatible = "zmk,behavior-hold-tap";
label = "homerow mods";
#binding-cells = <2>;
tapping_term_ms = <225>;
flavor = "tap-preferred";
bindings = <&kp>, <&kp>;
};
};
combos {
compatible = "zmk,combos";
combo_backtick {
timeout-ms = <50>;
key-positions = <0 1>;
bindings = <&kp GRAVE>;
};
combo_esc {
timeout-ms = <50>;
key-positions = <1 11>;
bindings = <&kp ESC>;
};
combo_backspace {
timeout-ms = <50>;
key-positions = <11 12>;
bindings = <&kp BSPC>;
};
combo_tab {
timeout-ms = <50>;
key-positions = <12 13>;
bindings = <&kp TAB>;
};
combo_enter {
timeout-ms = <50>;
key-positions = <22 23>;
bindings = <&kp ENTER>;
};
combo_minus {
timeout-ms = <50>;
key-positions = <7 8>;
bindings = <&kp MINUS>;
};
combo_backslash {
timeout-ms = <50>;
key-positions = <8 9>;
bindings = <&kp BACKSLASH>;
};
combo_less_than {
timeout-ms = <50>;
key-positions = <15 16>;
bindings = <&kp LT>;
};
combo_greater_than {
timeout-ms = <50>;
key-positions = <17 18>;
bindings = <&kp GT>;
};
combo_colon {
timeout-ms = <50>;
key-positions = <16 17>;
bindings = <&kp COLON>;
};
combo_quote {
timeout-ms = <50>;
key-positions = <25 26>;
bindings = <&kp APOSTROPHE>;
};
combo_underscore {
timeout-ms = <50>;
key-positions = <26 27>;
bindings = <&kp UNDER>;
};
};
macros {
tmux_new: tmux_new {
label = "ZM_tmux_new";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp C>
;
};
tmux_zoom: tmux_zoom {
label = "ZM_tmux_zoom";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp Z>
;
};
tmux_scroll: tmux_scroll {
label = "ZM_tmux_scroll";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp LEFT_BRACKET>
;
};
tmux_pn_lt: tmux_pn_lt {
label = "ZM_tmux_pn_lt";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp LEFT>
;
};
tmux_pn_dn: tmux_pn_dn {
label = "ZM_tmux_pn_dn";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp DOWN>
;
};
tmux_pn_up: tmux_pn_up {
label = "ZM_tmux_pn_up";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp UP>
;
};
tmux_pn_rt: tmux_pn_rt {
label = "ZM_tmux_pn_rt";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp RIGHT>
;
};
tmux_wn_next: tmux_wn_next {
label = "ZM_tmux_wn_next";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp N>
;
};
tmux_wn_prev: tmux_wn_prev {
label = "ZM_tmux_wn_prev";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp P>
;
};
tmux_sp_v: tmux_sp_v {
label = "ZM_tmux_sp_v";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp PERCENT>
;
};
tmux_sp_h: tmux_sp_h {
label = "ZM_tmux_sp_h";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(B)>
, <&macro_tap &kp DOUBLE_QUOTES>
;
};
vi_clip_cp: vi_clip_cp {
label = "ZM_vi_clip_cp";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp DOUBLE_QUOTES>
, <&macro_tap &kp PLUS>
, <&macro_tap &kp Y>
;
};
vi_clip_pst: vi_clip_pst {
label = "ZM_vi_clip_pst";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp DOUBLE_QUOTES>
, <&macro_tap &kp PLUS>
, <&macro_tap &kp P>
;
};
vi_macro: vi_macro {
label = "ZM_vi_macro";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp AT>
, <&macro_tap &kp Q>
;
};
vi_save: vi_save {
label = "ZM_vi_save";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp ESC>
, <&macro_tap &kp COLON &kp W &kp ENTER>
, <&macro_tap &kp LC(T)>
;
};
term_full: term_full {
label = "ZM_term_full";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(TILDE)>
;
};
desk_left: desk_left {
label = "ZM_desk_left";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(LG(LEFT))>
;
};
desk_right: desk_right {
label = "ZM_desk_right";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings
= <&macro_tap &kp LC(LG(RIGHT))>
;
};
};
keymap {
compatible = "zmk,keymap";
// 0
// 10
// 20
default_layer {
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&hm LCTL A &kp S &kp D &kp F &kp G &kp H &hm LGUI J &kp K &kp L &hm RCTL SEMI
&hm LALT Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SLASH
&mo NUM_L &kp LSHIFT &kp ESC &mo TMUX_L &kp SPACE &mo SYM_L
>;
};
num_layer {
label = "Num";
bindings = <
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
&trans &desk_left &kp LG(E) &kp LG(R) &desk_right &trans &kp N4 &kp N5 &kp N6 &kp COLON
&kp F1 &kp F2 &kp F12 &kp F4 &kp F5 &trans &kp N1 &kp N2 &kp N3 &kp DOT
&none &none &none &none &none &kp N0
>;
};
sym_layer {
label = "Sym";
bindings = <
&kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp ASTRK &kp PLUS &kp EQUAL
&kp COLON &none &kp LPAR &kp RPAR &none &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans
&none &kp LBRC &kp LBKT &kp RBKT &kp RBRC &kp HOME &kp PG_DN &kp PG_UP &kp END &trans
&none &none &none &none &none &none
>;
};
tmux_layer {
label = "Tmux";
bindings = <
&vi_macro &vi_save &none &none &tmux_sp_v &vi_clip_cp &none &none &none &vi_clip_pst
&none &tmux_scroll &none &term_full &none &tmux_pn_lt &tmux_pn_dn &tmux_pn_up &tmux_pn_rt &tmux_sp_h
&tmux_zoom &none &tmux_new &none &none &tmux_wn_prev &none &none &tmux_wn_next &none
&none &kp DEL &none &none &none &none
>;
};
};
};

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix_transform.h>
/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <4>;
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9)
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)
RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7)
>;
};
kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "row2col";
col-gpios
= <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
row-gpios
= <&pro_micro 1 GPIO_ACTIVE_HIGH>
, <&pro_micro 2 GPIO_ACTIVE_HIGH>
, <&pro_micro 3 GPIO_ACTIVE_HIGH>
, <&pro_micro 4 GPIO_ACTIVE_HIGH>
;
};
};

View File

@ -0,0 +1,8 @@
file_format: "1"
id: chrysemys
name: Chrysemys
type: shield
url: https://git.sr.ht/~tgrosinger/keyboards/tree/main/item/chrysemys
requires: [pro_micro]
features:
- keys