mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-04-23 15:41:28 +00:00
Refactor based on recent discussion
This commit is contained in:
parent
6b0bdc30de
commit
956bd3b7ca
@ -21,9 +21,9 @@ ifneq ("$(wildcard $(KEYMAP_PATH)/xap.hjson)","")
|
|||||||
XAP_FILES += $(KEYMAP_PATH)/xap.hjson
|
XAP_FILES += $(KEYMAP_PATH)/xap.hjson
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(KEYMAP_OUTPUT)/src/info_json_gz.h: $(INFO_JSON_FILES)
|
$(KEYMAP_OUTPUT)/src/config_blob_gz.h: $(INFO_JSON_FILES)
|
||||||
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
@$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD)
|
||||||
$(eval CMD=$(QMK_BIN) xap-generate-info-h -o "$(KEYMAP_OUTPUT)/src/info_json_gz.h" -kb $(KEYBOARD) -km $(KEYMAP))
|
$(eval CMD=$(QMK_BIN) xap-generate-qmk-blob-h -o "$(KEYMAP_OUTPUT)/src/config_blob_gz.h" -kb $(KEYBOARD) -km $(KEYMAP))
|
||||||
@$(BUILD_CMD)
|
@$(BUILD_CMD)
|
||||||
|
|
||||||
$(KEYMAP_OUTPUT)/src/xap_generated.inl: $(XAP_FILES)
|
$(KEYMAP_OUTPUT)/src/xap_generated.inl: $(XAP_FILES)
|
||||||
@ -36,6 +36,6 @@ $(KEYMAP_OUTPUT)/src/xap_generated.h: $(XAP_FILES)
|
|||||||
$(eval CMD=$(QMK_BIN) xap-generate-qmk-h -o "$(KEYMAP_OUTPUT)/src/xap_generated.h" -kb $(KEYBOARD) -km $(KEYMAP))
|
$(eval CMD=$(QMK_BIN) xap-generate-qmk-h -o "$(KEYMAP_OUTPUT)/src/xap_generated.h" -kb $(KEYBOARD) -km $(KEYMAP))
|
||||||
@$(BUILD_CMD)
|
@$(BUILD_CMD)
|
||||||
|
|
||||||
generated-files: $(KEYMAP_OUTPUT)/src/info_json_gz.h $(KEYMAP_OUTPUT)/src/xap_generated.inl $(KEYMAP_OUTPUT)/src/xap_generated.h
|
generated-files: $(KEYMAP_OUTPUT)/src/config_blob_gz.h $(KEYMAP_OUTPUT)/src/xap_generated.inl $(KEYMAP_OUTPUT)/src/xap_generated.h
|
||||||
|
|
||||||
VPATH += $(KEYMAP_OUTPUT)/src
|
VPATH += $(KEYMAP_OUTPUT)/src
|
||||||
|
@ -296,21 +296,21 @@
|
|||||||
}
|
}
|
||||||
0x05: {
|
0x05: {
|
||||||
type: command
|
type: command
|
||||||
name: info.json length
|
name: Config Blob Length
|
||||||
define: INFO_LEN_QUERY
|
define: CONFIG_BLOB_LEN
|
||||||
description: Retrieves the length of info.json
|
description: Retrieves the length of the configuration data bundled within the firmware
|
||||||
return_type: u32
|
return_type: u32
|
||||||
return_constant: INFO_JSON_GZ_LEN
|
return_constant: CONFIG_BLOB_GZ_LEN
|
||||||
}
|
}
|
||||||
0x06: {
|
0x06: {
|
||||||
type: command
|
type: command
|
||||||
name: info.json
|
name: Config Blob Chunk
|
||||||
define: INFO_QUERY
|
define: CONFIG_BLOB_CHUNK
|
||||||
description: Retrieves a chunk of info.json
|
description: Retrieves a chunk of the configuration data bundled within the firmware
|
||||||
request_type: u16
|
request_type: u16
|
||||||
request_purpose: offset
|
request_purpose: offset
|
||||||
return_type: u8[32]
|
return_type: u8[32]
|
||||||
return_execute: get_info_json_chunk
|
return_execute: get_config_blob_chunk
|
||||||
}
|
}
|
||||||
0x07: {
|
0x07: {
|
||||||
type: command
|
type: command
|
||||||
@ -332,7 +332,7 @@
|
|||||||
}
|
}
|
||||||
0x08: {
|
0x08: {
|
||||||
type: command
|
type: command
|
||||||
name: info.json
|
name: Unique Identifier
|
||||||
define: HARDWARE_ID
|
define: HARDWARE_ID
|
||||||
description: Retrieves a unique identifier for the board.
|
description: Retrieves a unique identifier for the board.
|
||||||
return_type: u32[4]
|
return_type: u32[4]
|
||||||
|
@ -4,33 +4,24 @@
|
|||||||
routes: {
|
routes: {
|
||||||
0x04: {
|
0x04: {
|
||||||
type: router
|
type: router
|
||||||
name: Dynamic Keymap
|
name: Keymap
|
||||||
define: DYNAMIC_KEYMAP
|
define: KEYMAP
|
||||||
description:
|
description:
|
||||||
'''
|
'''
|
||||||
This subsystem allows for live modifications of the keymap, allowing keys to be reassigned without rebuilding the firmware.
|
This subsystem allows for query of currently configured keycodes.
|
||||||
'''
|
'''
|
||||||
enable_if_preprocessor: defined(DYNAMIC_KEYMAP_ENABLE)
|
|
||||||
routes: {
|
routes: {
|
||||||
0x00: {
|
0x01: {
|
||||||
type: command
|
type: command
|
||||||
name: Capabilities Query
|
name: Capabilities Query
|
||||||
define: CAPABILITIES_QUERY
|
define: CAPABILITIES_QUERY
|
||||||
description:
|
description:
|
||||||
'''
|
'''
|
||||||
Dynamic Keymap subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.
|
Keymap subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.
|
||||||
'''
|
'''
|
||||||
return_type: u32
|
return_type: u32
|
||||||
return_purpose: capabilities
|
return_purpose: capabilities
|
||||||
return_constant: XAP_ROUTE_DYNAMIC_KEYMAP_CAPABILITIES
|
return_constant: XAP_ROUTE_KEYMAP_CAPABILITIES
|
||||||
}
|
|
||||||
0x01: {
|
|
||||||
type: command
|
|
||||||
name: Get Layer Count
|
|
||||||
define: GET_LAYER_COUNT
|
|
||||||
description: Query maximum number of layers that can be addressed within the keymap.
|
|
||||||
return_type: u8
|
|
||||||
return_constant: DYNAMIC_KEYMAP_LAYER_COUNT
|
|
||||||
}
|
}
|
||||||
0x02: {
|
0x02: {
|
||||||
type: command
|
type: command
|
||||||
@ -54,9 +45,59 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
return_type: u16
|
return_type: u16
|
||||||
return_execute: dynamic_keymap_get_keycode
|
return_execute: get_keymap_keycode
|
||||||
}
|
}
|
||||||
0x03: {
|
0x03: {
|
||||||
|
type: command
|
||||||
|
name: Get Encoder Keycode
|
||||||
|
define: GET_ENCODER_KEYCODE
|
||||||
|
description: Query the Keycode at the requested location.
|
||||||
|
enable_if_preprocessor: defined(ENCODER_MAP_ENABLE)
|
||||||
|
request_type: struct
|
||||||
|
request_struct_length: 3
|
||||||
|
request_struct_members: [
|
||||||
|
{
|
||||||
|
type: u8
|
||||||
|
name: Layer
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: u8
|
||||||
|
name: Encoder
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: u8
|
||||||
|
name: Clockwise
|
||||||
|
}
|
||||||
|
]
|
||||||
|
return_type: u16
|
||||||
|
return_execute: get_encoder_keycode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
0x05: {
|
||||||
|
type: router
|
||||||
|
name: Remapping
|
||||||
|
define: REMAPPING
|
||||||
|
description:
|
||||||
|
'''
|
||||||
|
This subsystem allows for live reassignment of keycodes without rebuilding the firmware.
|
||||||
|
'''
|
||||||
|
enable_if_preprocessor: defined(DYNAMIC_KEYMAP_ENABLE)
|
||||||
|
routes: {
|
||||||
|
0x01: {
|
||||||
|
type: command
|
||||||
|
name: Capabilities Query
|
||||||
|
define: CAPABILITIES_QUERY
|
||||||
|
description:
|
||||||
|
'''
|
||||||
|
Remapping subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.
|
||||||
|
'''
|
||||||
|
return_type: u32
|
||||||
|
return_purpose: capabilities
|
||||||
|
return_constant: XAP_ROUTE_REMAPPING_CAPABILITIES
|
||||||
|
}
|
||||||
|
0x02: {
|
||||||
type: command
|
type: command
|
||||||
name: Set Keycode
|
name: Set Keycode
|
||||||
define: SET_KEYMAP_KEYCODE
|
define: SET_KEYMAP_KEYCODE
|
||||||
@ -84,61 +125,13 @@
|
|||||||
]
|
]
|
||||||
return_execute: dynamic_keymap_set_keycode
|
return_execute: dynamic_keymap_set_keycode
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
0x05: {
|
|
||||||
type: router
|
|
||||||
name: Dynamic Encoders
|
|
||||||
define: DYNAMIC_ENCODER
|
|
||||||
description:
|
|
||||||
'''
|
|
||||||
This subsystem allows for live modifications of the keymap, allowing encoder functionality to be reassigned without rebuilding the firmware.
|
|
||||||
'''
|
|
||||||
enable_if_preprocessor: defined(DYNAMIC_KEYMAP_ENABLE) && defined(ENCODER_MAP_ENABLE)
|
|
||||||
routes: {
|
|
||||||
0x00: {
|
|
||||||
type: command
|
|
||||||
name: Capabilities Query
|
|
||||||
define: CAPABILITIES_QUERY
|
|
||||||
description:
|
|
||||||
'''
|
|
||||||
Dynamic Encoders subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.
|
|
||||||
'''
|
|
||||||
return_type: u32
|
|
||||||
return_purpose: capabilities
|
|
||||||
return_constant: XAP_ROUTE_DYNAMIC_ENCODER_CAPABILITIES
|
|
||||||
}
|
|
||||||
0x02: {
|
|
||||||
type: command
|
|
||||||
name: Get Keycode
|
|
||||||
define: GET_ENCODER_KEYCODE
|
|
||||||
description: Query the Keycode at the requested location.
|
|
||||||
request_type: struct
|
|
||||||
request_struct_length: 3
|
|
||||||
request_struct_members: [
|
|
||||||
{
|
|
||||||
type: u8
|
|
||||||
name: Layer
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: u8
|
|
||||||
name: Encoder
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: u8
|
|
||||||
name: Clockwise
|
|
||||||
}
|
|
||||||
]
|
|
||||||
return_type: u16
|
|
||||||
return_execute: dynamic_encoder_get_keycode
|
|
||||||
}
|
|
||||||
0x03: {
|
0x03: {
|
||||||
type: command
|
type: command
|
||||||
name: Set Keycode
|
name: Set Encoder Keycode
|
||||||
define: SET_ENCODER_KEYCODE
|
define: SET_ENCODER_KEYCODE
|
||||||
permissions: secure
|
permissions: secure
|
||||||
description: Modify the Keycode at the requested location.
|
description: Modify the Keycode at the requested location.
|
||||||
|
enable_if_preprocessor: defined(ENCODER_MAP_ENABLE)
|
||||||
request_type: struct
|
request_type: struct
|
||||||
request_struct_length: 5
|
request_struct_length: 5
|
||||||
request_struct_members: [
|
request_struct_members: [
|
||||||
@ -174,7 +167,7 @@
|
|||||||
'''
|
'''
|
||||||
enable_if_preprocessor: defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
enable_if_preprocessor: defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||||
routes: {
|
routes: {
|
||||||
0x00: {
|
0x01: {
|
||||||
type: command
|
type: command
|
||||||
name: Capabilities Query
|
name: Capabilities Query
|
||||||
define: CAPABILITIES_QUERY
|
define: CAPABILITIES_QUERY
|
||||||
|
@ -108,10 +108,10 @@ This subsystem is always present, and provides the ability to address QMK-specif
|
|||||||
| Board identifiers | `0x01 0x02` | |<br>__Response:__<br> * Vendor ID: `u16`<br> * Product ID: `u16`<br> * Product Version: `u16`<br> * QMK Unique Identifier: `u32`| Retrieves the set of identifying information for the board.|
|
| Board identifiers | `0x01 0x02` | |<br>__Response:__<br> * Vendor ID: `u16`<br> * Product ID: `u16`<br> * Product Version: `u16`<br> * QMK Unique Identifier: `u32`| Retrieves the set of identifying information for the board.|
|
||||||
| Board Manufacturer | `0x01 0x03` | |<br>__Response:__ `string`| Retrieves the name of the manufacturer|
|
| Board Manufacturer | `0x01 0x03` | |<br>__Response:__ `string`| Retrieves the name of the manufacturer|
|
||||||
| Product Name | `0x01 0x04` | |<br>__Response:__ `string`| Retrieves the product name|
|
| Product Name | `0x01 0x04` | |<br>__Response:__ `string`| Retrieves the product name|
|
||||||
| info.json length | `0x01 0x05` | |<br>__Response:__ `u32`| Retrieves the length of info.json|
|
| Config Blob Length | `0x01 0x05` | |<br>__Response:__ `u32`| Retrieves the length of the configuration data bundled within the firmware|
|
||||||
| info.json | `0x01 0x06` | |<br>__Request:__ `u16`<br>__Response:__ `u8[32]`| Retrieves a chunk of info.json|
|
| Config Blob Chunk | `0x01 0x06` | |<br>__Request:__ `u16`<br>__Response:__ `u8[32]`| Retrieves a chunk of the configuration data bundled within the firmware|
|
||||||
| Jump to bootloader | `0x01 0x07` | __Secure__ |<br>__Response:__ `u8`| Jump to bootloader<br><br>May not be present – if QMK capabilities query returns “true”, then jump to bootloader is supported<br><br>* 0 means secure routes are disabled, and should be considered as a failure<br>* 1 means successful, board will jump to bootloader|
|
| Jump to bootloader | `0x01 0x07` | __Secure__ |<br>__Response:__ `u8`| Jump to bootloader<br><br>May not be present – if QMK capabilities query returns “true”, then jump to bootloader is supported<br><br>* 0 means secure routes are disabled, and should be considered as a failure<br>* 1 means successful, board will jump to bootloader|
|
||||||
| info.json | `0x01 0x08` | |<br>__Response:__ `u32[4]`| Retrieves a unique identifier for the board.|
|
| Unique Identifier | `0x01 0x08` | |<br>__Response:__ `u32[4]`| Retrieves a unique identifier for the board.|
|
||||||
|
|
||||||
### Keyboard - `0x02`
|
### Keyboard - `0x02`
|
||||||
This subsystem is always present, and reserved for user-specific functionality. No routes are defined by XAP.
|
This subsystem is always present, and reserved for user-specific functionality. No routes are defined by XAP.
|
||||||
|
@ -108,10 +108,10 @@ This subsystem is always present, and provides the ability to address QMK-specif
|
|||||||
| Board identifiers | `0x01 0x02` | |<br>__Response:__<br> * Vendor ID: `u16`<br> * Product ID: `u16`<br> * Product Version: `u16`<br> * QMK Unique Identifier: `u32`| Retrieves the set of identifying information for the board.|
|
| Board identifiers | `0x01 0x02` | |<br>__Response:__<br> * Vendor ID: `u16`<br> * Product ID: `u16`<br> * Product Version: `u16`<br> * QMK Unique Identifier: `u32`| Retrieves the set of identifying information for the board.|
|
||||||
| Board Manufacturer | `0x01 0x03` | |<br>__Response:__ `string`| Retrieves the name of the manufacturer|
|
| Board Manufacturer | `0x01 0x03` | |<br>__Response:__ `string`| Retrieves the name of the manufacturer|
|
||||||
| Product Name | `0x01 0x04` | |<br>__Response:__ `string`| Retrieves the product name|
|
| Product Name | `0x01 0x04` | |<br>__Response:__ `string`| Retrieves the product name|
|
||||||
| info.json length | `0x01 0x05` | |<br>__Response:__ `u32`| Retrieves the length of info.json|
|
| Config Blob Length | `0x01 0x05` | |<br>__Response:__ `u32`| Retrieves the length of the configuration data bundled within the firmware|
|
||||||
| info.json | `0x01 0x06` | |<br>__Request:__ `u16`<br>__Response:__ `u8[32]`| Retrieves a chunk of info.json|
|
| Config Blob Chunk | `0x01 0x06` | |<br>__Request:__ `u16`<br>__Response:__ `u8[32]`| Retrieves a chunk of the configuration data bundled within the firmware|
|
||||||
| Jump to bootloader | `0x01 0x07` | __Secure__ |<br>__Response:__ `u8`| Jump to bootloader<br><br>May not be present – if QMK capabilities query returns “true”, then jump to bootloader is supported<br><br>* 0 means secure routes are disabled, and should be considered as a failure<br>* 1 means successful, board will jump to bootloader|
|
| Jump to bootloader | `0x01 0x07` | __Secure__ |<br>__Response:__ `u8`| Jump to bootloader<br><br>May not be present – if QMK capabilities query returns “true”, then jump to bootloader is supported<br><br>* 0 means secure routes are disabled, and should be considered as a failure<br>* 1 means successful, board will jump to bootloader|
|
||||||
| info.json | `0x01 0x08` | |<br>__Response:__ `u32[4]`| Retrieves a unique identifier for the board.|
|
| Unique Identifier | `0x01 0x08` | |<br>__Response:__ `u32[4]`| Retrieves a unique identifier for the board.|
|
||||||
|
|
||||||
### Keyboard - `0x02`
|
### Keyboard - `0x02`
|
||||||
This subsystem is always present, and reserved for user-specific functionality. No routes are defined by XAP.
|
This subsystem is always present, and reserved for user-specific functionality. No routes are defined by XAP.
|
||||||
@ -121,26 +121,25 @@ This subsystem is always present, and reserved for user-specific functionality.
|
|||||||
This subsystem is always present, and reserved for user-specific functionality. No routes are defined by XAP.
|
This subsystem is always present, and reserved for user-specific functionality. No routes are defined by XAP.
|
||||||
|
|
||||||
|
|
||||||
### Dynamic Keymap - `0x04`
|
### Keymap - `0x04`
|
||||||
This subsystem allows for live modifications of the keymap, allowing keys to be reassigned without rebuilding the firmware.
|
This subsystem allows for query of currently configured keycodes.
|
||||||
|
|
||||||
|
|
||||||
| Name | Route | Tags | Payloads | Description |
|
| Name | Route | Tags | Payloads | Description |
|
||||||
| -- | -- | -- | -- | -- |
|
| -- | -- | -- | -- | -- |
|
||||||
| Capabilities Query | `0x04 0x00` | |<br>__Response:__ `u32`| Dynamic Keymap subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
| Capabilities Query | `0x04 0x01` | |<br>__Response:__ `u32`| Keymap subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||||
| Get Layer Count | `0x04 0x01` | |<br>__Response:__ `u8`| Query maximum number of layers that can be addressed within the keymap.|
|
|
||||||
| Get Keycode | `0x04 0x02` | |<br>__Request:__<br> * Layer: `u8`<br> * Row: `u8`<br> * Column: `u8`<br>__Response:__ `u16`| Query the Keycode at the requested location.|
|
| Get Keycode | `0x04 0x02` | |<br>__Request:__<br> * Layer: `u8`<br> * Row: `u8`<br> * Column: `u8`<br>__Response:__ `u16`| Query the Keycode at the requested location.|
|
||||||
| Set Keycode | `0x04 0x03` | __Secure__ |<br>__Request:__<br> * Layer: `u8`<br> * Row: `u8`<br> * Column: `u8`<br> * Keycode: `u16`| Modify the Keycode at the requested location.|
|
| Get Encoder Keycode | `0x04 0x03` | |<br>__Request:__<br> * Layer: `u8`<br> * Encoder: `u8`<br> * Clockwise: `u8`<br>__Response:__ `u16`| Query the Keycode at the requested location.|
|
||||||
|
|
||||||
### Dynamic Encoders - `0x05`
|
### Remapping - `0x05`
|
||||||
This subsystem allows for live modifications of the keymap, allowing encoder functionality to be reassigned without rebuilding the firmware.
|
This subsystem allows for live reassignment of keycodes without rebuilding the firmware.
|
||||||
|
|
||||||
|
|
||||||
| Name | Route | Tags | Payloads | Description |
|
| Name | Route | Tags | Payloads | Description |
|
||||||
| -- | -- | -- | -- | -- |
|
| -- | -- | -- | -- | -- |
|
||||||
| Capabilities Query | `0x05 0x00` | |<br>__Response:__ `u32`| Dynamic Encoders subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
| Capabilities Query | `0x05 0x01` | |<br>__Response:__ `u32`| Remapping subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||||
| Get Keycode | `0x05 0x02` | |<br>__Request:__<br> * Layer: `u8`<br> * Encoder: `u8`<br> * Clockwise: `u8`<br>__Response:__ `u16`| Query the Keycode at the requested location.|
|
| Set Keycode | `0x05 0x02` | __Secure__ |<br>__Request:__<br> * Layer: `u8`<br> * Row: `u8`<br> * Column: `u8`<br> * Keycode: `u16`| Modify the Keycode at the requested location.|
|
||||||
| Set Keycode | `0x05 0x03` | __Secure__ |<br>__Request:__<br> * Layer: `u8`<br> * Encoder: `u8`<br> * Clockwise: `u8`<br> * Keycode: `u16`| Modify the Keycode at the requested location.|
|
| Set Encoder Keycode | `0x05 0x03` | __Secure__ |<br>__Request:__<br> * Layer: `u8`<br> * Encoder: `u8`<br> * Clockwise: `u8`<br> * Keycode: `u16`| Modify the Keycode at the requested location.|
|
||||||
|
|
||||||
### Lighting - `0x06`
|
### Lighting - `0x06`
|
||||||
This subsystem allows for control over the lighting subsystem.
|
This subsystem allows for control over the lighting subsystem.
|
||||||
@ -148,7 +147,7 @@ This subsystem allows for control over the lighting subsystem.
|
|||||||
|
|
||||||
| Name | Route | Tags | Payloads | Description |
|
| Name | Route | Tags | Payloads | Description |
|
||||||
| -- | -- | -- | -- | -- |
|
| -- | -- | -- | -- | -- |
|
||||||
| Capabilities Query | `0x06 0x00` | |<br>__Response:__ `u32`| Lighting subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
| Capabilities Query | `0x06 0x01` | |<br>__Response:__ `u32`| Lighting subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||||
|
|
||||||
|
|
||||||
## Broadcast messages
|
## Broadcast messages
|
||||||
|
@ -4,7 +4,7 @@ from milc import cli
|
|||||||
|
|
||||||
from qmk.path import normpath
|
from qmk.path import normpath
|
||||||
from qmk.keyboard import keyboard_completer, keyboard_folder
|
from qmk.keyboard import keyboard_completer, keyboard_folder
|
||||||
from qmk.xap.gen_firmware.info_generator import generate_info
|
from qmk.xap.gen_firmware.blob_generator import generate_blob
|
||||||
from qmk.xap.gen_firmware.inline_generator import generate_inline
|
from qmk.xap.gen_firmware.inline_generator import generate_inline
|
||||||
from qmk.xap.gen_firmware.header_generator import generate_header
|
from qmk.xap.gen_firmware.header_generator import generate_header
|
||||||
|
|
||||||
@ -52,9 +52,9 @@ def xap_generate_qmk_h(cli):
|
|||||||
@cli.argument('-o', '--output', type=normpath, help='File to write to')
|
@cli.argument('-o', '--output', type=normpath, help='File to write to')
|
||||||
@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Name of the keyboard')
|
@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Name of the keyboard')
|
||||||
@cli.argument('-km', '--keymap', help='The keymap\'s name')
|
@cli.argument('-km', '--keymap', help='The keymap\'s name')
|
||||||
@cli.subcommand('Generates the XAP info.json payload include.', hidden=False if cli.config.user.developer else True)
|
@cli.subcommand('Generates the XAP config payload include.', hidden=False if cli.config.user.developer else True)
|
||||||
def xap_generate_info_h(cli):
|
def xap_generate_qmk_blob_h(cli):
|
||||||
"""Generates the XAP info.json payload header file, generated during normal build.
|
"""Generates the XAP config payload header file, generated during normal build.
|
||||||
"""
|
"""
|
||||||
# Determine our keyboard/keymap
|
# Determine our keyboard/keymap
|
||||||
if not cli.args.keyboard:
|
if not cli.args.keyboard:
|
||||||
@ -66,4 +66,4 @@ def xap_generate_info_h(cli):
|
|||||||
cli.subcommands['xap-generate-info-h'].print_help()
|
cli.subcommands['xap-generate-info-h'].print_help()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
generate_info(cli.args.output, cli.args.keyboard, cli.args.keymap)
|
generate_blob(cli.args.output, cli.args.keyboard, cli.args.keymap)
|
||||||
|
@ -163,23 +163,23 @@ def _list_devices():
|
|||||||
print_dotted_output(data)
|
print_dotted_output(data)
|
||||||
|
|
||||||
|
|
||||||
def xap_dummy(device):
|
# def xap_dummy(device):
|
||||||
# get layer count
|
# # get layer count
|
||||||
layers = _xap_transaction(device, 0x04, 0x01)
|
# layers = _xap_transaction(device, 0x04, 0x00)
|
||||||
layers = int.from_bytes(layers, "little")
|
# layers = int.from_bytes(layers, "little")
|
||||||
print(f'layers:{layers}')
|
# print(f'layers:{layers}')
|
||||||
|
|
||||||
# get keycode [layer:0, row:0, col:0]
|
# # get keycode [layer:0, row:0, col:0]
|
||||||
# keycode = _xap_transaction(device, 0x04, 0x02, b"\x00\x00\x00")
|
# # keycode = _xap_transaction(device, 0x04, 0x02, b"\x00\x00\x00")
|
||||||
|
|
||||||
# get encoder [layer:0, index:0, clockwise:0]
|
# # get encoder [layer:0, index:0, clockwise:0]
|
||||||
keycode = _xap_transaction(device, 0x05, 0x02, b"\x00\x00\x00")
|
# keycode = _xap_transaction(device, 0x04, 0x03, b"\x00\x00\x00")
|
||||||
|
|
||||||
keycode = int.from_bytes(keycode, "little")
|
# keycode = int.from_bytes(keycode, "little")
|
||||||
print(f'keycode:{KEYCODE_MAP.get(keycode, "unknown")}[{keycode}]')
|
# print(f'keycode:{KEYCODE_MAP.get(keycode, "unknown")}[{keycode}]')
|
||||||
|
|
||||||
# set encoder [layer:0, index:0, clockwise:0, keycode:KC_A]
|
# # set encoder [layer:0, index:0, clockwise:0, keycode:KC_A]
|
||||||
_xap_transaction(device, 0x05, 0x03, b"\x00\x00\x00\x04\00")
|
# _xap_transaction(device, 0x05, 0x03, b"\x00\x00\x00\x04\00")
|
||||||
|
|
||||||
|
|
||||||
def xap_broadcast_listen(device):
|
def xap_broadcast_listen(device):
|
||||||
|
@ -9,7 +9,7 @@ from qmk.commands import get_chunks, dump_lines
|
|||||||
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
|
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
|
||||||
|
|
||||||
|
|
||||||
def generate_info(output_file, keyboard, keymap):
|
def generate_blob(output_file, keyboard, keymap):
|
||||||
# Build the info.json file
|
# Build the info.json file
|
||||||
km_info_json = keymap_json(keyboard, keymap)
|
km_info_json = keymap_json(keyboard, keymap)
|
||||||
|
|
||||||
@ -33,9 +33,9 @@ def generate_info(output_file, keyboard, keymap):
|
|||||||
lines = [GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE, '#pragma once', '']
|
lines = [GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE, '#pragma once', '']
|
||||||
|
|
||||||
# Gen output file
|
# Gen output file
|
||||||
lines.append('static const unsigned char info_json_gz[] PROGMEM = {')
|
lines.append('static const unsigned char config_blob_gz[] PROGMEM = {')
|
||||||
lines.append(data)
|
lines.append(data)
|
||||||
lines.append('};')
|
lines.append('};')
|
||||||
lines.append(f'#define INFO_JSON_GZ_LEN {data_len}')
|
lines.append(f'#define CONFIG_BLOB_GZ_LEN {data_len}')
|
||||||
|
|
||||||
dump_lines(output_file, lines)
|
dump_lines(output_file, lines)
|
@ -18,13 +18,13 @@
|
|||||||
#include <xap.h>
|
#include <xap.h>
|
||||||
#include "secure.h"
|
#include "secure.h"
|
||||||
|
|
||||||
#include "info_json_gz.h"
|
#include "config_blob_gz.h"
|
||||||
bool get_info_json_chunk(uint16_t offset, uint8_t *data, uint8_t data_len) {
|
bool get_config_blob_chunk(uint16_t offset, uint8_t *data, uint8_t data_len) {
|
||||||
if (offset + data_len > INFO_JSON_GZ_LEN) {
|
if (offset + data_len > CONFIG_BLOB_GZ_LEN) {
|
||||||
data_len = INFO_JSON_GZ_LEN - offset;
|
data_len = CONFIG_BLOB_GZ_LEN - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy_P(data, &info_json_gz[offset], data_len);
|
memcpy_P(data, &config_blob_gz[offset], data_len);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,16 +53,17 @@ uint32_t xap_route_qmk_ffffffffffffffff_getter(void) {
|
|||||||
return 0x12345678;
|
return 0x12345678;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xap_respond_get_info_json_chunk(xap_token_t token, const void *data, size_t length) {
|
bool xap_respond_get_config_blob_chunk(xap_token_t token, const void *data, size_t length) {
|
||||||
if (length != sizeof(uint16_t)) {
|
if (length != sizeof(uint16_t)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t offset = *((uint16_t *)data);
|
uint16_t offset = *((uint16_t *)data);
|
||||||
xap_route_qmk_info_query_t ret = {0};
|
|
||||||
|
|
||||||
bool get_info_json_chunk(uint16_t offset, uint8_t * data, uint8_t data_len);
|
xap_route_qmk_config_blob_chunk_t ret = {0};
|
||||||
get_info_json_chunk(offset, (uint8_t *)&ret, sizeof(ret));
|
|
||||||
|
bool get_config_blob_chunk(uint16_t offset, uint8_t * data, uint8_t data_len);
|
||||||
|
get_config_blob_chunk(offset, (uint8_t *)&ret, sizeof(ret));
|
||||||
|
|
||||||
return xap_respond_data(token, &ret, sizeof(ret));
|
return xap_respond_data(token, &ret, sizeof(ret));
|
||||||
}
|
}
|
||||||
@ -103,24 +104,41 @@ bool xap_respond_get_hardware_id(xap_token_t token, const void *data, size_t len
|
|||||||
return xap_respond_data(token, &ret, sizeof(ret));
|
return xap_respond_data(token, &ret, sizeof(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ((defined(DYNAMIC_KEYMAP_ENABLE)))
|
bool xap_respond_get_keymap_keycode(xap_token_t token, const void *data, size_t length) {
|
||||||
bool xap_respond_dynamic_keymap_get_keycode(xap_token_t token, const void *data, size_t length) {
|
if (length != sizeof(xap_route_keymap_get_keymap_keycode_arg_t)) {
|
||||||
if (length != sizeof(xap_route_dynamic_keymap_get_keymap_keycode_arg_t)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
xap_route_dynamic_keymap_get_keymap_keycode_arg_t *arg = (xap_route_dynamic_keymap_get_keymap_keycode_arg_t *)data;
|
xap_route_keymap_get_keymap_keycode_arg_t *arg = (xap_route_keymap_get_keymap_keycode_arg_t *)data;
|
||||||
|
|
||||||
uint16_t keycode = dynamic_keymap_get_keycode(arg->layer, arg->row, arg->column);
|
keypos_t pos = MAKE_KEYPOS(arg->row, arg->column);
|
||||||
|
|
||||||
|
uint16_t keycode = keymap_key_to_keycode(arg->layer, pos);
|
||||||
return xap_respond_data(token, &keycode, sizeof(keycode));
|
return xap_respond_data(token, &keycode, sizeof(keycode));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xap_respond_dynamic_keymap_set_keycode(xap_token_t token, const void *data, size_t length) {
|
#if ((defined(ENCODER_MAP_ENABLE)))
|
||||||
if (length != sizeof(xap_route_dynamic_keymap_set_keymap_keycode_arg_t)) {
|
bool xap_respond_get_encoder_keycode(xap_token_t token, const void *data, size_t length) {
|
||||||
|
if (length != sizeof(xap_route_keymap_get_encoder_keycode_arg_t)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
xap_route_dynamic_keymap_set_keymap_keycode_arg_t *arg = (xap_route_dynamic_keymap_set_keymap_keycode_arg_t *)data;
|
xap_route_keymap_get_encoder_keycode_arg_t *arg = (xap_route_keymap_get_encoder_keycode_arg_t *)data;
|
||||||
|
|
||||||
|
keypos_t pos = MAKE_KEYPOS(arg->clockwise ? KEYLOC_ENCODER_CW : KEYLOC_ENCODER_CCW, arg->encoder);
|
||||||
|
|
||||||
|
uint16_t keycode = keymap_key_to_keycode(arg->layer, pos);
|
||||||
|
return xap_respond_data(token, &keycode, sizeof(keycode));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ((defined(DYNAMIC_KEYMAP_ENABLE)))
|
||||||
|
bool xap_respond_dynamic_keymap_set_keycode(xap_token_t token, const void *data, size_t length) {
|
||||||
|
if (length != sizeof(xap_route_remapping_set_keymap_keycode_arg_t)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
xap_route_remapping_set_keymap_keycode_arg_t *arg = (xap_route_remapping_set_keymap_keycode_arg_t *)data;
|
||||||
|
|
||||||
dynamic_keymap_set_keycode(arg->layer, arg->row, arg->column, arg->keycode);
|
dynamic_keymap_set_keycode(arg->layer, arg->row, arg->column, arg->keycode);
|
||||||
xap_respond_success(token);
|
xap_respond_success(token);
|
||||||
@ -128,24 +146,13 @@ bool xap_respond_dynamic_keymap_set_keycode(xap_token_t token, const void *data,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((defined(ENCODER_MAP_ENABLE)))
|
#if ((defined(DYNAMIC_KEYMAP_ENABLE) && defined(ENCODER_MAP_ENABLE)))
|
||||||
bool xap_respond_dynamic_encoder_get_keycode(xap_token_t token, const void *data, size_t length) {
|
|
||||||
if (length != sizeof(xap_route_dynamic_encoder_get_encoder_keycode_arg_t)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
xap_route_dynamic_encoder_get_encoder_keycode_arg_t *arg = (xap_route_dynamic_encoder_get_encoder_keycode_arg_t *)data;
|
|
||||||
|
|
||||||
uint16_t keycode = dynamic_keymap_get_encoder(arg->layer, arg->encoder, arg->clockwise);
|
|
||||||
return xap_respond_data(token, &keycode, sizeof(keycode));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool xap_respond_dynamic_encoder_set_keycode(xap_token_t token, const void *data, size_t length) {
|
bool xap_respond_dynamic_encoder_set_keycode(xap_token_t token, const void *data, size_t length) {
|
||||||
if (length != sizeof(xap_route_dynamic_encoder_set_encoder_keycode_arg_t)) {
|
if (length != sizeof(xap_route_remapping_set_encoder_keycode_arg_t)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
xap_route_dynamic_encoder_set_encoder_keycode_arg_t *arg = (xap_route_dynamic_encoder_set_encoder_keycode_arg_t *)data;
|
xap_route_remapping_set_encoder_keycode_arg_t *arg = (xap_route_remapping_set_encoder_keycode_arg_t *)data;
|
||||||
|
|
||||||
dynamic_keymap_set_encoder(arg->layer, arg->encoder, arg->clockwise, arg->keycode);
|
dynamic_keymap_set_encoder(arg->layer, arg->encoder, arg->clockwise, arg->keycode);
|
||||||
xap_respond_success(token);
|
xap_respond_success(token);
|
||||||
|
Loading…
Reference in New Issue
Block a user