From 1fc1fbbfc81c9ff62ae18152634ab4f791de81a0 Mon Sep 17 00:00:00 2001 From: genteure Date: Sat, 20 Dec 2025 10:23:43 +0000 Subject: [PATCH] rename kconfig symbols, cleaner macros, and other --- app/CMakeLists.txt | 2 +- app/Kconfig | 8 +- app/dts/bindings/zmk,battery-reporting.yaml | 22 +- .../dt-bindings/zmk/battery_reporting.h | 790 ++++++++++++++++++ app/include/zmk/battery_names.h | 285 +++++++ app/include/zmk/hid.h | 34 +- app/include/zmk/usb_hid.h | 4 +- .../battery-reporting-test.overlay | 14 +- app/src/battery.c | 12 +- app/src/battery_reporting.c | 218 ++--- app/src/hid.c | 15 +- app/src/split/bluetooth/Kconfig | 3 +- app/src/split/bluetooth/central.c | 20 +- app/src/usb_hid.c | 8 +- 14 files changed, 1255 insertions(+), 180 deletions(-) create mode 100644 app/include/dt-bindings/zmk/battery_reporting.h create mode 100644 app/include/zmk/battery_names.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 2d2669154..cab1240e2 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -94,7 +94,7 @@ target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/behaviors/behavior_bac if(CONFIG_ZMK_BATTERY_REPORTING) target_sources(app PRIVATE src/events/battery_state_changed.c) target_sources(app PRIVATE src/battery.c) - target_sources_ifndef(CONFIG_BT_BAS app PRIVATE src/battery_reporting.c) + target_sources_ifdef(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_PROXY app PRIVATE src/battery_reporting.c) endif() target_sources_ifdef(CONFIG_ZMK_HID_INDICATORS app PRIVATE src/events/hid_indicators_changed.c) diff --git a/app/Kconfig b/app/Kconfig index 35327eba2..235e0baf8 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -381,13 +381,13 @@ config ZMK_BATTERY_REPORTING_FETCH_MODE_LITHIUM_VOLTAGE endchoice -config ZMK_BATTERY_REPORTING_BAS - bool "Report Battery Level over BLE" +config ZMK_BATTERY_REPORTING_BLE + bool "Report Battery Level over BLE Battery Service" default y depends on ZMK_BLE select BT_BAS if (!ZMK_SPLIT || (ZMK_SPLIT && !ZMK_SPLIT_ROLE_CENTRAL)) -config ZMK_BATTERY_REPORTING_HID +config ZMK_BATTERY_REPORTING_USB bool "Report Battery Level over USB HID" depends on ZMK_USB @@ -395,14 +395,12 @@ if ZMK_SPLIT_ROLE_CENTRAL config ZMK_BATTERY_REPORTING_SPLIT_FETCHING bool "Fetch Peripheral Battery Level Info" - default y if ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING help Adds internal support for fetching the battery levels from peripherals and generating events in the ZMK eventing system. config ZMK_BATTERY_REPORTING_SPLIT_PROXY bool "Proxy Battery Level Info" - depends on ZMK_BATTERY_REPORTING_BAS default y if ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY help Adds support for reporting the battery levels of connected split diff --git a/app/dts/bindings/zmk,battery-reporting.yaml b/app/dts/bindings/zmk,battery-reporting.yaml index 6afd6d6ec..fef9f23d8 100644 --- a/app/dts/bindings/zmk,battery-reporting.yaml +++ b/app/dts/bindings/zmk,battery-reporting.yaml @@ -12,29 +12,11 @@ child-binding: display-name: type: string required: false + description: | + A human-readable name for this battery. Defaults to readable form of CPF. cpf: type: int required: false - enum: [ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, - 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, - 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, - 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, - 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, - 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, - 0x109, 0x10A, 0x10B, 0x10C, 0x10D, 0x10E, 0x10F, 0x110, 0x111 - ] description: | Characteristic Presentation Format descriptor for battery reporting diff --git a/app/include/dt-bindings/zmk/battery_reporting.h b/app/include/dt-bindings/zmk/battery_reporting.h new file mode 100644 index 000000000..b730a418b --- /dev/null +++ b/app/include/dt-bindings/zmk/battery_reporting.h @@ -0,0 +1,790 @@ +/* + * Copyright (c) 2025 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#define ZMK_CPF_DESC_UNKNOWN 0x0000 + +#define ZMK_CPF_DESC_FIRST 0X0001 +#define ZMK_CPF_DESC_1 ZMK_CPF_DESC_FIRST + +#define ZMK_CPF_DESC_SECOND 0X0002 +#define ZMK_CPF_DESC_2 ZMK_CPF_DESC_SECOND + +#define ZMK_CPF_DESC_THIRD 0X0003 +#define ZMK_CPF_DESC_3 ZMK_CPF_DESC_THIRD + +#define ZMK_CPF_DESC_FOURTH 0X0004 +#define ZMK_CPF_DESC_4 ZMK_CPF_DESC_FOURTH + +#define ZMK_CPF_DESC_FIFTH 0X0005 +#define ZMK_CPF_DESC_5 ZMK_CPF_DESC_FIFTH + +#define ZMK_CPF_DESC_SIXTH 0X0006 +#define ZMK_CPF_DESC_6 ZMK_CPF_DESC_SIXTH + +#define ZMK_CPF_DESC_SEVENTH 0X0007 +#define ZMK_CPF_DESC_7 ZMK_CPF_DESC_SEVENTH + +#define ZMK_CPF_DESC_EIGHTH 0X0008 +#define ZMK_CPF_DESC_8 ZMK_CPF_DESC_EIGHTH + +#define ZMK_CPF_DESC_NINTH 0X0009 +#define ZMK_CPF_DESC_9 ZMK_CPF_DESC_NINTH + +#define ZMK_CPF_DESC_TENTH 0X000A +#define ZMK_CPF_DESC_10 ZMK_CPF_DESC_TENTH + +#define ZMK_CPF_DESC_ELEVENTH 0X000B +#define ZMK_CPF_DESC_11 ZMK_CPF_DESC_ELEVENTH + +#define ZMK_CPF_DESC_TWELFTH 0X000C +#define ZMK_CPF_DESC_12 ZMK_CPF_DESC_TWELFTH + +#define ZMK_CPF_DESC_THIRTEENTH 0X000D +#define ZMK_CPF_DESC_13 ZMK_CPF_DESC_THIRTEENTH + +#define ZMK_CPF_DESC_FOURTEENTH 0X000E +#define ZMK_CPF_DESC_14 ZMK_CPF_DESC_FOURTEENTH + +#define ZMK_CPF_DESC_FIFTEENTH 0X000F +#define ZMK_CPF_DESC_15 ZMK_CPF_DESC_FIFTEENTH + +#define ZMK_CPF_DESC_SIXTEENTH 0X0010 +#define ZMK_CPF_DESC_16 ZMK_CPF_DESC_SIXTEENTH + +#define ZMK_CPF_DESC_SEVENTEENTH 0X0011 +#define ZMK_CPF_DESC_17 ZMK_CPF_DESC_SEVENTEENTH + +#define ZMK_CPF_DESC_EIGHTEENTH 0X0012 +#define ZMK_CPF_DESC_18 ZMK_CPF_DESC_EIGHTEENTH + +#define ZMK_CPF_DESC_NINETEENTH 0X0013 +#define ZMK_CPF_DESC_19 ZMK_CPF_DESC_NINETEENTH + +#define ZMK_CPF_DESC_TWENTIETH 0X0014 +#define ZMK_CPF_DESC_20 ZMK_CPF_DESC_TWENTIETH + +#define ZMK_CPF_DESC_TWENTY_FIRST 0X0015 +#define ZMK_CPF_DESC_21 ZMK_CPF_DESC_TWENTY_FIRST + +#define ZMK_CPF_DESC_TWENTY_SECOND 0X0016 +#define ZMK_CPF_DESC_22 ZMK_CPF_DESC_TWENTY_SECOND + +#define ZMK_CPF_DESC_TWENTY_THIRD 0X0017 +#define ZMK_CPF_DESC_23 ZMK_CPF_DESC_TWENTY_THIRD + +#define ZMK_CPF_DESC_TWENTY_FOURTH 0X0018 +#define ZMK_CPF_DESC_24 ZMK_CPF_DESC_TWENTY_FOURTH + +#define ZMK_CPF_DESC_TWENTY_FIFTH 0X0019 +#define ZMK_CPF_DESC_25 ZMK_CPF_DESC_TWENTY_FIFTH + +#define ZMK_CPF_DESC_TWENTY_SIXTH 0X001A +#define ZMK_CPF_DESC_26 ZMK_CPF_DESC_TWENTY_SIXTH + +#define ZMK_CPF_DESC_TWENTY_SEVENTH 0X001B +#define ZMK_CPF_DESC_27 ZMK_CPF_DESC_TWENTY_SEVENTH + +#define ZMK_CPF_DESC_TWENTY_EIGHTH 0X001C +#define ZMK_CPF_DESC_28 ZMK_CPF_DESC_TWENTY_EIGHTH + +#define ZMK_CPF_DESC_TWENTY_NINTH 0X001D +#define ZMK_CPF_DESC_29 ZMK_CPF_DESC_TWENTY_NINTH + +#define ZMK_CPF_DESC_THIRTIETH 0X001E +#define ZMK_CPF_DESC_30 ZMK_CPF_DESC_THIRTIETH + +#define ZMK_CPF_DESC_THIRTY_FIRST 0X001F +#define ZMK_CPF_DESC_31 ZMK_CPF_DESC_THIRTY_FIRST + +#define ZMK_CPF_DESC_THIRTY_SECOND 0X0020 +#define ZMK_CPF_DESC_32 ZMK_CPF_DESC_THIRTY_SECOND + +#define ZMK_CPF_DESC_THIRTY_THIRD 0X0021 +#define ZMK_CPF_DESC_33 ZMK_CPF_DESC_THIRTY_THIRD + +#define ZMK_CPF_DESC_THIRTY_FOURTH 0X0022 +#define ZMK_CPF_DESC_34 ZMK_CPF_DESC_THIRTY_FOURTH + +#define ZMK_CPF_DESC_THIRTY_FIFTH 0X0023 +#define ZMK_CPF_DESC_35 ZMK_CPF_DESC_THIRTY_FIFTH + +#define ZMK_CPF_DESC_THIRTY_SIXTH 0X0024 +#define ZMK_CPF_DESC_36 ZMK_CPF_DESC_THIRTY_SIXTH + +#define ZMK_CPF_DESC_THIRTY_SEVENTH 0X0025 +#define ZMK_CPF_DESC_37 ZMK_CPF_DESC_THIRTY_SEVENTH + +#define ZMK_CPF_DESC_THIRTY_EIGHTH 0X0026 +#define ZMK_CPF_DESC_38 ZMK_CPF_DESC_THIRTY_EIGHTH + +#define ZMK_CPF_DESC_THIRTY_NINTH 0X0027 +#define ZMK_CPF_DESC_39 ZMK_CPF_DESC_THIRTY_NINTH + +#define ZMK_CPF_DESC_FORTIETH 0X0028 +#define ZMK_CPF_DESC_40 ZMK_CPF_DESC_FORTIETH + +#define ZMK_CPF_DESC_FORTY_FIRST 0X0029 +#define ZMK_CPF_DESC_41 ZMK_CPF_DESC_FORTY_FIRST + +#define ZMK_CPF_DESC_FORTY_SECOND 0X002A +#define ZMK_CPF_DESC_42 ZMK_CPF_DESC_FORTY_SECOND + +#define ZMK_CPF_DESC_FORTY_THIRD 0X002B +#define ZMK_CPF_DESC_43 ZMK_CPF_DESC_FORTY_THIRD + +#define ZMK_CPF_DESC_FORTY_FOURTH 0X002C +#define ZMK_CPF_DESC_44 ZMK_CPF_DESC_FORTY_FOURTH + +#define ZMK_CPF_DESC_FORTY_FIFTH 0X002D +#define ZMK_CPF_DESC_45 ZMK_CPF_DESC_FORTY_FIFTH + +#define ZMK_CPF_DESC_FORTY_SIXTH 0X002E +#define ZMK_CPF_DESC_46 ZMK_CPF_DESC_FORTY_SIXTH + +#define ZMK_CPF_DESC_FORTY_SEVENTH 0X002F +#define ZMK_CPF_DESC_47 ZMK_CPF_DESC_FORTY_SEVENTH + +#define ZMK_CPF_DESC_FORTY_EIGHTH 0X0030 +#define ZMK_CPF_DESC_48 ZMK_CPF_DESC_FORTY_EIGHTH + +#define ZMK_CPF_DESC_FORTY_NINTH 0X0031 +#define ZMK_CPF_DESC_49 ZMK_CPF_DESC_FORTY_NINTH + +#define ZMK_CPF_DESC_FIFTIETH 0X0032 +#define ZMK_CPF_DESC_50 ZMK_CPF_DESC_FIFTIETH + +#define ZMK_CPF_DESC_FIFTY_FIRST 0X0033 +#define ZMK_CPF_DESC_51 ZMK_CPF_DESC_FIFTY_FIRST + +#define ZMK_CPF_DESC_FIFTY_SECOND 0X0034 +#define ZMK_CPF_DESC_52 ZMK_CPF_DESC_FIFTY_SECOND + +#define ZMK_CPF_DESC_FIFTY_THIRD 0X0035 +#define ZMK_CPF_DESC_53 ZMK_CPF_DESC_FIFTY_THIRD + +#define ZMK_CPF_DESC_FIFTY_FOURTH 0X0036 +#define ZMK_CPF_DESC_54 ZMK_CPF_DESC_FIFTY_FOURTH + +#define ZMK_CPF_DESC_FIFTY_FIFTH 0X0037 +#define ZMK_CPF_DESC_55 ZMK_CPF_DESC_FIFTY_FIFTH + +#define ZMK_CPF_DESC_FIFTY_SIXTH 0X0038 +#define ZMK_CPF_DESC_56 ZMK_CPF_DESC_FIFTY_SIXTH + +#define ZMK_CPF_DESC_FIFTY_SEVENTH 0X0039 +#define ZMK_CPF_DESC_57 ZMK_CPF_DESC_FIFTY_SEVENTH + +#define ZMK_CPF_DESC_FIFTY_EIGHTH 0X003A +#define ZMK_CPF_DESC_58 ZMK_CPF_DESC_FIFTY_EIGHTH + +#define ZMK_CPF_DESC_FIFTY_NINTH 0X003B +#define ZMK_CPF_DESC_59 ZMK_CPF_DESC_FIFTY_NINTH + +#define ZMK_CPF_DESC_SIXTIETH 0X003C +#define ZMK_CPF_DESC_60 ZMK_CPF_DESC_SIXTIETH + +#define ZMK_CPF_DESC_SIXTY_FIRST 0X003D +#define ZMK_CPF_DESC_61 ZMK_CPF_DESC_SIXTY_FIRST + +#define ZMK_CPF_DESC_SIXTY_SECOND 0X003E +#define ZMK_CPF_DESC_62 ZMK_CPF_DESC_SIXTY_SECOND + +#define ZMK_CPF_DESC_SIXTY_THIRD 0X003F +#define ZMK_CPF_DESC_63 ZMK_CPF_DESC_SIXTY_THIRD + +#define ZMK_CPF_DESC_SIXTY_FOURTH 0X0040 +#define ZMK_CPF_DESC_64 ZMK_CPF_DESC_SIXTY_FOURTH + +#define ZMK_CPF_DESC_SIXTY_FIFTH 0X0041 +#define ZMK_CPF_DESC_65 ZMK_CPF_DESC_SIXTY_FIFTH + +#define ZMK_CPF_DESC_SIXTY_SIXTH 0X0042 +#define ZMK_CPF_DESC_66 ZMK_CPF_DESC_SIXTY_SIXTH + +#define ZMK_CPF_DESC_SIXTY_SEVENTH 0X0043 +#define ZMK_CPF_DESC_67 ZMK_CPF_DESC_SIXTY_SEVENTH + +#define ZMK_CPF_DESC_SIXTY_EIGHTH 0X0044 +#define ZMK_CPF_DESC_68 ZMK_CPF_DESC_SIXTY_EIGHTH + +#define ZMK_CPF_DESC_SIXTY_NINTH 0X0045 +#define ZMK_CPF_DESC_69 ZMK_CPF_DESC_SIXTY_NINTH + +#define ZMK_CPF_DESC_SEVENTIETH 0X0046 +#define ZMK_CPF_DESC_70 ZMK_CPF_DESC_SEVENTIETH + +#define ZMK_CPF_DESC_SEVENTY_FIRST 0X0047 +#define ZMK_CPF_DESC_71 ZMK_CPF_DESC_SEVENTY_FIRST + +#define ZMK_CPF_DESC_SEVENTY_SECOND 0X0048 +#define ZMK_CPF_DESC_72 ZMK_CPF_DESC_SEVENTY_SECOND + +#define ZMK_CPF_DESC_SEVENTY_THIRD 0X0049 +#define ZMK_CPF_DESC_73 ZMK_CPF_DESC_SEVENTY_THIRD + +#define ZMK_CPF_DESC_SEVENTY_FOURTH 0X004A +#define ZMK_CPF_DESC_74 ZMK_CPF_DESC_SEVENTY_FOURTH + +#define ZMK_CPF_DESC_SEVENTY_FIFTH 0X004B +#define ZMK_CPF_DESC_75 ZMK_CPF_DESC_SEVENTY_FIFTH + +#define ZMK_CPF_DESC_SEVENTY_SIXTH 0X004C +#define ZMK_CPF_DESC_76 ZMK_CPF_DESC_SEVENTY_SIXTH + +#define ZMK_CPF_DESC_SEVENTY_SEVENTH 0X004D +#define ZMK_CPF_DESC_77 ZMK_CPF_DESC_SEVENTY_SEVENTH + +#define ZMK_CPF_DESC_SEVENTY_EIGHTH 0X004E +#define ZMK_CPF_DESC_78 ZMK_CPF_DESC_SEVENTY_EIGHTH + +#define ZMK_CPF_DESC_SEVENTY_NINTH 0X004F +#define ZMK_CPF_DESC_79 ZMK_CPF_DESC_SEVENTY_NINTH + +#define ZMK_CPF_DESC_EIGHTIETH 0X0050 +#define ZMK_CPF_DESC_80 ZMK_CPF_DESC_EIGHTIETH + +#define ZMK_CPF_DESC_EIGHTY_FIRST 0X0051 +#define ZMK_CPF_DESC_81 ZMK_CPF_DESC_EIGHTY_FIRST + +#define ZMK_CPF_DESC_EIGHTY_SECOND 0X0052 +#define ZMK_CPF_DESC_82 ZMK_CPF_DESC_EIGHTY_SECOND + +#define ZMK_CPF_DESC_EIGHTY_THIRD 0X0053 +#define ZMK_CPF_DESC_83 ZMK_CPF_DESC_EIGHTY_THIRD + +#define ZMK_CPF_DESC_EIGHTY_FOURTH 0X0054 +#define ZMK_CPF_DESC_84 ZMK_CPF_DESC_EIGHTY_FOURTH + +#define ZMK_CPF_DESC_EIGHTY_FIFTH 0X0055 +#define ZMK_CPF_DESC_85 ZMK_CPF_DESC_EIGHTY_FIFTH + +#define ZMK_CPF_DESC_EIGHTY_SIXTH 0X0056 +#define ZMK_CPF_DESC_86 ZMK_CPF_DESC_EIGHTY_SIXTH + +#define ZMK_CPF_DESC_EIGHTY_SEVENTH 0X0057 +#define ZMK_CPF_DESC_87 ZMK_CPF_DESC_EIGHTY_SEVENTH + +#define ZMK_CPF_DESC_EIGHTY_EIGHTH 0X0058 +#define ZMK_CPF_DESC_88 ZMK_CPF_DESC_EIGHTY_EIGHTH + +#define ZMK_CPF_DESC_EIGHTY_NINTH 0X0059 +#define ZMK_CPF_DESC_89 ZMK_CPF_DESC_EIGHTY_NINTH + +#define ZMK_CPF_DESC_NINETIETH 0X005A +#define ZMK_CPF_DESC_90 ZMK_CPF_DESC_NINETIETH + +#define ZMK_CPF_DESC_NINETY_FIRST 0X005B +#define ZMK_CPF_DESC_91 ZMK_CPF_DESC_NINETY_FIRST + +#define ZMK_CPF_DESC_NINETY_SECOND 0X005C +#define ZMK_CPF_DESC_92 ZMK_CPF_DESC_NINETY_SECOND + +#define ZMK_CPF_DESC_NINETY_THIRD 0X005D +#define ZMK_CPF_DESC_93 ZMK_CPF_DESC_NINETY_THIRD + +#define ZMK_CPF_DESC_NINETY_FOURTH 0X005E +#define ZMK_CPF_DESC_94 ZMK_CPF_DESC_NINETY_FOURTH + +#define ZMK_CPF_DESC_NINETY_FIFTH 0X005F +#define ZMK_CPF_DESC_95 ZMK_CPF_DESC_NINETY_FIFTH + +#define ZMK_CPF_DESC_NINETY_SIXTH 0X0060 +#define ZMK_CPF_DESC_96 ZMK_CPF_DESC_NINETY_SIXTH + +#define ZMK_CPF_DESC_NINETY_SEVENTH 0X0061 +#define ZMK_CPF_DESC_97 ZMK_CPF_DESC_NINETY_SEVENTH + +#define ZMK_CPF_DESC_NINETY_EIGHTH 0X0062 +#define ZMK_CPF_DESC_98 ZMK_CPF_DESC_NINETY_EIGHTH + +#define ZMK_CPF_DESC_NINETY_NINTH 0X0063 +#define ZMK_CPF_DESC_99 ZMK_CPF_DESC_NINETY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDREDTH 0X0064 +#define ZMK_CPF_DESC_100 ZMK_CPF_DESC_ONE_HUNDREDTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIRST 0X0065 +#define ZMK_CPF_DESC_101 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SECOND 0X0066 +#define ZMK_CPF_DESC_102 ZMK_CPF_DESC_ONE_HUNDRED_AND_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRD 0X0067 +#define ZMK_CPF_DESC_103 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FOURTH 0X0068 +#define ZMK_CPF_DESC_104 ZMK_CPF_DESC_ONE_HUNDRED_AND_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTH 0X0069 +#define ZMK_CPF_DESC_105 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTH 0X006A +#define ZMK_CPF_DESC_106 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTH 0X006B +#define ZMK_CPF_DESC_107 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTH 0X006C +#define ZMK_CPF_DESC_108 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINTH 0X006D +#define ZMK_CPF_DESC_109 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TENTH 0X006E +#define ZMK_CPF_DESC_110 ZMK_CPF_DESC_ONE_HUNDRED_AND_TENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_ELEVENTH 0X006F +#define ZMK_CPF_DESC_111 ZMK_CPF_DESC_ONE_HUNDRED_AND_ELEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWELFTH 0X0070 +#define ZMK_CPF_DESC_112 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWELFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTEENTH 0X0071 +#define ZMK_CPF_DESC_113 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTEENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FOURTEENTH 0X0072 +#define ZMK_CPF_DESC_114 ZMK_CPF_DESC_ONE_HUNDRED_AND_FOURTEENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTEENTH 0X0073 +#define ZMK_CPF_DESC_115 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTEENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTEENTH 0X0074 +#define ZMK_CPF_DESC_116 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTEENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTEENTH 0X0075 +#define ZMK_CPF_DESC_117 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTEENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTEENTH 0X0076 +#define ZMK_CPF_DESC_118 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTEENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETEENTH 0X0077 +#define ZMK_CPF_DESC_119 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETEENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_TWENTIETH 0X0078 +#define ZMK_CPF_DESC_120 ZMK_CPF_DESC_ONE_HUNDRED_TWENTIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_FIRST 0X0079 +#define ZMK_CPF_DESC_121 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_SECOND 0X007A +#define ZMK_CPF_DESC_122 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_THIRD 0X007B +#define ZMK_CPF_DESC_123 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_FOURTH 0X007C +#define ZMK_CPF_DESC_124 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_FIFTH 0X007D +#define ZMK_CPF_DESC_125 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_SIXTH 0X007E +#define ZMK_CPF_DESC_126 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_SEVENTH 0X007F +#define ZMK_CPF_DESC_127 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_EIGHTH 0X0080 +#define ZMK_CPF_DESC_128 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_NINTH 0X0081 +#define ZMK_CPF_DESC_129 ZMK_CPF_DESC_ONE_HUNDRED_AND_TWENTY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_THIRTIETH 0X0082 +#define ZMK_CPF_DESC_130 ZMK_CPF_DESC_ONE_HUNDRED_THIRTIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_FIRST 0X0083 +#define ZMK_CPF_DESC_131 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_SECOND 0X0084 +#define ZMK_CPF_DESC_132 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_THIRD 0X0085 +#define ZMK_CPF_DESC_133 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_FOURTH 0X0086 +#define ZMK_CPF_DESC_134 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_FIFTH 0X0087 +#define ZMK_CPF_DESC_135 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_SIXTH 0X0088 +#define ZMK_CPF_DESC_136 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_SEVENTH 0X0089 +#define ZMK_CPF_DESC_137 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_EIGHTH 0X008A +#define ZMK_CPF_DESC_138 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_NINTH 0X008B +#define ZMK_CPF_DESC_139 ZMK_CPF_DESC_ONE_HUNDRED_AND_THIRTY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_FORTIETH 0X008C +#define ZMK_CPF_DESC_140 ZMK_CPF_DESC_ONE_HUNDRED_FORTIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_FIRST 0X008D +#define ZMK_CPF_DESC_141 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_SECOND 0X008E +#define ZMK_CPF_DESC_142 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_THIRD 0X008F +#define ZMK_CPF_DESC_143 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_FOURTH 0X0090 +#define ZMK_CPF_DESC_144 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_FIFTH 0X0091 +#define ZMK_CPF_DESC_145 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_SIXTH 0X0092 +#define ZMK_CPF_DESC_146 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_SEVENTH 0X0093 +#define ZMK_CPF_DESC_147 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_EIGHTH 0X0094 +#define ZMK_CPF_DESC_148 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_NINTH 0X0095 +#define ZMK_CPF_DESC_149 ZMK_CPF_DESC_ONE_HUNDRED_AND_FORTY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_FIFTIETH 0X0096 +#define ZMK_CPF_DESC_150 ZMK_CPF_DESC_ONE_HUNDRED_FIFTIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_FIRST 0X0097 +#define ZMK_CPF_DESC_151 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_SECOND 0X0098 +#define ZMK_CPF_DESC_152 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_THIRD 0X0099 +#define ZMK_CPF_DESC_153 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_FOURTH 0X009A +#define ZMK_CPF_DESC_154 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_FIFTH 0X009B +#define ZMK_CPF_DESC_155 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_SIXTH 0X009C +#define ZMK_CPF_DESC_156 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_SEVENTH 0X009D +#define ZMK_CPF_DESC_157 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_EIGHTH 0X009E +#define ZMK_CPF_DESC_158 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_NINTH 0X009F +#define ZMK_CPF_DESC_159 ZMK_CPF_DESC_ONE_HUNDRED_AND_FIFTY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_SIXTIETH 0X00A0 +#define ZMK_CPF_DESC_160 ZMK_CPF_DESC_ONE_HUNDRED_SIXTIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_FIRST 0X00A1 +#define ZMK_CPF_DESC_161 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_SECOND 0X00A2 +#define ZMK_CPF_DESC_162 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_THIRD 0X00A3 +#define ZMK_CPF_DESC_163 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_FOURTH 0X00A4 +#define ZMK_CPF_DESC_164 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_FIFTH 0X00A5 +#define ZMK_CPF_DESC_165 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_SIXTH 0X00A6 +#define ZMK_CPF_DESC_166 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_SEVENTH 0X00A7 +#define ZMK_CPF_DESC_167 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_EIGHTH 0X00A8 +#define ZMK_CPF_DESC_168 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_NINTH 0X00A9 +#define ZMK_CPF_DESC_169 ZMK_CPF_DESC_ONE_HUNDRED_AND_SIXTY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_SEVENTIETH 0X00AA +#define ZMK_CPF_DESC_170 ZMK_CPF_DESC_ONE_HUNDRED_SEVENTIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_FIRST 0X00AB +#define ZMK_CPF_DESC_171 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_SECOND 0X00AC +#define ZMK_CPF_DESC_172 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_THIRD 0X00AD +#define ZMK_CPF_DESC_173 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_FOURTH 0X00AE +#define ZMK_CPF_DESC_174 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_FIFTH 0X00AF +#define ZMK_CPF_DESC_175 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_SIXTH 0X00B0 +#define ZMK_CPF_DESC_176 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_SEVENTH 0X00B1 +#define ZMK_CPF_DESC_177 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_EIGHTH 0X00B2 +#define ZMK_CPF_DESC_178 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_NINTH 0X00B3 +#define ZMK_CPF_DESC_179 ZMK_CPF_DESC_ONE_HUNDRED_AND_SEVENTY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_EIGHTIETH 0X00B4 +#define ZMK_CPF_DESC_180 ZMK_CPF_DESC_ONE_HUNDRED_EIGHTIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_FIRST 0X00B5 +#define ZMK_CPF_DESC_181 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_SECOND 0X00B6 +#define ZMK_CPF_DESC_182 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_THIRD 0X00B7 +#define ZMK_CPF_DESC_183 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_FOURTH 0X00B8 +#define ZMK_CPF_DESC_184 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_FIFTH 0X00B9 +#define ZMK_CPF_DESC_185 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_SIXTH 0X00BA +#define ZMK_CPF_DESC_186 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_SEVENTH 0X00BB +#define ZMK_CPF_DESC_187 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_EIGHTH 0X00BC +#define ZMK_CPF_DESC_188 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_NINTH 0X00BD +#define ZMK_CPF_DESC_189 ZMK_CPF_DESC_ONE_HUNDRED_AND_EIGHTY_NINTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_NINETIETH 0X00BE +#define ZMK_CPF_DESC_190 ZMK_CPF_DESC_ONE_HUNDRED_NINETIETH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_FIRST 0X00BF +#define ZMK_CPF_DESC_191 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_FIRST + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_SECOND 0X00C0 +#define ZMK_CPF_DESC_192 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_SECOND + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_THIRD 0X00C1 +#define ZMK_CPF_DESC_193 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_THIRD + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_FOURTH 0X00C2 +#define ZMK_CPF_DESC_194 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_FOURTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_FIFTH 0X00C3 +#define ZMK_CPF_DESC_195 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_FIFTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_SIXTH 0X00C4 +#define ZMK_CPF_DESC_196 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_SIXTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_SEVENTH 0X00C5 +#define ZMK_CPF_DESC_197 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_SEVENTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_EIGHTH 0X00C6 +#define ZMK_CPF_DESC_198 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_EIGHTH + +#define ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_NINTH 0X00C7 +#define ZMK_CPF_DESC_199 ZMK_CPF_DESC_ONE_HUNDRED_AND_NINETY_NINTH + +#define ZMK_CPF_DESC_TWO_HUNDREDTH 0X00C8 +#define ZMK_CPF_DESC_200 ZMK_CPF_DESC_TWO_HUNDREDTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIRST 0X00C9 +#define ZMK_CPF_DESC_201 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIRST + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_SECOND 0X00CA +#define ZMK_CPF_DESC_202 ZMK_CPF_DESC_TWO_HUNDRED_AND_SECOND + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRD 0X00CB +#define ZMK_CPF_DESC_203 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRD + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FOURTH 0X00CC +#define ZMK_CPF_DESC_204 ZMK_CPF_DESC_TWO_HUNDRED_AND_FOURTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTH 0X00CD +#define ZMK_CPF_DESC_205 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_SIXTH 0X00CE +#define ZMK_CPF_DESC_206 ZMK_CPF_DESC_TWO_HUNDRED_AND_SIXTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_SEVENTH 0X00CF +#define ZMK_CPF_DESC_207 ZMK_CPF_DESC_TWO_HUNDRED_AND_SEVENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_EIGHTH 0X00D0 +#define ZMK_CPF_DESC_208 ZMK_CPF_DESC_TWO_HUNDRED_AND_EIGHTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_NINTH 0X00D1 +#define ZMK_CPF_DESC_209 ZMK_CPF_DESC_TWO_HUNDRED_AND_NINTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TENTH 0X00D2 +#define ZMK_CPF_DESC_210 ZMK_CPF_DESC_TWO_HUNDRED_AND_TENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_ELEVENTH 0X00D3 +#define ZMK_CPF_DESC_211 ZMK_CPF_DESC_TWO_HUNDRED_AND_ELEVENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWELFTH 0X00D4 +#define ZMK_CPF_DESC_212 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWELFTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTEENTH 0X00D5 +#define ZMK_CPF_DESC_213 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTEENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FOURTEENTH 0X00D6 +#define ZMK_CPF_DESC_214 ZMK_CPF_DESC_TWO_HUNDRED_AND_FOURTEENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTEENTH 0X00D7 +#define ZMK_CPF_DESC_215 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTEENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_SIXTEENTH 0X00D8 +#define ZMK_CPF_DESC_216 ZMK_CPF_DESC_TWO_HUNDRED_AND_SIXTEENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_SEVENTEENTH 0X00D9 +#define ZMK_CPF_DESC_217 ZMK_CPF_DESC_TWO_HUNDRED_AND_SEVENTEENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_EIGHTEENTH 0X00DA +#define ZMK_CPF_DESC_218 ZMK_CPF_DESC_TWO_HUNDRED_AND_EIGHTEENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_NINETEENTH 0X00DB +#define ZMK_CPF_DESC_219 ZMK_CPF_DESC_TWO_HUNDRED_AND_NINETEENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_TWENTIETH 0X00DC +#define ZMK_CPF_DESC_220 ZMK_CPF_DESC_TWO_HUNDRED_TWENTIETH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_FIRST 0X00DD +#define ZMK_CPF_DESC_221 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_FIRST + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_SECOND 0X00DE +#define ZMK_CPF_DESC_222 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_SECOND + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_THIRD 0X00DF +#define ZMK_CPF_DESC_223 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_THIRD + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_FOURTH 0X00E0 +#define ZMK_CPF_DESC_224 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_FOURTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_FIFTH 0X00E1 +#define ZMK_CPF_DESC_225 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_FIFTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_SIXTH 0X00E2 +#define ZMK_CPF_DESC_226 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_SIXTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_SEVENTH 0X00E3 +#define ZMK_CPF_DESC_227 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_SEVENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_EIGHTH 0X00E4 +#define ZMK_CPF_DESC_228 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_EIGHTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_NINTH 0X00E5 +#define ZMK_CPF_DESC_229 ZMK_CPF_DESC_TWO_HUNDRED_AND_TWENTY_NINTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_THIRTIETH 0X00E6 +#define ZMK_CPF_DESC_230 ZMK_CPF_DESC_TWO_HUNDRED_THIRTIETH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_FIRST 0X00E7 +#define ZMK_CPF_DESC_231 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_FIRST + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_SECOND 0X00E8 +#define ZMK_CPF_DESC_232 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_SECOND + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_THIRD 0X00E9 +#define ZMK_CPF_DESC_233 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_THIRD + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_FOURTH 0X00EA +#define ZMK_CPF_DESC_234 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_FOURTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_FIFTH 0X00EB +#define ZMK_CPF_DESC_235 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_FIFTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_SIXTH 0X00EC +#define ZMK_CPF_DESC_236 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_SIXTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_SEVENTH 0X00ED +#define ZMK_CPF_DESC_237 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_SEVENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_EIGHTH 0X00EE +#define ZMK_CPF_DESC_238 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_EIGHTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_NINTH 0X00EF +#define ZMK_CPF_DESC_239 ZMK_CPF_DESC_TWO_HUNDRED_AND_THIRTY_NINTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_FORTIETH 0X00F0 +#define ZMK_CPF_DESC_240 ZMK_CPF_DESC_TWO_HUNDRED_FORTIETH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_FIRST 0X00F1 +#define ZMK_CPF_DESC_241 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_FIRST + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_SECOND 0X00F2 +#define ZMK_CPF_DESC_242 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_SECOND + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_THIRD 0X00F3 +#define ZMK_CPF_DESC_243 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_THIRD + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_FOURTH 0X00F4 +#define ZMK_CPF_DESC_244 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_FOURTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_FIFTH 0X00F5 +#define ZMK_CPF_DESC_245 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_FIFTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_SIXTH 0X00F6 +#define ZMK_CPF_DESC_246 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_SIXTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_SEVENTH 0X00F7 +#define ZMK_CPF_DESC_247 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_SEVENTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_EIGHTH 0X00F8 +#define ZMK_CPF_DESC_248 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_EIGHTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_NINTH 0X00F9 +#define ZMK_CPF_DESC_249 ZMK_CPF_DESC_TWO_HUNDRED_AND_FORTY_NINTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_FIFTIETH 0X00FA +#define ZMK_CPF_DESC_250 ZMK_CPF_DESC_TWO_HUNDRED_FIFTIETH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_FIRST 0X00FB +#define ZMK_CPF_DESC_251 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_FIRST + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_SECOND 0X00FC +#define ZMK_CPF_DESC_252 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_SECOND + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_THIRD 0X00FD +#define ZMK_CPF_DESC_253 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_THIRD + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_FOURTH 0X00FE +#define ZMK_CPF_DESC_254 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_FOURTH + +#define ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_FIFTH 0X00FF +#define ZMK_CPF_DESC_255 ZMK_CPF_DESC_TWO_HUNDRED_AND_FIFTY_FIFTH + +#define ZMK_CPF_DESC_FRONT 0x0100 +#define ZMK_CPF_DESC_BACK 0x0101 +#define ZMK_CPF_DESC_TOP 0x0102 +#define ZMK_CPF_DESC_BOTTOM 0x0103 +#define ZMK_CPF_DESC_UPPER 0x0104 +#define ZMK_CPF_DESC_LOWER 0x0105 +#define ZMK_CPF_DESC_MAIN 0x0106 +#define ZMK_CPF_DESC_BACKUP 0x0107 +#define ZMK_CPF_DESC_AUXILIARY 0x0108 +#define ZMK_CPF_DESC_SUPPLEMENTARY 0x0109 +#define ZMK_CPF_DESC_FLASH 0x010A +#define ZMK_CPF_DESC_INSIDE 0x010B +#define ZMK_CPF_DESC_OUTSIDE 0x010C +#define ZMK_CPF_DESC_LEFT 0x010D +#define ZMK_CPF_DESC_RIGHT 0x010E +#define ZMK_CPF_DESC_INTERNAL 0x010F +#define ZMK_CPF_DESC_EXTERNAL 0x0110 diff --git a/app/include/zmk/battery_names.h b/app/include/zmk/battery_names.h new file mode 100644 index 000000000..fa734f20f --- /dev/null +++ b/app/include/zmk/battery_names.h @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2025 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include + +#define ZMK_BATTERY_CPF_TO_NAME_0 "Unknown" +#define ZMK_BATTERY_CPF_TO_NAME_1 "First" +#define ZMK_BATTERY_CPF_TO_NAME_2 "Second" +#define ZMK_BATTERY_CPF_TO_NAME_3 "Third" +#define ZMK_BATTERY_CPF_TO_NAME_4 "Fourth" +#define ZMK_BATTERY_CPF_TO_NAME_5 "Fifth" +#define ZMK_BATTERY_CPF_TO_NAME_6 "Sixth" +#define ZMK_BATTERY_CPF_TO_NAME_7 "Seventh" +#define ZMK_BATTERY_CPF_TO_NAME_8 "Eighth" +#define ZMK_BATTERY_CPF_TO_NAME_9 "Ninth" +#define ZMK_BATTERY_CPF_TO_NAME_10 "Tenth" +#define ZMK_BATTERY_CPF_TO_NAME_11 "Eleventh" +#define ZMK_BATTERY_CPF_TO_NAME_12 "Twelfth" +#define ZMK_BATTERY_CPF_TO_NAME_13 "Thirteenth" +#define ZMK_BATTERY_CPF_TO_NAME_14 "Fourteenth" +#define ZMK_BATTERY_CPF_TO_NAME_15 "Fifteenth" +#define ZMK_BATTERY_CPF_TO_NAME_16 "Sixteenth" +#define ZMK_BATTERY_CPF_TO_NAME_17 "Seventeenth" +#define ZMK_BATTERY_CPF_TO_NAME_18 "Eighteenth" +#define ZMK_BATTERY_CPF_TO_NAME_19 "Nineteenth" +#define ZMK_BATTERY_CPF_TO_NAME_20 "Twentieth" +#define ZMK_BATTERY_CPF_TO_NAME_21 "Twenty first" +#define ZMK_BATTERY_CPF_TO_NAME_22 "Twenty second" +#define ZMK_BATTERY_CPF_TO_NAME_23 "Twenty third" +#define ZMK_BATTERY_CPF_TO_NAME_24 "Twenty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_25 "Twenty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_26 "Twenty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_27 "Twenty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_28 "Twenty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_29 "Twenty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_30 "Thirtieth" +#define ZMK_BATTERY_CPF_TO_NAME_31 "Thirty first" +#define ZMK_BATTERY_CPF_TO_NAME_32 "Thirty second" +#define ZMK_BATTERY_CPF_TO_NAME_33 "Thirty third" +#define ZMK_BATTERY_CPF_TO_NAME_34 "Thirty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_35 "Thirty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_36 "Thirty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_37 "Thirty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_38 "Thirty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_39 "Thirty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_40 "Fortieth" +#define ZMK_BATTERY_CPF_TO_NAME_41 "Forty first" +#define ZMK_BATTERY_CPF_TO_NAME_42 "Forty second" +#define ZMK_BATTERY_CPF_TO_NAME_43 "Forty third" +#define ZMK_BATTERY_CPF_TO_NAME_44 "Forty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_45 "Forty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_46 "Forty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_47 "Forty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_48 "Forty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_49 "Forty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_50 "Fiftieth" +#define ZMK_BATTERY_CPF_TO_NAME_51 "Fifty first" +#define ZMK_BATTERY_CPF_TO_NAME_52 "Fifty second" +#define ZMK_BATTERY_CPF_TO_NAME_53 "Fifty third" +#define ZMK_BATTERY_CPF_TO_NAME_54 "Fifty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_55 "Fifty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_56 "Fifty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_57 "Fifty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_58 "Fifty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_59 "Fifty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_60 "Sixtieth" +#define ZMK_BATTERY_CPF_TO_NAME_61 "Sixty first" +#define ZMK_BATTERY_CPF_TO_NAME_62 "Sixty second" +#define ZMK_BATTERY_CPF_TO_NAME_63 "Sixty third" +#define ZMK_BATTERY_CPF_TO_NAME_64 "Sixty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_65 "Sixty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_66 "Sixty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_67 "Sixty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_68 "Sixty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_69 "Sixty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_70 "Seventieth" +#define ZMK_BATTERY_CPF_TO_NAME_71 "Seventy first" +#define ZMK_BATTERY_CPF_TO_NAME_72 "Seventy second" +#define ZMK_BATTERY_CPF_TO_NAME_73 "Seventy third" +#define ZMK_BATTERY_CPF_TO_NAME_74 "Seventy fourth" +#define ZMK_BATTERY_CPF_TO_NAME_75 "Seventy fifth" +#define ZMK_BATTERY_CPF_TO_NAME_76 "Seventy sixth" +#define ZMK_BATTERY_CPF_TO_NAME_77 "Seventy seventh" +#define ZMK_BATTERY_CPF_TO_NAME_78 "Seventy eighth" +#define ZMK_BATTERY_CPF_TO_NAME_79 "Seventy ninth" +#define ZMK_BATTERY_CPF_TO_NAME_80 "Eightieth" +#define ZMK_BATTERY_CPF_TO_NAME_81 "Eighty first" +#define ZMK_BATTERY_CPF_TO_NAME_82 "Eighty second" +#define ZMK_BATTERY_CPF_TO_NAME_83 "Eighty third" +#define ZMK_BATTERY_CPF_TO_NAME_84 "Eighty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_85 "Eighty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_86 "Eighty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_87 "Eighty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_88 "Eighty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_89 "Eighty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_90 "Ninetieth" +#define ZMK_BATTERY_CPF_TO_NAME_91 "Ninety first" +#define ZMK_BATTERY_CPF_TO_NAME_92 "Ninety second" +#define ZMK_BATTERY_CPF_TO_NAME_93 "Ninety third" +#define ZMK_BATTERY_CPF_TO_NAME_94 "Ninety fourth" +#define ZMK_BATTERY_CPF_TO_NAME_95 "Ninety fifth" +#define ZMK_BATTERY_CPF_TO_NAME_96 "Ninety sixth" +#define ZMK_BATTERY_CPF_TO_NAME_97 "Ninety seventh" +#define ZMK_BATTERY_CPF_TO_NAME_98 "Ninety eighth" +#define ZMK_BATTERY_CPF_TO_NAME_99 "Ninety ninth" +#define ZMK_BATTERY_CPF_TO_NAME_100 "One hundredth" +#define ZMK_BATTERY_CPF_TO_NAME_101 "One hundred and first" +#define ZMK_BATTERY_CPF_TO_NAME_102 "One hundred and second" +#define ZMK_BATTERY_CPF_TO_NAME_103 "One hundred and third" +#define ZMK_BATTERY_CPF_TO_NAME_104 "One hundred and fourth" +#define ZMK_BATTERY_CPF_TO_NAME_105 "One hundred and fifth" +#define ZMK_BATTERY_CPF_TO_NAME_106 "One hundred and sixth" +#define ZMK_BATTERY_CPF_TO_NAME_107 "One hundred and seventh" +#define ZMK_BATTERY_CPF_TO_NAME_108 "One hundred and eighth" +#define ZMK_BATTERY_CPF_TO_NAME_109 "One hundred and ninth" +#define ZMK_BATTERY_CPF_TO_NAME_110 "One hundred and tenth" +#define ZMK_BATTERY_CPF_TO_NAME_111 "One hundred and eleventh" +#define ZMK_BATTERY_CPF_TO_NAME_112 "One hundred and twelfth" +#define ZMK_BATTERY_CPF_TO_NAME_113 "One hundred and thirteenth" +#define ZMK_BATTERY_CPF_TO_NAME_114 "One hundred and fourteenth" +#define ZMK_BATTERY_CPF_TO_NAME_115 "One hundred and fifteenth" +#define ZMK_BATTERY_CPF_TO_NAME_116 "One hundred and sixteenth" +#define ZMK_BATTERY_CPF_TO_NAME_117 "One hundred and seventeenth" +#define ZMK_BATTERY_CPF_TO_NAME_118 "One hundred and eighteenth" +#define ZMK_BATTERY_CPF_TO_NAME_119 "One hundred and nineteenth" +#define ZMK_BATTERY_CPF_TO_NAME_120 "One hundred twentieth" +#define ZMK_BATTERY_CPF_TO_NAME_121 "One hundred and twenty first" +#define ZMK_BATTERY_CPF_TO_NAME_122 "One hundred and twenty second" +#define ZMK_BATTERY_CPF_TO_NAME_123 "One hundred and twenty third" +#define ZMK_BATTERY_CPF_TO_NAME_124 "One hundred and twenty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_125 "One hundred and twenty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_126 "One hundred and twenty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_127 "One hundred and twenty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_128 "One hundred and twenty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_129 "One hundred and twenty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_130 "One hundred thirtieth" +#define ZMK_BATTERY_CPF_TO_NAME_131 "One hundred and thirty first" +#define ZMK_BATTERY_CPF_TO_NAME_132 "One hundred and thirty second" +#define ZMK_BATTERY_CPF_TO_NAME_133 "One hundred and thirty third" +#define ZMK_BATTERY_CPF_TO_NAME_134 "One hundred and thirty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_135 "One hundred and thirty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_136 "One hundred and thirty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_137 "One hundred and thirty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_138 "One hundred and thirty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_139 "One hundred and thirty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_140 "One hundred fortieth" +#define ZMK_BATTERY_CPF_TO_NAME_141 "One hundred and forty first" +#define ZMK_BATTERY_CPF_TO_NAME_142 "One hundred and forty second" +#define ZMK_BATTERY_CPF_TO_NAME_143 "One hundred and forty third" +#define ZMK_BATTERY_CPF_TO_NAME_144 "One hundred and forty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_145 "One hundred and forty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_146 "One hundred and forty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_147 "One hundred and forty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_148 "One hundred and forty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_149 "One hundred and forty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_150 "One hundred fiftieth" +#define ZMK_BATTERY_CPF_TO_NAME_151 "One hundred and fifty first" +#define ZMK_BATTERY_CPF_TO_NAME_152 "One hundred and fifty second" +#define ZMK_BATTERY_CPF_TO_NAME_153 "One hundred and fifty third" +#define ZMK_BATTERY_CPF_TO_NAME_154 "One hundred and fifty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_155 "One hundred and fifty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_156 "One hundred and fifty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_157 "One hundred and fifty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_158 "One hundred and fifty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_159 "One hundred and fifty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_160 "One hundred sixtieth" +#define ZMK_BATTERY_CPF_TO_NAME_161 "One hundred and sixty first" +#define ZMK_BATTERY_CPF_TO_NAME_162 "One hundred and sixty second" +#define ZMK_BATTERY_CPF_TO_NAME_163 "One hundred and sixty third" +#define ZMK_BATTERY_CPF_TO_NAME_164 "One hundred and sixty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_165 "One hundred and sixty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_166 "One hundred and sixty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_167 "One hundred and sixty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_168 "One hundred and sixty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_169 "One hundred and sixty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_170 "One hundred seventieth" +#define ZMK_BATTERY_CPF_TO_NAME_171 "One hundred and seventy first" +#define ZMK_BATTERY_CPF_TO_NAME_172 "One hundred and seventy second" +#define ZMK_BATTERY_CPF_TO_NAME_173 "One hundred and seventy third" +#define ZMK_BATTERY_CPF_TO_NAME_174 "One hundred and seventy fourth" +#define ZMK_BATTERY_CPF_TO_NAME_175 "One hundred and seventy fifth" +#define ZMK_BATTERY_CPF_TO_NAME_176 "One hundred and seventy sixth" +#define ZMK_BATTERY_CPF_TO_NAME_177 "One hundred and seventy seventh" +#define ZMK_BATTERY_CPF_TO_NAME_178 "One hundred and seventy eighth" +#define ZMK_BATTERY_CPF_TO_NAME_179 "One hundred and seventy ninth" +#define ZMK_BATTERY_CPF_TO_NAME_180 "One hundred eightieth" +#define ZMK_BATTERY_CPF_TO_NAME_181 "One hundred and eighty first" +#define ZMK_BATTERY_CPF_TO_NAME_182 "One hundred and eighty second" +#define ZMK_BATTERY_CPF_TO_NAME_183 "One hundred and eighty third" +#define ZMK_BATTERY_CPF_TO_NAME_184 "One hundred and eighty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_185 "One hundred and eighty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_186 "One hundred and eighty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_187 "One hundred and eighty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_188 "One hundred and eighty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_189 "One hundred and eighty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_190 "One hundred ninetieth" +#define ZMK_BATTERY_CPF_TO_NAME_191 "One hundred and ninety first" +#define ZMK_BATTERY_CPF_TO_NAME_192 "One hundred and ninety second" +#define ZMK_BATTERY_CPF_TO_NAME_193 "One hundred and ninety third" +#define ZMK_BATTERY_CPF_TO_NAME_194 "One hundred and ninety fourth" +#define ZMK_BATTERY_CPF_TO_NAME_195 "One hundred and ninety fifth" +#define ZMK_BATTERY_CPF_TO_NAME_196 "One hundred and ninety sixth" +#define ZMK_BATTERY_CPF_TO_NAME_197 "One hundred and ninety seventh" +#define ZMK_BATTERY_CPF_TO_NAME_198 "One hundred and ninety eighth" +#define ZMK_BATTERY_CPF_TO_NAME_199 "One hundred and ninety ninth" +#define ZMK_BATTERY_CPF_TO_NAME_200 "Two hundredth" +#define ZMK_BATTERY_CPF_TO_NAME_201 "Two hundred and first" +#define ZMK_BATTERY_CPF_TO_NAME_202 "Two hundred and second" +#define ZMK_BATTERY_CPF_TO_NAME_203 "Two hundred and third" +#define ZMK_BATTERY_CPF_TO_NAME_204 "Two hundred and fourth" +#define ZMK_BATTERY_CPF_TO_NAME_205 "Two hundred and fifth" +#define ZMK_BATTERY_CPF_TO_NAME_206 "Two hundred and sixth" +#define ZMK_BATTERY_CPF_TO_NAME_207 "Two hundred and seventh" +#define ZMK_BATTERY_CPF_TO_NAME_208 "Two hundred and eighth" +#define ZMK_BATTERY_CPF_TO_NAME_209 "Two hundred and ninth" +#define ZMK_BATTERY_CPF_TO_NAME_210 "Two hundred and tenth" +#define ZMK_BATTERY_CPF_TO_NAME_211 "Two hundred and eleventh" +#define ZMK_BATTERY_CPF_TO_NAME_212 "Two hundred and twelfth" +#define ZMK_BATTERY_CPF_TO_NAME_213 "Two hundred and thirteenth" +#define ZMK_BATTERY_CPF_TO_NAME_214 "Two hundred and fourteenth" +#define ZMK_BATTERY_CPF_TO_NAME_215 "Two hundred and fifteenth" +#define ZMK_BATTERY_CPF_TO_NAME_216 "Two hundred and sixteenth" +#define ZMK_BATTERY_CPF_TO_NAME_217 "Two hundred and seventeenth" +#define ZMK_BATTERY_CPF_TO_NAME_218 "Two hundred and eighteenth" +#define ZMK_BATTERY_CPF_TO_NAME_219 "Two hundred and nineteenth" +#define ZMK_BATTERY_CPF_TO_NAME_220 "Two hundred and twentieth" +#define ZMK_BATTERY_CPF_TO_NAME_221 "Two hundred and twenty first" +#define ZMK_BATTERY_CPF_TO_NAME_222 "Two hundred and twenty second" +#define ZMK_BATTERY_CPF_TO_NAME_223 "Two hundred and twenty third" +#define ZMK_BATTERY_CPF_TO_NAME_224 "Two hundred and twenty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_225 "Two hundred and twenty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_226 "Two hundred and twenty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_227 "Two hundred and twenty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_228 "Two hundred and twenty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_229 "Two hundred and twenty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_230 "Two hundred and thirtieth" +#define ZMK_BATTERY_CPF_TO_NAME_231 "Two hundred and thirty first" +#define ZMK_BATTERY_CPF_TO_NAME_232 "Two hundred and thirty second" +#define ZMK_BATTERY_CPF_TO_NAME_233 "Two hundred and thirty third" +#define ZMK_BATTERY_CPF_TO_NAME_234 "Two hundred and thirty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_235 "Two hundred and thirty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_236 "Two hundred and thirty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_237 "Two hundred and thirty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_238 "Two hundred and thirty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_239 "Two hundred and thirty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_240 "Two hundred and fortieth" +#define ZMK_BATTERY_CPF_TO_NAME_241 "Two hundred and forty first" +#define ZMK_BATTERY_CPF_TO_NAME_242 "Two hundred and forty second" +#define ZMK_BATTERY_CPF_TO_NAME_243 "Two hundred and forty third" +#define ZMK_BATTERY_CPF_TO_NAME_244 "Two hundred and forty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_245 "Two hundred and forty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_246 "Two hundred and forty sixth" +#define ZMK_BATTERY_CPF_TO_NAME_247 "Two hundred and forty seventh" +#define ZMK_BATTERY_CPF_TO_NAME_248 "Two hundred and forty eighth" +#define ZMK_BATTERY_CPF_TO_NAME_249 "Two hundred and forty ninth" +#define ZMK_BATTERY_CPF_TO_NAME_250 "Two hundred and fiftieth" +#define ZMK_BATTERY_CPF_TO_NAME_251 "Two hundred and fifty first" +#define ZMK_BATTERY_CPF_TO_NAME_252 "Two hundred and fifty second" +#define ZMK_BATTERY_CPF_TO_NAME_253 "Two hundred and fifty third" +#define ZMK_BATTERY_CPF_TO_NAME_254 "Two hundred and fifty fourth" +#define ZMK_BATTERY_CPF_TO_NAME_255 "Two hundred and fifty fifth" +#define ZMK_BATTERY_CPF_TO_NAME_256 "Front" +#define ZMK_BATTERY_CPF_TO_NAME_257 "Back" +#define ZMK_BATTERY_CPF_TO_NAME_258 "Top" +#define ZMK_BATTERY_CPF_TO_NAME_259 "Bottom" +#define ZMK_BATTERY_CPF_TO_NAME_260 "Upper" +#define ZMK_BATTERY_CPF_TO_NAME_261 "Lower" +#define ZMK_BATTERY_CPF_TO_NAME_262 "Main" +#define ZMK_BATTERY_CPF_TO_NAME_263 "Backup" +#define ZMK_BATTERY_CPF_TO_NAME_264 "Auxiliary" +#define ZMK_BATTERY_CPF_TO_NAME_265 "Supplementary" +#define ZMK_BATTERY_CPF_TO_NAME_266 "Flash" +#define ZMK_BATTERY_CPF_TO_NAME_267 "Inside" +#define ZMK_BATTERY_CPF_TO_NAME_268 "Outside" +#define ZMK_BATTERY_CPF_TO_NAME_269 "Left" +#define ZMK_BATTERY_CPF_TO_NAME_270 "Right" +#define ZMK_BATTERY_CPF_TO_NAME_271 "Internal" +#define ZMK_BATTERY_CPF_TO_NAME_272 "External" + +#define GET_BATTERY_DISPLAY_NAME_BY_CPF(cpf) UTIL_CAT(ZMK_BATTERY_CPF_TO_NAME_, cpf) diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index a4a719697..15c12d7fa 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -255,22 +255,13 @@ static const uint8_t zmk_hid_report_desc[] = { HID_END_COLLECTION, #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if !defined(SUPPRESS_BATTERY_HID_REPORT) && IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if !defined(SUPPRESS_BATTERY_HID_REPORT) && IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) HID_USAGE_PAGE(HID_USAGE_POWER), HID_USAGE(HID_USAGE_POWER_POWER_SUPPLY), HID_COLLECTION(HID_COLLECTION_APPLICATION), HID_USAGE_PAGE(HID_USAGE_BATTERY_SYSTEM), HID_REPORT_ID(ZMK_HID_REPORT_ID_BATTERY), - HID_USAGE(HID_USAGE_BATTERY_SYSTEM_CHARGING), - HID_LOGICAL_MIN8(0), - HID_LOGICAL_MAX8(1), - HID_PHYSICAL_MIN8(0), - HID_PHYSICAL_MAX8(1), - HID_REPORT_SIZE(0x08), - HID_REPORT_COUNT(0x01), - HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS), - HID_USAGE(HID_USAGE_BATTERY_SYSTEM_ABSOLUTE_STATE_OF_CHARGE), HID_LOGICAL_MIN8(0), HID_LOGICAL_MAX8(100), @@ -280,6 +271,15 @@ static const uint8_t zmk_hid_report_desc[] = { HID_REPORT_COUNT(0x01), HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS), + HID_USAGE(HID_USAGE_BATTERY_SYSTEM_CHARGING), + HID_LOGICAL_MIN8(0), + HID_LOGICAL_MAX8(1), + HID_PHYSICAL_MIN8(0), + HID_PHYSICAL_MAX8(1), + HID_REPORT_SIZE(0x08), + HID_REPORT_COUNT(0x01), + HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS), + HID_END_COLLECTION, #endif }; @@ -370,15 +370,15 @@ struct zmk_hid_mouse_resolution_feature_report { #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) struct zmk_hid_battery_report { uint8_t report_id; - uint8_t charging; uint8_t battery_level; + uint8_t charging; } __packed; -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) zmk_mod_flags_t zmk_hid_get_explicit_mods(void); int zmk_hid_register_mod(zmk_mod_t modifier); @@ -419,9 +419,9 @@ void zmk_hid_mouse_clear(void); #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) void zmk_hid_battery_set(uint8_t battery_level); -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report(void); struct zmk_hid_consumer_report *zmk_hid_get_consumer_report(void); @@ -434,6 +434,6 @@ zmk_hid_boot_report_t *zmk_hid_get_boot_report(); struct zmk_hid_mouse_report *zmk_hid_get_mouse_report(); #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) struct zmk_hid_battery_report *zmk_hid_get_battery_report(); -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) diff --git a/app/include/zmk/usb_hid.h b/app/include/zmk/usb_hid.h index 125e82015..639e5abb6 100644 --- a/app/include/zmk/usb_hid.h +++ b/app/include/zmk/usb_hid.h @@ -15,8 +15,8 @@ int zmk_usb_hid_send_consumer_report(void); int zmk_usb_hid_send_mouse_report(void); #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) int zmk_usb_hid_send_battery_report(void); -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) void zmk_usb_hid_set_protocol(uint8_t protocol); diff --git a/app/snippets/battery-reporting-test/battery-reporting-test.overlay b/app/snippets/battery-reporting-test/battery-reporting-test.overlay index bbb539778..876cb15dc 100644 --- a/app/snippets/battery-reporting-test/battery-reporting-test.overlay +++ b/app/snippets/battery-reporting-test/battery-reporting-test.overlay @@ -25,12 +25,12 @@ // display-name = "Left"; // cpf = <50>; }; - // right{ - // display-name = "Right"; - // hidden; - // }; - // pad{ - // display-name = "Extra Pad"; - // }; + right{ + display-name = "Right"; + hidden; + }; + pad{ + display-name = "Extra Pad"; + }; }; }; diff --git a/app/src/battery.c b/app/src/battery.c index b96c77ade..4c9a5c608 100644 --- a/app/src/battery.c +++ b/app/src/battery.c @@ -14,6 +14,11 @@ #include #endif +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) +#include +#include +#endif + #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -25,11 +30,6 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) -#include -#include -#endif - static uint8_t last_state_of_charge = 0; uint8_t zmk_battery_state_of_charge(void) { return last_state_of_charge; } @@ -102,7 +102,7 @@ static int zmk_battery_update(const struct device *battery) { if (last_state_of_charge != state_of_charge.val1) { last_state_of_charge = state_of_charge.val1; -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) && !IS_ENABLED(CONFIG_ZMK_SPLIT) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) zmk_hid_battery_set(last_state_of_charge); zmk_usb_hid_send_battery_report(); #endif diff --git a/app/src/battery_reporting.c b/app/src/battery_reporting.c index b84a5804c..5f0048055 100644 --- a/app/src/battery_reporting.c +++ b/app/src/battery_reporting.c @@ -12,7 +12,7 @@ #include #include -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) #include #endif @@ -25,29 +25,32 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include #include +#include -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) #include #include #endif +// TODO before merging: is this needed? or just use a bool array or even bitfield? +// Only `hidden` is used right now, is this information useful elsewhere? For screens? struct battery_part { char *display_name; uint16_t cpf; bool hidden; }; +#define BAS_LOWEST_CHARGE_INDEX UINT8_MAX #define BAS_CENTRAL_INDEX 0 -#define BAS_PERIPH_OFFSET 1 -#define BAS_LEN UTIL_INC(CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS) +#define BAS_PERIPHERAL_INDEX_OFFSET 1 + +#define KEYBOARD_PARTS_NUM UTIL_INC(CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS) #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) - static uint8_t lowest_state_of_charge = 0; - #endif -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) static void blvl_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value) { ARG_UNUSED(attr); @@ -61,7 +64,7 @@ static ssize_t read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr, uint8_t level = 0; #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) - if (index == UINT8_MAX) { + if (index == BAS_LOWEST_CHARGE_INDEX) { return bt_gatt_attr_read(conn, attr, buf, len, offset, &lowest_state_of_charge, sizeof(uint8_t)); } @@ -71,64 +74,72 @@ static ssize_t read_blvl(struct bt_conn *conn, const struct bt_gatt_attr *attr, level = zmk_battery_state_of_charge(); } else { #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) - int rc = zmk_split_central_get_peripheral_battery_level(index - BAS_PERIPH_OFFSET, &level); + int rc = zmk_split_central_get_peripheral_battery_level(index - BAS_PERIPHERAL_INDEX_OFFSET, + &level); if (rc == -EINVAL) { LOG_ERR("Invalid peripheral index requested for battery level read: %d", index); return -EINVAL; } #else - level = 0; LOG_WRN("Battery level read requested for peripheral %d, but split fetching is disabled", index); - return 0; + return -EINVAL; #endif } - return bt_gatt_attr_read(conn, attr, buf, len, offset, &level, sizeof(uint8_t)); + return bt_gatt_attr_read(conn, attr, buf, len, offset, &level, sizeof(level)); } -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) - -#define CPF_DESC_BASE \ - COND_CODE_1(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE, (0x0001), (0x0000)) - -#define PERIPH_CUD(x) PERIPH_CUD_(x) -#define PERIPH_CUD_(x) "Peripheral " #x +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) #define ZMK_BT_GATT_SERVICE_DEFINE(_name, ...) \ const struct bt_gatt_attr UTIL_CAT(attr_, _name)[] = {__VA_ARGS__}; \ const STRUCT_SECTION_ITERABLE(bt_gatt_service_static, _name) = \ BT_GATT_SERVICE(UTIL_CAT(attr_, _name)) -#if DT_HAS_CHOSEN(DT_DRV_COMPAT) +// Get default CPF description as a literal number for a keyboard part. +// For the central (part 0), default is "main" (0x0106, 262) unless reporting lowest charge, in +// which case use "first" (1). For peripherals, always start from "second" (2) onwards. +#define BAT_REPORT_GET_DEFAULT_CPF_DESC(idx) \ + COND_CODE_0( \ + idx, (COND_CODE_1(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE, (1), (262))), \ + (UTIL_INC(idx))) -#define ONE(...) 1 -#define BATTERY_INFO_LEN (DT_FOREACH_CHILD_SEP(DT_CHOSEN(DT_DRV_COMPAT), ONE, (+))) -BUILD_ASSERT(BAS_LEN == BATTERY_INFO_LEN, +// Get default display name for a keyboard part. +#define BAT_REPORT_GET_DEFAULT_DISPLAY_NAME(idx) \ + GET_BATTERY_DISPLAY_NAME_BY_CPF(BAT_REPORT_GET_DEFAULT_CPF_DESC(idx)) + +#if DT_HAS_CHOSEN(DT_DRV_COMPAT) +// Use info from devicetree chosen node + +BUILD_ASSERT(KEYBOARD_PARTS_NUM == DT_CHILD_NUM(DT_CHOSEN(DT_DRV_COMPAT)), "Number of battery info set in /chosen/zmk,battery-reporting must match the number of " "split parts in this keyboard."); -#define BAS_NAME(node_id) UTIL_CAT(bas, DT_NODE_CHILD_IDX(node_id)) +// Get CPF description as a literal number for a keyboard part from devicetree. +// Use configured cpf property if set, otherwise use default based on index. +#define BAT_REPORT_GET_DT_CPF_DESC(node_id) \ + DT_PROP_OR(node_id, cpf, BAT_REPORT_GET_DEFAULT_CPF_DESC(DT_NODE_CHILD_IDX(node_id))) -#define GET_BATT_DISPLAY_NAME(node_id) \ +// Get display name for a keyboard part from devicetree. +// Use configured display-name property if set, otherwise use name based on CPF. +#define BAT_REPORT_GET_DT_DISPLAY_NAME(node_id) \ DT_PROP_OR(node_id, display_name, \ - (DT_NODE_CHILD_IDX(node_id) ? PERIPH_CUD(DT_NODE_CHILD_IDX(node_id)) : "Central")) + GET_BATTERY_DISPLAY_NAME_BY_CPF(BAT_REPORT_GET_DT_CPF_DESC(node_id))) -#define GET_BATT_CPF_DESC(node_id) \ - DT_PROP_OR(node_id, cpf, \ - (DT_NODE_CHILD_IDX(node_id) \ - ? (CPF_DESC_BASE + DT_NODE_CHILD_IDX(node_id)) /* "first" + index */ \ - : (COND_CODE_1(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE, \ - (0x0001), (0x0106))))) /* "first", or "main" */ +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +// Identifier for GATT service instance for a keyboard part. +// Note: This will only sort correctly for up to 10 keyboard parts (single digit index) +#define BAS_GATT_SERVICE_IDENTIFIER(node_id) UTIL_CAT(bas, DT_NODE_CHILD_IDX(node_id)) -#define DEFINE_BAS_INSTANCE(node_id) \ +// Define a BAS instance for each non-hidden part. +#define DEFINE_BAS_INSTANCE_DT(node_id) \ COND_CODE_0( \ DT_PROP(node_id, hidden), \ (ZMK_BT_GATT_SERVICE_DEFINE( \ - BAS_NAME(node_id), BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS), \ + BAS_GATT_SERVICE_IDENTIFIER(node_id), BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS), \ BT_GATT_CHARACTERISTIC(BT_UUID_BAS_BATTERY_LEVEL, \ BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, BT_GATT_PERM_READ, \ read_blvl, NULL, ((uint8_t[]){DT_NODE_CHILD_IDX(node_id)})), \ @@ -138,111 +149,111 @@ BUILD_ASSERT(BAS_LEN == BATTERY_INFO_LEN, .exponent = 0x0, /* */ \ .unit = 0x27AD, /* Percentage */ \ .name_space = 0x01, /* Bluetooth SIG */ \ - .description = GET_BATT_CPF_DESC(node_id), \ + .description = BAT_REPORT_GET_DT_CPF_DESC(node_id), \ }})), \ - BT_GATT_CUD(GET_BATT_DISPLAY_NAME(node_id), BT_GATT_PERM_READ))), \ + BT_GATT_CUD(BAT_REPORT_GET_DT_DISPLAY_NAME(node_id), BT_GATT_PERM_READ))), \ ()); -DT_FOREACH_CHILD(DT_CHOSEN(DT_DRV_COMPAT), DEFINE_BAS_INSTANCE) +DT_FOREACH_CHILD(DT_CHOSEN(DT_DRV_COMPAT), DEFINE_BAS_INSTANCE_DT) -#define BAS_PTR(node_id) COND_CODE_0(DT_PROP(node_id, hidden), (&BAS_NAME(node_id)), (NULL)) +#define BAS_PTR_DT(node_id) \ + COND_CODE_0(DT_PROP(node_id, hidden), (&BAS_GATT_SERVICE_IDENTIFIER(node_id)), (NULL)) static const struct bt_gatt_service_static *bas[] = { - DT_FOREACH_CHILD_SEP(DT_CHOSEN(DT_DRV_COMPAT), BAS_PTR, (, ))}; + DT_FOREACH_CHILD_SEP(DT_CHOSEN(DT_DRV_COMPAT), BAS_PTR_DT, (, ))}; -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) -#define BATTERY_PART(node_id) \ +#define BATTERY_PART_DT(node_id) \ { \ - .display_name = GET_BATT_DISPLAY_NAME(node_id), \ - .cpf = GET_BATT_CPF_DESC(node_id), \ + .display_name = BAT_REPORT_GET_DT_DISPLAY_NAME(node_id), \ + .cpf = BAT_REPORT_GET_DT_CPF_DESC(node_id), \ .hidden = DT_PROP(node_id, hidden), \ } static const struct battery_part battery_parts[] = { - DT_FOREACH_CHILD_SEP(DT_CHOSEN(DT_DRV_COMPAT), BATTERY_PART, (, ))}; + DT_FOREACH_CHILD_SEP(DT_CHOSEN(DT_DRV_COMPAT), BATTERY_PART_DT, (, ))}; #endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) #else // if DT_HAS_CHOSEN(DT_DRV_COMPAT) +// No chosen devicetree node, use defaults -#define GET_BATT_DISPLAY_NAME(INDEX) (INDEX ? PERIPH_CUD(INDEX) : "Central") +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) -#define GET_BATT_CPF_DESC(INDEX) \ - (INDEX ? (CPF_DESC_BASE + INDEX) /* "first" + index */ \ - : (COND_CODE_1(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE, (0x0001), \ - (0x0106)))) /* "first", or "main" */ +#define BAS_GATT_SERVICE_IDENTIFIER(idx) UTIL_CAT(bas, idx) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) - -#define DEFINE_BAS_SERVICE(INDEX, _) \ +#define DEFINE_BAS_SERVICE_IDX(idx, _) \ ZMK_BT_GATT_SERVICE_DEFINE( \ - bas##INDEX, BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS), \ + BAS_GATT_SERVICE_IDENTIFIER(idx), BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS), \ BT_GATT_CHARACTERISTIC(BT_UUID_BAS_BATTERY_LEVEL, BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \ - BT_GATT_PERM_READ, read_blvl, NULL, ((uint8_t[]){INDEX})), \ + BT_GATT_PERM_READ, read_blvl, NULL, ((uint8_t[]){idx})), \ BT_GATT_CCC(blvl_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), \ BT_GATT_CPF(((struct bt_gatt_cpf[]){{ \ .format = 0x04, /* uint8 */ \ .exponent = 0x0, \ .unit = 0x27AD, /* Percentage */ \ .name_space = 0x01, /* Bluetooth SIG */ \ - .description = GET_BATT_CPF_DESC(INDEX), \ + .description = BAT_REPORT_GET_DEFAULT_CPF_DESC(idx), \ }})), \ - BT_GATT_CUD(GET_BATT_DISPLAY_NAME(INDEX), BT_GATT_PERM_READ)); + BT_GATT_CUD(BAT_REPORT_GET_DEFAULT_DISPLAY_NAME(idx), BT_GATT_PERM_READ)); -LISTIFY(BAS_LEN, DEFINE_BAS_SERVICE, ()) +LISTIFY(KEYBOARD_PARTS_NUM, DEFINE_BAS_SERVICE_IDX, ()) -#define BAS_PTR(INDEX, _) &bas##INDEX +#define BAS_PTR_IDX(idx, _) &BAS_GATT_SERVICE_IDENTIFIER(idx) -static const struct bt_gatt_service_static *bas[] = {LISTIFY(BAS_LEN, BAS_PTR, (, ))}; +static const struct bt_gatt_service_static *bas[] = { + LISTIFY(KEYBOARD_PARTS_NUM, BAS_PTR_IDX, (, ))}; -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) -#define BATTERY_PART(INDEX, _) \ +#define BATTERY_PART_IDX(idx, _) \ { \ - .display_name = GET_BATT_DISPLAY_NAME(INDEX), \ - .cpf = GET_BATT_CPF_DESC(INDEX), \ + .display_name = BAT_REPORT_GET_DEFAULT_DISPLAY_NAME(idx), \ + .cpf = BAT_REPORT_GET_DEFAULT_CPF_DESC(idx), \ .hidden = false, \ } -static const struct battery_part battery_parts[] = {LISTIFY(BAS_LEN, BATTERY_PART, (, ))}; +static const struct battery_part battery_parts[] = { + LISTIFY(KEYBOARD_PARTS_NUM, BATTERY_PART_IDX, (, ))}; #endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) -#endif // else DT_HAS_CHOSEN(DT_DRV_COMPAT) +#endif // if DT_HAS_CHOSEN(DT_DRV_COMPAT) .. else .. #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) - -// note: the order of the services are based on their name. -ZMK_BT_GATT_SERVICE_DEFINE( - aggr_bas_lowest, BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS), - BT_GATT_CHARACTERISTIC(BT_UUID_BAS_BATTERY_LEVEL, BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, - BT_GATT_PERM_READ, read_blvl, NULL, ((uint8_t[]){UINT8_MAX})), - BT_GATT_CCC(blvl_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), - BT_GATT_CPF(((struct bt_gatt_cpf[]){{ - .format = 0x04, /* uint8 */ - .exponent = 0x0, - .unit = 0x27AD, /* Percentage */ - .name_space = 0x01, /* Bluetooth SIG */ - .description = 0x0106, /* "main" */ - }})), - BT_GATT_CUD("Lowest Charge", BT_GATT_PERM_READ)); - -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) +// Hote: the order of services are based on their name, so we prefix it with "a" to ensure it +// appears first. +ZMK_BT_GATT_SERVICE_DEFINE(abas_lowest, BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS), + BT_GATT_CHARACTERISTIC(BT_UUID_BAS_BATTERY_LEVEL, + BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, + BT_GATT_PERM_READ, read_blvl, NULL, + ((uint8_t[]){BAS_LOWEST_CHARGE_INDEX})), + BT_GATT_CCC(blvl_ccc_cfg_changed, + BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), + BT_GATT_CPF(((struct bt_gatt_cpf[]){{ + .format = 0x04, /* uint8 */ + .exponent = 0x0, + .unit = 0x27AD, /* Percentage */ + .name_space = 0x01, /* Bluetooth SIG */ + .description = 0x0106, /* "main" */ + }})), + BT_GATT_CUD("Lowest Charge", BT_GATT_PERM_READ)); +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) static void zmk_update_lowest_charge_work(struct k_work *work) { ARG_UNUSED(work); uint8_t new_lowest_level = UINT8_MAX; - if (!battery_parts[0].hidden) { + if (!battery_parts[BAS_CENTRAL_INDEX].hidden) { new_lowest_level = zmk_battery_state_of_charge(); } for (size_t i = 0; i < CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS; i++) { - if (battery_parts[i + BAS_PERIPH_OFFSET].hidden) { + if (battery_parts[i + BAS_PERIPHERAL_INDEX_OFFSET].hidden) { continue; } uint8_t level = 0; @@ -265,17 +276,15 @@ static void zmk_update_lowest_charge_work(struct k_work *work) { LOG_DBG("Lowest state of charge: %d", lowest_state_of_charge); -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) - - int rc = bt_gatt_notify(NULL, &aggr_bas_lowest.attrs[2], &lowest_state_of_charge, +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) + int rc = bt_gatt_notify(NULL, &abas_lowest.attrs[2], &lowest_state_of_charge, sizeof(lowest_state_of_charge)); if (rc < 0 && rc != -ENOTCONN) { LOG_WRN("Notify failed for lowest battery level: %d", rc); } +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) - -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) zmk_hid_battery_set(lowest_state_of_charge); zmk_usb_hid_send_battery_report(); #endif @@ -304,8 +313,8 @@ int peripheral_batt_report_lvl_listener(const zmk_event_t *eh) { LOG_DBG("Peripheral %d battery level: %u", ev->source, ev->state_of_charge); -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) - const struct bt_gatt_service_static *svc = bas[ev->source + BAS_PERIPH_OFFSET]; +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) + const struct bt_gatt_service_static *svc = bas[ev->source + BAS_PERIPHERAL_INDEX_OFFSET]; if (svc) { int rc = bt_gatt_notify(NULL, &svc->attrs[2], &ev->state_of_charge, sizeof(uint8_t)); @@ -315,10 +324,17 @@ int peripheral_batt_report_lvl_listener(const zmk_event_t *eh) { } else { LOG_DBG("No service found for peripheral %d", ev->source); } -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) - submit_lowest_charge_work(); + if (ev->state_of_charge != 0) { + // Ugly workaround to not wake up the host on keyboard part disconnect, so users don't need + // to turn off their keyboard parts before sleeping/hibernating their computer. We ideally + // should differentiate between disconnect and 0% charge. This shouldn't be an issue for + // most users, if a part is dead due to low battery, it likely was reporting <5% before + // disconnecting so user is already aware. + submit_lowest_charge_work(); + } #endif return ZMK_EV_EVENT_BUBBLE; @@ -333,7 +349,7 @@ int central_batt_state_changed_listener(const zmk_event_t *eh) { return ZMK_EV_EVENT_BUBBLE; } -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) const struct bt_gatt_service_static *svc = bas[BAS_CENTRAL_INDEX]; if (svc) { @@ -344,16 +360,18 @@ int central_batt_state_changed_listener(const zmk_event_t *eh) { } else { LOG_DBG("No service found for central battery"); } -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BAS) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_BLE) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) && \ +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) && \ !IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) zmk_hid_battery_set(ev->state_of_charge); zmk_usb_hid_send_battery_report(); #endif #if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_REPORT_LOWEST_CHARGE) - submit_lowest_charge_work(); + if (battery_parts[BAS_CENTRAL_INDEX].hidden == false) { + submit_lowest_charge_work(); + } #endif return ZMK_EV_EVENT_BUBBLE; diff --git a/app/src/hid.c b/app/src/hid.c index 28cf72ff1..9aac6fa4a 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -33,12 +33,12 @@ static struct zmk_hid_mouse_report mouse_report = { #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) static struct zmk_hid_battery_report battery_report = { - .report_id = ZMK_HID_REPORT_ID_BATTERY, .charging = 0, .battery_level = 0}; + .report_id = ZMK_HID_REPORT_ID_BATTERY, .battery_level = 0, .charging = 0}; -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) // Keep track of how often a modifier was pressed. // Only release the modifier if the count is 0. @@ -475,7 +475,7 @@ void zmk_hid_mouse_clear(void) { #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) void zmk_hid_battery_set(uint8_t battery_level) { if (battery_level > 100) { @@ -484,7 +484,7 @@ void zmk_hid_battery_set(uint8_t battery_level) { battery_report.battery_level = battery_level; } -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report(void) { return &keyboard_report; } @@ -496,7 +496,6 @@ struct zmk_hid_mouse_report *zmk_hid_get_mouse_report(void) { return &mouse_repo #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) -// zmk_hid_get_battery_report +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) struct zmk_hid_battery_report *zmk_hid_get_battery_report(void) { return &battery_report; } -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) diff --git a/app/src/split/bluetooth/Kconfig b/app/src/split/bluetooth/Kconfig index aec3ed867..99acdc823 100644 --- a/app/src/split/bluetooth/Kconfig +++ b/app/src/split/bluetooth/Kconfig @@ -31,7 +31,8 @@ config ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS int "Number of peripherals that will connect to the central." menuconfig ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING - bool "Deprecated: Fetch Peripheral Battery Level Info" + bool "Fetch Peripheral Battery Level Info" + select ZMK_BATTERY_REPORTING_SPLIT_FETCHING help Adds internal support for fetching the battery levels from peripherals and generating events in the ZMK eventing system. diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index 68ad0feca..d9a31e40a 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -52,10 +52,10 @@ struct peripheral_slot { struct bt_gatt_subscribe_params sensor_subscribe_params; struct bt_gatt_discover_params sub_discover_params; uint16_t run_behavior_handle; -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) +#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) struct bt_gatt_subscribe_params batt_lvl_subscribe_params; struct bt_gatt_read_params batt_lvl_read_params; -#endif /* IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) */ +#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) */ #if IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) uint16_t update_hid_indicators; #endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) @@ -391,7 +391,7 @@ static uint8_t split_central_notify_func(struct bt_conn *conn, return BT_GATT_ITER_CONTINUE; } -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) +#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) static uint8_t split_central_battery_level_notify_func(struct bt_conn *conn, struct bt_gatt_subscribe_params *params, @@ -475,7 +475,7 @@ static uint8_t split_central_battery_level_read_func(struct bt_conn *conn, uint8 return BT_GATT_ITER_CONTINUE; } -#endif /* IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) */ +#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) */ static int split_central_subscribe(struct bt_conn *conn, struct bt_gatt_subscribe_params *params) { atomic_set(params->flags, BT_GATT_SUBSCRIBE_FLAG_NO_RESUB); @@ -620,7 +620,7 @@ static uint8_t split_central_chrc_discovery_func(struct bt_conn *conn, LOG_DBG("Found update HID indicators handle"); slot->update_hid_indicators = bt_gatt_attr_value_handle(attr); #endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) +#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) } else if (!bt_uuid_cmp(((struct bt_gatt_chrc *)attr->user_data)->uuid, BT_UUID_BAS_BATTERY_LEVEL)) { LOG_DBG("Found battery level characteristics"); @@ -636,7 +636,7 @@ static uint8_t split_central_chrc_discovery_func(struct bt_conn *conn, slot->batt_lvl_read_params.single.handle = bt_gatt_attr_value_handle(attr); slot->batt_lvl_read_params.single.offset = 0; bt_gatt_read(conn, &slot->batt_lvl_read_params); -#endif /* IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) */ +#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) */ } break; } @@ -695,9 +695,9 @@ static uint8_t split_central_chrc_discovery_func(struct bt_conn *conn, #if IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) subscribed = subscribed && slot->update_hid_indicators; #endif // IS_ENABLED(CONFIG_ZMK_SPLIT_PERIPHERAL_HID_INDICATORS) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) +#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) subscribed = subscribed && slot->batt_lvl_subscribe_params.value_handle; -#endif /* IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) */ +#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) */ #if IS_ENABLED(CONFIG_ZMK_INPUT_SPLIT) for (size_t i = 0; i < ARRAY_SIZE(peripheral_input_slots); i++) { if (input_slot_is_open(i) || input_slot_is_pending(i)) { @@ -956,7 +956,9 @@ static void split_central_disconnected(struct bt_conn *conn, uint8_t reason) { LOG_DBG("Disconnected: %s (reason %d)", addr, reason); -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_SPLIT_FETCHING) +#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING) + // TODO: Distinguish disconnection from 0% battery level notification and skip HID notification + // on disconnection to avoid waking up the host. struct peripheral_event_wrapper ev = { .source = peripheral_slot_index_for_conn(conn), .event = {.type = ZMK_SPLIT_TRANSPORT_PERIPHERAL_EVENT_TYPE_BATTERY_EVENT, diff --git a/app/src/usb_hid.c b/app/src/usb_hid.c index 8e255e61c..64bbfaefd 100644 --- a/app/src/usb_hid.c +++ b/app/src/usb_hid.c @@ -100,14 +100,14 @@ static int get_report_cb(const struct device *dev, struct usb_setup_packet *setu *len = sizeof(*report); break; } -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) case ZMK_HID_REPORT_ID_BATTERY: { struct zmk_hid_battery_report *report = zmk_hid_get_battery_report(); *data = (uint8_t *)report; *len = sizeof(*report); break; } -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) default: LOG_ERR("Invalid report ID %d requested", setup->wValue & HID_GET_REPORT_ID_MASK); return -EINVAL; @@ -243,7 +243,7 @@ int zmk_usb_hid_send_mouse_report() { } #endif // IS_ENABLED(CONFIG_ZMK_POINTING) -#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#if IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) int zmk_usb_hid_send_battery_report() { #if IS_ENABLED(CONFIG_ZMK_USB_BOOT) if (hid_protocol == HID_PROTOCOL_BOOT) { @@ -254,7 +254,7 @@ int zmk_usb_hid_send_battery_report() { struct zmk_hid_battery_report *report = zmk_hid_get_battery_report(); return zmk_usb_hid_send_report((uint8_t *)report, sizeof(*report)); } -#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_HID) +#endif // IS_ENABLED(CONFIG_ZMK_BATTERY_REPORTING_USB) static int zmk_usb_hid_init(void) { hid_dev = device_get_binding("HID_0");