mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-04-10 07:45:41 +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
|
||||
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)
|
||||
$(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)
|
||||
|
||||
$(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))
|
||||
@$(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
|
||||
|
@ -296,21 +296,21 @@
|
||||
}
|
||||
0x05: {
|
||||
type: command
|
||||
name: info.json length
|
||||
define: INFO_LEN_QUERY
|
||||
description: Retrieves the length of info.json
|
||||
name: Config Blob Length
|
||||
define: CONFIG_BLOB_LEN
|
||||
description: Retrieves the length of the configuration data bundled within the firmware
|
||||
return_type: u32
|
||||
return_constant: INFO_JSON_GZ_LEN
|
||||
return_constant: CONFIG_BLOB_GZ_LEN
|
||||
}
|
||||
0x06: {
|
||||
type: command
|
||||
name: info.json
|
||||
define: INFO_QUERY
|
||||
description: Retrieves a chunk of info.json
|
||||
name: Config Blob Chunk
|
||||
define: CONFIG_BLOB_CHUNK
|
||||
description: Retrieves a chunk of the configuration data bundled within the firmware
|
||||
request_type: u16
|
||||
request_purpose: offset
|
||||
return_type: u8[32]
|
||||
return_execute: get_info_json_chunk
|
||||
return_execute: get_config_blob_chunk
|
||||
}
|
||||
0x07: {
|
||||
type: command
|
||||
@ -332,7 +332,7 @@
|
||||
}
|
||||
0x08: {
|
||||
type: command
|
||||
name: info.json
|
||||
name: Unique Identifier
|
||||
define: HARDWARE_ID
|
||||
description: Retrieves a unique identifier for the board.
|
||||
return_type: u32[4]
|
||||
|
@ -4,33 +4,24 @@
|
||||
routes: {
|
||||
0x04: {
|
||||
type: router
|
||||
name: Dynamic Keymap
|
||||
define: DYNAMIC_KEYMAP
|
||||
name: Keymap
|
||||
define: KEYMAP
|
||||
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: {
|
||||
0x00: {
|
||||
0x01: {
|
||||
type: command
|
||||
name: Capabilities Query
|
||||
define: CAPABILITIES_QUERY
|
||||
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_purpose: capabilities
|
||||
return_constant: XAP_ROUTE_DYNAMIC_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
|
||||
return_constant: XAP_ROUTE_KEYMAP_CAPABILITIES
|
||||
}
|
||||
0x02: {
|
||||
type: command
|
||||
@ -54,9 +45,59 @@
|
||||
}
|
||||
]
|
||||
return_type: u16
|
||||
return_execute: dynamic_keymap_get_keycode
|
||||
return_execute: get_keymap_keycode
|
||||
}
|
||||
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
|
||||
name: Set Keycode
|
||||
define: SET_KEYMAP_KEYCODE
|
||||
@ -84,61 +125,13 @@
|
||||
]
|
||||
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: {
|
||||
type: command
|
||||
name: Set Keycode
|
||||
name: Set Encoder Keycode
|
||||
define: SET_ENCODER_KEYCODE
|
||||
permissions: secure
|
||||
description: Modify the Keycode at the requested location.
|
||||
enable_if_preprocessor: defined(ENCODER_MAP_ENABLE)
|
||||
request_type: struct
|
||||
request_struct_length: 5
|
||||
request_struct_members: [
|
||||
@ -174,7 +167,7 @@
|
||||
'''
|
||||
enable_if_preprocessor: defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
routes: {
|
||||
0x00: {
|
||||
0x01: {
|
||||
type: command
|
||||
name: 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 Manufacturer | `0x01 0x03` | |<br>__Response:__ `string`| Retrieves the name of the manufacturer|
|
||||
| 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|
|
||||
| info.json | `0x01 0x06` | |<br>__Request:__ `u16`<br>__Response:__ `u8[32]`| Retrieves a chunk of info.json|
|
||||
| Config Blob Length | `0x01 0x05` | |<br>__Response:__ `u32`| Retrieves the length of the configuration data bundled within the firmware|
|
||||
| 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|
|
||||
| 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`
|
||||
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 Manufacturer | `0x01 0x03` | |<br>__Response:__ `string`| Retrieves the name of the manufacturer|
|
||||
| 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|
|
||||
| info.json | `0x01 0x06` | |<br>__Request:__ `u16`<br>__Response:__ `u8[32]`| Retrieves a chunk of info.json|
|
||||
| Config Blob Length | `0x01 0x05` | |<br>__Response:__ `u32`| Retrieves the length of the configuration data bundled within the firmware|
|
||||
| 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|
|
||||
| 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`
|
||||
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.
|
||||
|
||||
|
||||
### Dynamic Keymap - `0x04`
|
||||
This subsystem allows for live modifications of the keymap, allowing keys to be reassigned without rebuilding the firmware.
|
||||
### Keymap - `0x04`
|
||||
This subsystem allows for query of currently configured keycodes.
|
||||
|
||||
|
||||
| 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.|
|
||||
| Get Layer Count | `0x04 0x01` | |<br>__Response:__ `u8`| Query maximum number of layers that can be addressed within the keymap.|
|
||||
| Capabilities Query | `0x04 0x01` | |<br>__Response:__ `u32`| Keymap subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||
| 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`
|
||||
This subsystem allows for live modifications of the keymap, allowing encoder functionality to be reassigned without rebuilding the firmware.
|
||||
### Remapping - `0x05`
|
||||
This subsystem allows for live reassignment of keycodes without rebuilding the firmware.
|
||||
|
||||
|
||||
| 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.|
|
||||
| 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 0x03` | __Secure__ |<br>__Request:__<br> * Layer: `u8`<br> * Encoder: `u8`<br> * Clockwise: `u8`<br> * Keycode: `u16`| Modify the Keycode at the requested location.|
|
||||
| Capabilities Query | `0x05 0x01` | |<br>__Response:__ `u32`| Remapping subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||
| 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 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`
|
||||
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 |
|
||||
| -- | -- | -- | -- | -- |
|
||||
| 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
|
||||
|
@ -4,7 +4,7 @@ from milc import cli
|
||||
|
||||
from qmk.path import normpath
|
||||
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.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('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Name of the keyboard')
|
||||
@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)
|
||||
def xap_generate_info_h(cli):
|
||||
"""Generates the XAP info.json payload header file, generated during normal build.
|
||||
@cli.subcommand('Generates the XAP config payload include.', hidden=False if cli.config.user.developer else True)
|
||||
def xap_generate_qmk_blob_h(cli):
|
||||
"""Generates the XAP config payload header file, generated during normal build.
|
||||
"""
|
||||
# Determine our keyboard/keymap
|
||||
if not cli.args.keyboard:
|
||||
@ -66,4 +66,4 @@ def xap_generate_info_h(cli):
|
||||
cli.subcommands['xap-generate-info-h'].print_help()
|
||||
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)
|
||||
|
||||
|
||||
def xap_dummy(device):
|
||||
# get layer count
|
||||
layers = _xap_transaction(device, 0x04, 0x01)
|
||||
layers = int.from_bytes(layers, "little")
|
||||
print(f'layers:{layers}')
|
||||
# def xap_dummy(device):
|
||||
# # get layer count
|
||||
# layers = _xap_transaction(device, 0x04, 0x00)
|
||||
# layers = int.from_bytes(layers, "little")
|
||||
# print(f'layers:{layers}')
|
||||
|
||||
# get keycode [layer:0, row:0, col:0]
|
||||
# keycode = _xap_transaction(device, 0x04, 0x02, b"\x00\x00\x00")
|
||||
# # get keycode [layer:0, row:0, col:0]
|
||||
# # keycode = _xap_transaction(device, 0x04, 0x02, b"\x00\x00\x00")
|
||||
|
||||
# get encoder [layer:0, index:0, clockwise:0]
|
||||
keycode = _xap_transaction(device, 0x05, 0x02, b"\x00\x00\x00")
|
||||
# # get encoder [layer:0, index:0, clockwise:0]
|
||||
# keycode = _xap_transaction(device, 0x04, 0x03, b"\x00\x00\x00")
|
||||
|
||||
keycode = int.from_bytes(keycode, "little")
|
||||
print(f'keycode:{KEYCODE_MAP.get(keycode, "unknown")}[{keycode}]')
|
||||
# keycode = int.from_bytes(keycode, "little")
|
||||
# print(f'keycode:{KEYCODE_MAP.get(keycode, "unknown")}[{keycode}]')
|
||||
|
||||
# set encoder [layer:0, index:0, clockwise:0, keycode:KC_A]
|
||||
_xap_transaction(device, 0x05, 0x03, b"\x00\x00\x00\x04\00")
|
||||
# # set encoder [layer:0, index:0, clockwise:0, keycode:KC_A]
|
||||
# _xap_transaction(device, 0x05, 0x03, b"\x00\x00\x00\x04\00")
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
def generate_info(output_file, keyboard, keymap):
|
||||
def generate_blob(output_file, keyboard, keymap):
|
||||
# Build the info.json file
|
||||
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', '']
|
||||
|
||||
# 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('};')
|
||||
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)
|
@ -18,13 +18,13 @@
|
||||
#include <xap.h>
|
||||
#include "secure.h"
|
||||
|
||||
#include "info_json_gz.h"
|
||||
bool get_info_json_chunk(uint16_t offset, uint8_t *data, uint8_t data_len) {
|
||||
if (offset + data_len > INFO_JSON_GZ_LEN) {
|
||||
data_len = INFO_JSON_GZ_LEN - offset;
|
||||
#include "config_blob_gz.h"
|
||||
bool get_config_blob_chunk(uint16_t offset, uint8_t *data, uint8_t data_len) {
|
||||
if (offset + data_len > CONFIG_BLOB_GZ_LEN) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -53,16 +53,17 @@ uint32_t xap_route_qmk_ffffffffffffffff_getter(void) {
|
||||
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)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t offset = *((uint16_t *)data);
|
||||
xap_route_qmk_info_query_t ret = {0};
|
||||
uint16_t offset = *((uint16_t *)data);
|
||||
|
||||
bool get_info_json_chunk(uint16_t offset, uint8_t * data, uint8_t data_len);
|
||||
get_info_json_chunk(offset, (uint8_t *)&ret, sizeof(ret));
|
||||
xap_route_qmk_config_blob_chunk_t ret = {0};
|
||||
|
||||
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));
|
||||
}
|
||||
@ -89,7 +90,7 @@ bool xap_respond_secure_lock(xap_token_t token, const void *data, size_t length)
|
||||
|
||||
#ifdef BOOTLOADER_JUMP_SUPPORTED
|
||||
bool xap_respond_request_bootloader_jump(xap_token_t token, const void *data, size_t length) {
|
||||
uint8_t ret = secure_is_unlocked();
|
||||
uint8_t ret = secure_is_unlocked();
|
||||
|
||||
// TODO: post to deferred queue so this request can return?
|
||||
bool res = 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));
|
||||
}
|
||||
|
||||
#if ((defined(DYNAMIC_KEYMAP_ENABLE)))
|
||||
bool xap_respond_dynamic_keymap_get_keycode(xap_token_t token, const void *data, size_t length) {
|
||||
if (length != sizeof(xap_route_dynamic_keymap_get_keymap_keycode_arg_t)) {
|
||||
bool xap_respond_get_keymap_keycode(xap_token_t token, const void *data, size_t length) {
|
||||
if (length != sizeof(xap_route_keymap_get_keymap_keycode_arg_t)) {
|
||||
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));
|
||||
}
|
||||
|
||||
bool xap_respond_dynamic_keymap_set_keycode(xap_token_t token, const void *data, size_t length) {
|
||||
if (length != sizeof(xap_route_dynamic_keymap_set_keymap_keycode_arg_t)) {
|
||||
#if ((defined(ENCODER_MAP_ENABLE)))
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
xap_respond_success(token);
|
||||
@ -128,27 +146,16 @@ bool xap_respond_dynamic_keymap_set_keycode(xap_token_t token, const void *data,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ((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));
|
||||
}
|
||||
|
||||
#if ((defined(DYNAMIC_KEYMAP_ENABLE) && defined(ENCODER_MAP_ENABLE)))
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
xap_respond_success(token);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user