Skip to content

Commit

Permalink
ft: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
varbhat committed Jun 29, 2024
0 parents commit 39707a2
Show file tree
Hide file tree
Showing 22 changed files with 951 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
BasedOnStyle: Google
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignOperands: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
BinPackArguments: 'true'
BinPackParameters: 'true'
ColumnLimit: '1000'
IndentCaseLabels: 'true'
IndentPPDirectives: AfterHash
IndentWidth: '4'
MaxEmptyLinesToKeep: '1'
PointerAlignment: Right
SortIncludes: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: 1
TabWidth: '4'
UseTab: Never

...
4 changes: 4 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CompileFlags:
Add: [-Wno-unknown-attributes, -Wno-maybe-uninitialized, -Wno-unknown-warning-option]
Remove: [-W*, -mmcu=*, -mcpu=*, -mfpu=*, -mfloat-abi=*, -mno-unaligned-access, -mno-thumb-interwork, -mcall-prologues]
Compiler: clang
32 changes: 32 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4

# We recommend you to keep these unchanged
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
indent_size = 4

[{qmk,*.py}]
charset = utf-8
max_line_length = 200

# Make these match what we have in .gitattributes
[*.mk]
end_of_line = lf
indent_style = tab

[Makefile]
end_of_line = lf
indent_style = tab

[*.sh]
end_of_line = lf
40 changes: 40 additions & 0 deletions .github/generate_keymap_drawer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

generate_keymap_svg() {
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <qmk_keymap_json> <output_file_name>"
return 1
fi

local THEME=$1
local QMK_KEYMAP_JSON=$2
local OUTPUT_FILE_NAME=$3

local DARK_CONFIG=$(
cat <<EOF
draw_config:
dark_mode: true
EOF
)

local LIGHT_CONFIG=$(
cat <<EOF
draw_config:
dark_mode: false
EOF
)

# Choose the appropriate configuration content based on the theme
local CONFIG_CONTENT
if [ "$THEME" = "dark" ]; then
CONFIG_CONTENT="$DARK_CONFIG"
elif [ "$THEME" = "light" ]; then
CONFIG_CONTENT="$LIGHT_CONFIG"
fi

keymap parse -c 10 -q "$QMK_KEYMAP_JSON" | keymap -c <(echo "$CONFIG_CONTENT") draw - >"${OUTPUT_FILE_NAME}_${THEME}.svg"
}

for theme in "dark" "light"; do
generate_keymap_svg "${theme}" "$1" "$2"
done
69 changes: 69 additions & 0 deletions .github/workflows/build_binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build QMK firmware

on: [push, workflow_dispatch]

permissions:
contents: write

jobs:
build:
name: "QMK Userspace Build"
uses: qmk/.github/.github/workflows/qmk_userspace_build.yml@main
with:
qmk_repo: qmk/qmk_firmware
qmk_ref: master
preparation_command: |
qmk c2json -kb crkbd -km vbt > keyboard_layout.bin # A Hack
qmk c2json -kb ploopyco/madromys -km vbt > trackpad_layout.bin # A Hack
publish:
name: "Generate layout images and publish the firmware"
needs: build
permissions: write-all
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download artifacts
if: always() && !cancelled()
uses: actions/download-artifact@v4
with:
name: Firmware

- run: mv keyboard_layout.bin crkbd_rev1_vbt_keymap.json

- run: mv trackpad_layout.bin ploopyco_madromys_rev1_001_vbt.json

- name: Install keymap-drawer (pypi)
run: python3 -m pip install keymap-drawer

- name: Generate Keyboard Keymap Layout SVG using keymap-drawer
run: ./.github/generate_keymap_drawer.sh ./crkbd_rev1_vbt_keymap.json crkbd_rev1_vbt

- name: Generate Trackpad Keymap Layout SVG using keymap-drawer
run: ./.github/generate_keymap_drawer.sh ploopyco_madromys_rev1_001_vbt.json ploopyco_madromys_rev1_001_vbt

- name: Install Inkscape
run: sudo apt install -y inkscape

- run: sudo apt install -y gsfonts gsfonts-other

- name: Generate Keymap Layout PNGs from Generated SVGs
run: |
inkscape --export-background-opacity=0 ./crkbd_rev1_vbt_dark.svg -o crkbd_rev1_vbt_dark.png
inkscape --export-background-opacity=0 ./crkbd_rev1_vbt_light.svg -o crkbd_rev1_vbt_light.png
inkscape --export-background-opacity=0 ./ploopyco_madromys_rev1_001_vbt_dark.svg -o ploopyco_madromys_rev1_001_vbt_dark.png
inkscape --export-background-opacity=0 ./ploopyco_madromys_rev1_001_vbt_light.svg -o ploopyco_madromys_rev1_001_vbt_light.png
- name: Publish Releases
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh config set prompt disabled
gh release create $(date +%s) --latest --generate-notes *.uf2 *.svg *.png crkbd_rev1_vbt_keymap.json ploopyco_madromys_rev1_001_vbt.json
- uses: geekyeggo/delete-artifact@v5
with:
name: Firmware
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Junk files
*.bak
*.swp
*~
.DS_Store
._*

# Firmware files
*.hex
*.bin
*.uf2
Loading

0 comments on commit 39707a2

Please sign in to comment.