Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d45882f
rgb_underglow: refresh more frequently for smoother RGB underglow
chrisandreae May 28, 2022
aca523d
RGB underglow status support
donaldsycamore Jul 13, 2022
46d3931
RGB underglow: dim or disable when battery low
donaldsycamore Sep 28, 2022
f9c6ba4
ext_power: add Kconfig for initial ext_power state
donaldsycamore Jan 21, 2023
2ff29d7
Include the serial number in the Bluetooth device name
chrisandreae Feb 15, 2023
3ae6e36
Add build environment using Nix
chrisandreae Sep 18, 2021
36d13c7
Github build action: build Glove80 combined firmware using Nix
chrisandreae Sep 18, 2022
ab52ae9
Docker container and lambda function for performing firmware builds
chrisandreae Oct 11, 2021
2fad527
Configure Glove80 board definitions for custom features
moergo-sc Sep 19, 2021
b4b3f7a
valdur's mod
darknao May 3, 2024
8b07bed
underglow-layer: use devicetree & clean up code
darknao May 5, 2024
1f51e52
underglow-layer: track layer changes with event & battery life optimi…
darknao May 8, 2024
8ce2443
fix(rgb): auto-off logic
elpekenin Apr 25, 2024
428324c
fix(underglow): Correctly set underglow state
jradtilbrook Apr 25, 2024
ec98115
underglow-layer: enable only if config exists in devicetree
darknao May 12, 2024
2a22d16
underglow-layer: Don't save state on idle/resume & register activity …
darknao May 13, 2024
d504e84
fix: RGB_TOG also toggle underglow-layer
darknao May 20, 2024
6585434
feat(split): Increase split interval during idle
Nicell May 6, 2022
8d196f9
fix: ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE not required for underglow-layer
darknao May 22, 2024
9e9219d
Compiler service: pass keymap data when building RHS
chrisandreae May 23, 2024
169afd4
underglow-layer: enable with EXPERIMENTAL_RGB_LAYER Kconfig
darknao May 23, 2024
5b327c2
fix build if EXPERIMENTAL_RGB_LAYER not set
darknao May 25, 2024
6d82f48
underglow-layer: cut off ext power if all leds are off
darknao May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
# Docker on Windows.
.bashrc text eol=lf
*.sh text eol=lf
*.nix text eol=lf
110 changes: 110 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Build Compiler Service Container

on:
push:
tags:
- "*"
pull_request_target:
branches:
- main

jobs:
build:
# This job must never be run on a PR from outside the same repository
if: github.repository == 'moergo-sc/zmk' && (github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
env:
ECR_REPOSITORY: zmk-builder-lambda
VERSIONS_BUCKET: glove80firmwarepipelines-compilerversionsbucket44-zubaquiyjdam
UPDATE_COMPILER_VERSIONS_FUNCTION: arn:aws:lambda:us-east-1:431227615537:function:Glove80FirmwarePipelineSt-UpdateCompilerVersions2A-CNxPOHb4VSuV
REVISION_TAG: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.sha }}
PR_NUMBER: ${{ github.event.number }}
steps:
- uses: actions/checkout@v2.4.0
with:
repository: moergo-sc/zmk
ref: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::431227615537:role/GithubCompilerLambdaBuilder
aws-region: us-east-1
- name: Extract container name from branch name
shell: bash
run: |
if [ "$GITHUB_HEAD_REF" ]; then
branch_ref="$GITHUB_HEAD_REF"
type="pr"
tag="pr${PR_NUMBER}.${GITHUB_HEAD_REF}"
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
branch_ref="$GITHUB_REF"
type="tag"
tag="${GITHUB_REF#refs/tags/}"
else
echo "Not a pull request or release tag" >&2
exit 1
fi
# Replace / with . in container tag names
tag="${tag//\//.}"
echo "VERSION_BRANCH=${branch_ref}" >> $GITHUB_ENV
echo "VERSION_TYPE=${type}" >> $GITHUB_ENV
echo "VERSION_NAME=${tag}" >> $GITHUB_ENV
id: extract_name
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-22.05
- uses: cachix/cachix-action@v12
with:
name: moergo-glove80-zmk-dev
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build lambda image
run: nix-build release.nix --arg revision "\"${REVISION_TAG}\"" -A lambdaImage -o lambdaImage
- name: Import OCI image into docker-daemon
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: skopeo --insecure-policy copy oci:lambdaImage docker-daemon:$REGISTRY/$ECR_REPOSITORY:$REVISION_TAG
- name: Push container image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: docker push $REGISTRY/$ECR_REPOSITORY:$REVISION_TAG
- name: Create JSON metadata to represent the built container
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
shell: bash
run: |
digest="$(docker inspect --format='{{index .RepoDigests 0}}' $REGISTRY/$ECR_REPOSITORY:$REVISION_TAG)"
digest="${digest##*@}"
api_version="$(cat lambda/api_version.txt)"
timestamp="$(date -u +"%Y%m%d.%H%M%S")"

if [ "$VERSION_TYPE" = "pr" ]; then
release_name="$VERSION_NAME.$timestamp"
else
release_name="$VERSION_NAME"
fi

jq -n '$ARGS.named' \
--arg name "$release_name" \
--arg version_name "$VERSION_NAME" \
--arg revision "$REVISION_TAG" \
--arg release_time "$timestamp" \
--arg branch "$VERSION_BRANCH" \
--arg digest "$digest" \
--arg api_version "$api_version" \
> "/tmp/$VERSION_NAME.json"
- name: Upload image metadata file to versions bucket
run: aws s3 cp "/tmp/$VERSION_NAME.json" "s3://$VERSIONS_BUCKET/images/$VERSION_NAME.json"
- name: Notify the build pipeline that the compile containers have updated
run: >-
aws lambda invoke --function-name $UPDATE_COMPILER_VERSIONS_FUNCTION
--invocation-type Event
--cli-binary-format raw-in-base64-out
/dev/null
13 changes: 7 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
build:
if: ${{ always() }}
if: ${{ false }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:3.5
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
throw new Error('Failed to build one or more configurations');
}
compile-matrix:
if: ${{ always() }}
if: ${{ false && always() }}
runs-on: ubuntu-latest
needs: [core-coverage, board-changes, nightly]
outputs:
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
shieldArgs: JSON.stringify(shieldArgs),
}));
core-coverage:
if: ${{ needs.get-changed-files.outputs.core-changes == 'true' }}
if: ${{ false && needs.get-changed-files.outputs.core-changes == 'true' }}
runs-on: ubuntu-latest
needs: get-changed-files
outputs:
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:

return [...include, ...coreCoverage.include];
board-changes:
if: ${{ needs.get-changed-files.outputs.board-changes == 'true' }}
if: ${{ false && needs.get-changed-files.outputs.board-changes == 'true' }}
runs-on: ubuntu-latest
needs: [get-grouped-hardware, get-changed-files]
outputs:
Expand Down Expand Up @@ -284,7 +284,7 @@ jobs:
});
}))).flat();
nightly:
if: ${{ github.event_name == 'schedule' }}
if: ${{ false && github.event_name == 'schedule' }}
runs-on: ubuntu-latest
needs: get-grouped-hardware
outputs:
Expand Down Expand Up @@ -329,6 +329,7 @@ jobs:

return [...includeOnboard, ...includeInterconnect];
get-grouped-hardware:
if: ${{ false }}
runs-on: ubuntu-latest
outputs:
organized-metadata: ${{ steps.organize-metadata.outputs.result }}
Expand Down Expand Up @@ -406,7 +407,7 @@ jobs:
return JSON.stringify(grouped).replace(/\\/g,"\\\\").replace(/`/g,"\\`");
result-encoding: string
get-changed-files:
if: ${{ github.event_name != 'schedule' }}
if: ${{ false && github.event_name != 'schedule' }}
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.changed-files.outputs.all_changed_files }}
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/cleanup-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Clean up PR Compiler Service Container

on:
pull_request:
types: [closed]
branches:
- main

jobs:
build:
if: github.repository == 'moergo-sc/zmk'
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
env:
ECR_REPOSITORY: zmk-builder-lambda
VERSIONS_BUCKET: glove80firmwarepipelines-compilerversionsbucket44-zubaquiyjdam
UPDATE_COMPILER_VERSIONS_FUNCTION: arn:aws:lambda:us-east-1:431227615537:function:Glove80FirmwarePipelineSt-UpdateCompilerVersions2A-CNxPOHb4VSuV
PR_NUMBER: ${{ github.event.number }}
steps:
- name: Extract image tag name
shell: bash
run: |
tag="pr${PR_NUMBER}.${GITHUB_HEAD_REF}"
# Replace / with . in container tag names
tag="${tag//\//.}"
echo "VERSION_NAME=${tag}" >> $GITHUB_ENV
id: extract_name
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::431227615537:role/GithubCompilerLambdaBuilder
aws-region: us-east-1
- name: Delete the image metadata file from the versions s3 bucket
run: aws s3 rm s3://$VERSIONS_BUCKET/images/$VERSION_NAME.json
- name: Notify the build pipeline that the compile containers have updated
run: >-
aws lambda invoke --function-name $UPDATE_COMPILER_VERSIONS_FUNCTION
--invocation-type Event
--cli-binary-format raw-in-base64-out
/dev/null
62 changes: 62 additions & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build Glove80 Firmware

on:
push:
paths:
- ".github/workflows/nix-build.yml"
- "default.nix"
- "app/**"
- "nix/**"
branches:
- "**"
tags:
- "**"
pull_request:
paths:
- ".github/workflows/nix-build.yml"
- "default.nix"
- "app/**"
- "nix/**"

jobs:
build:
name: Build Glove80 Firmware
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-22.05
- uses: cachix/cachix-action@v12
with:
name: moergo-glove80-zmk-dev
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
skipPush: "${{ github.repository != 'moergo-sc/zmk' }}"
- name: Build Glove80 combined firmware
run: nix-build -A glove80_combined -o combined
- name: Copy result out of nix store
run: cp combined/glove80.uf2 glove80.uf2
- name: Upload result
uses: actions/upload-artifact@v3
with:
name: glove80.uf2
path: glove80.uf2
release:
name: Create Release for Tag
if: >-
github.repository == 'moergo-sc/zmk'
&& github.event_name == 'push'
&& contains(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download compiled firmware artifact
uses: actions/download-artifact@v3
with:
name: glove80.uf2
- name: Create Release for Tag
uses: ncipollo/release-action@v1
with:
artifacts: "glove80.uf2"
artifactErrorsFailBuild: true
generateReleaseNotes: true
39 changes: 39 additions & 0 deletions README-NIX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Building Zephyr™ Mechanical Keyboard (ZMK) Firmware with Nix

This extension is added by MoErgo for the Glove80 keyboard.

Nix makes setup significantly easier. With this approach `west` is not needed.
You can however still choose to build using the standard Zephyr `west` toolchain
if you wish.

# To build a target

In ZMK root directory,

nix-build -A *target* [-o *output_directory*]

For example,

nix-build -A glove80_left -o left

The `output_directory` nix creates is a symlink. If you prefer not to rely on
symlink (perhaps because you are using WSL on Windows), you can make a copy of
the resulting `uf2` file using:

cp -f $(nix-build -A *target* --no-out-link)/zmk.uf2 .

# To build Glove80

In ZMK root directory,

cp -f $(nix-build -A glove80_combined --no-out-link)/glove80.uf2 .

# Adding new targets

Edit default.nix and add an target based on zmk

An example is:

glove80_left = zmk.override {
board = "glove80_lh";
};
2 changes: 2 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ target_sources_ifdef(CONFIG_ZMK_BATTERY_REPORTING app PRIVATE src/battery.c)
target_sources_ifdef(CONFIG_ZMK_HID_INDICATORS app PRIVATE src/events/hid_indicators_changed.c)

target_sources_ifdef(CONFIG_ZMK_SPLIT app PRIVATE src/events/split_peripheral_status_changed.c)
target_sources_ifdef(CONFIG_ZMK_SPLIT app PRIVATE src/events/split_peripheral_layer_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_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow_layer.c)
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/backlight.c)
target_sources_ifdef(CONFIG_ZMK_LOW_PRIORITY_WORK_QUEUE app PRIVATE src/workqueue.c)
target_sources(app PRIVATE src/main.c)
Expand Down
23 changes: 23 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,16 @@ config ZMK_BLE_CLEAR_BONDS_ON_START
bool "Configuration that clears all bond information from the keyboard on startup."
default n

config ZMK_BLE_DEVICE_NAME_APPEND_SN
bool "Append the device serial number to the Bluetooth device name"
default n
select BT_DEVICE_NAME_DYNAMIC

config ZMK_BLE_DEVICE_NAME_SN_CHARS
int "Number of hexadecimal digits of serial number to append to the BT device name"
default 6
depends on ZMK_BLE_DEVICE_NAME_APPEND_SN

# HID GATT notifications sent this way are *not* picked up by Linux, and possibly others.
config BT_GATT_NOTIFY_MULTIPLE
default n
Expand Down Expand Up @@ -334,6 +344,10 @@ config ZMK_RGB_UNDERGLOW_AUTO_OFF_USB
bool "Turn off RGB underglow when USB is disconnected"
depends on USB_DEVICE_STACK

config EXPERIMENTAL_RGB_LAYER
bool "Experimental per-key per-layer RGB underglow"
default n

#ZMK_RGB_UNDERGLOW
endif

Expand Down Expand Up @@ -413,6 +427,15 @@ config ZMK_EXT_POWER
bool "Enable support to control external power output"
default y

if ZMK_EXT_POWER

config ZMK_EXT_POWER_START
bool "Enable external power output by default"
default y

#ZMK_EXT_POWER
endif

#Power Management
endmenu

Expand Down
Loading