Skip to content

Instantly share code, notes, and snippets.

View petejohanson's full-sized avatar

Pete Johanson petejohanson

View GitHub Profile
@petejohanson
petejohanson / 0001-Test-Docker-image-for-Zephyr-3.2-work.patch
Created January 5, 2023 19:53
Testing new ZMK Docker images for Zephyr 3.2 upgrade prep
From 51ad57e314bff6755e1bc892ce8f4f0246fdae01 Mon Sep 17 00:00:00 2001
From: Peter Johanson <peter@peterjohanson.com>
Date: Fri, 23 Dec 2022 02:09:15 -0500
Subject: [PATCH] Test Docker image for Zephyr 3.2 work.
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
@petejohanson
petejohanson / linker-fixes.diff
Created October 19, 2022 03:49
ESP32 Zephyr + ZMK linker fixes
diff --git a/scripts/west_commands/runners/esp32.py b/scripts/west_commands/runners/esp32.py
index e2f7a3c3c7..605e36c5fb 100644
--- a/scripts/west_commands/runners/esp32.py
+++ b/scripts/west_commands/runners/esp32.py
@@ -93,7 +93,7 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
def do_run(self, command, **kwargs):
self.require(self.espidf)
- cmd_flash = [self.espidf, '--chip', 'auto']
+ cmd_flash = [self.espidf, '--chip', 'auto', '--no-stub']
@petejohanson
petejohanson / behavior_key_press.c
Created August 3, 2022 03:20
Runtime keymap exploration.
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#define DT_DRV_COMPAT zmk_behavior_key_press
#include <device.h>
#include <drivers/behavior.h>
@petejohanson
petejohanson / combo.c
Created August 1, 2022 03:17
Combo bug
static int filter_timed_out_candidates(int64_t timestamp) {
int num_candidates = 0;
for (int i = 0; i < CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY; i++) {
struct combo_candidate *candidate = &candidates[i];
if (candidate->combo == NULL) {
break;
}
if (candidate->timeout_at > timestamp) {
// reorder candidates so they're contiguous
candidates[num_candidates].combo = candidate->combo;
-- west build: running target ram_report
[1/12] Generating linker_zephyr_pre0.cmd
[2/12] Generating linker_zephyr_pre1.cmd
[3/12] Linking C executable zephyr/zephyr_pre0.elf
[4/12] Generating dev_handles.c
[5/12] Building C object zephyr/CMakeFiles/zephyr_pre1.dir/dev_handles.c.obj
[6/12] Linking C executable zephyr/zephyr_pre1.elf
[7/12] Generating linker.cmd
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix_transform.h>
&xiao_spi {
status = "okay";
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <usb/usb_device.h>
#include <usb/class/usb_hid.h>
[00:00:08.332,000] <dbg> zmk: auth_pairing_accept: role 1, open? yes
[00:00:08.422,000] <dbg> bt_smp: bt_smp_recv: Received SMP code 0x0c len 64
[00:00:08.422,000] <dbg> bt_smp: smp_public_key:
[00:00:08.422,000] <dbg> bt_smp: smp_f4: u 29be6a80122b89ca1a4743e32bc334c1477454197ebff1b2149b9e64fd799fb6
[00:00:08.422,000] <dbg> bt_smp: smp_f4: v 74baaf895721cadc33e9bf50ed5efb729e539b6c7e875f6480c2dd9fb3c399e2
[00:00:08.422,000] <dbg> bt_smp: smp_f4: x 3ed59152a51ba108896ac455f14c2b30 z 0x0
[00:00:08.425,000] <dbg> bt_smp: smp_f4: res f3b8e1d35c40e92e654ce64d89a09892
[00:00:08.579,000] <dbg> bt_smp: bt_smp_dhkey_ready: 0x2000a6eb
[00:00:08.691,000] <dbg> bt_smp: bt_smp_recv: Received SMP code 0x04 len 16
[00:00:08.691,000] <dbg> bt_smp: smp_pairing_random:
def load_points():
stream = open(f"{file_dir}/output/points/points.yaml", "r")
points = yaml.safe_load(stream)
return points
def points_with_tag(tag, points=load_points()):
filtered = [x for x in points.values() if x["meta"].get("tags") and x["meta"]["tags"].get(tag)]