From ff2230735e2a882122e06f2ac30ae9ee653b22e8 Mon Sep 17 00:00:00 2001 From: afiqzudinhadi Date: Mon, 22 Jun 2026 23:55:33 +0800 Subject: [PATCH] Fix: remove extern C wrappers around Zephyr headers (cbprintf_cxx linkage conflict) --- src/engine_init.cc | 2 -- src/platform/zmk_clock_shim.cc | 3 --- src/platform/zmk_console_shim.cc | 6 ------ src/platform/zmk_flash_shim.cc | 21 --------------------- src/platform/zmk_key_shim.cc | 13 +------------ 5 files changed, 1 insertion(+), 44 deletions(-) diff --git a/src/engine_init.cc b/src/engine_init.cc index f58f7cb..4f222f9 100644 --- a/src/engine_init.cc +++ b/src/engine_init.cc @@ -17,10 +17,8 @@ #include "static_allocate.h" #include "stroke.h" -extern "C" { #include #include -} LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); diff --git a/src/platform/zmk_clock_shim.cc b/src/platform/zmk_clock_shim.cc index c4a30c5..90f0381 100644 --- a/src/platform/zmk_clock_shim.cc +++ b/src/platform/zmk_clock_shim.cc @@ -1,8 +1,5 @@ #include "clock.h" - -extern "C" { #include -} uint32_t Clock::GetMilliseconds() { return k_uptime_get_32(); } diff --git a/src/platform/zmk_console_shim.cc b/src/platform/zmk_console_shim.cc index a6d0335..b4abd6a 100644 --- a/src/platform/zmk_console_shim.cc +++ b/src/platform/zmk_console_shim.cc @@ -1,15 +1,9 @@ #include "console.h" - -extern "C" { #include #include -} LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -// Route Javelin console output to ZMK logging system. -// In Phase 5, this can be upgraded to USB CDC ACM for interactive console. - static char line_buf[256]; static size_t line_pos = 0; diff --git a/src/platform/zmk_flash_shim.cc b/src/platform/zmk_flash_shim.cc index 6860b0d..c290f9c 100644 --- a/src/platform/zmk_flash_shim.cc +++ b/src/platform/zmk_flash_shim.cc @@ -1,29 +1,8 @@ #include "flash.h" #include "mem.h" - -extern "C" { #include #include -#include -} -// Flash partition IDs — must match DTS overlay. -// steno_dict_partition: compiled dictionary (read-only at runtime) -// steno_user_partition: user dictionary (read-write) -// -// Javelin's Flash class uses raw pointers into XIP-mapped flash. -// On nRF52840, internal flash is memory-mapped at 0x00000000. -// We convert between XIP pointers and partition offsets. - -#ifndef FIXED_PARTITION_ID -#define FIXED_PARTITION_ID(label) FLASH_AREA_ID(label) -#endif - -// Flash::instance is defined in javelin/flash.cc (high-level methods). -// We only provide the platform-specific EraseBlockInternal/WriteBlockInternal. - -// Convert XIP address to flash device offset. -// nRF52840 internal flash is at 0x00000000, so pointer == offset. static off_t xip_to_offset(const void *ptr) { return (off_t)(uintptr_t)ptr; } diff --git a/src/platform/zmk_key_shim.cc b/src/platform/zmk_key_shim.cc index 93a7e9d..48b6987 100644 --- a/src/platform/zmk_key_shim.cc +++ b/src/platform/zmk_key_shim.cc @@ -2,16 +2,8 @@ #include "key_code.h" #include - -extern "C" { #include #include -} - -// Javelin KeyCode layout: -// 0x04-0xE7 → USB HID Keyboard page (0x07) -// 0xE0-0xE7 → Modifier keys (subset of keyboard page) -// 0x10000+ → Consumer page (0x0C), usage = value & 0xFFFF static constexpr uint16_t HID_USAGE_PAGE_KEYBOARD = 0x07; static constexpr uint16_t HID_USAGE_PAGE_CONSUMER = 0x0C; @@ -46,7 +38,4 @@ void Key::Press(KeyCode key) { emit_keycode(key, true); } void Key::Release(KeyCode key) { emit_keycode(key, false); } -void Key::Flush() { - // ZMK processes events asynchronously via its event queue. - // Flush is a no-op — events are dispatched as they're raised. -} +void Key::Flush() {}