Implement keymap switching
This commit is contained in:
@@ -38,7 +38,7 @@ parser_error_t ParseConfig(config_buffer_t *buffer) {
|
||||
}
|
||||
keymapCount = readCompactLength(buffer);
|
||||
for (uint16_t keymapIdx = 0; keymapIdx < keymapCount; keymapIdx++) {
|
||||
errorCode = ParseKeymap(buffer);
|
||||
errorCode = ParseKeymap(buffer, keymapIdx, keymapCount);
|
||||
if (errorCode != ParserError_Success) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,8 @@ static parser_error_t parseLayer(config_buffer_t *buffer, uint8_t layer) {
|
||||
return ParserError_Success;
|
||||
}
|
||||
|
||||
parser_error_t ParseKeymap(config_buffer_t *buffer) {;
|
||||
parser_error_t ParseKeymap(config_buffer_t *buffer, uint8_t keymapIdx, uint8_t keymapCount) {;
|
||||
uint16_t offset = buffer->offset;
|
||||
parser_error_t errorCode;
|
||||
uint16_t abbreviationLen;
|
||||
uint16_t nameLen;
|
||||
@@ -191,7 +192,13 @@ parser_error_t ParseKeymap(config_buffer_t *buffer) {;
|
||||
return ParserError_InvalidLayerCount;
|
||||
}
|
||||
if (!ParserRunDry) {
|
||||
LedDisplay_SetText(abbreviationLen, abbreviation);
|
||||
AllKeymapsCount = keymapCount;
|
||||
AllKeymaps[keymapIdx].abbreviation = abbreviation;
|
||||
AllKeymaps[keymapIdx].abbreviationLen = abbreviationLen;
|
||||
AllKeymaps[keymapIdx].offset = offset;
|
||||
if (isDefault) {
|
||||
DefaultKeymapIndex = keymapIdx;
|
||||
}
|
||||
}
|
||||
for (uint16_t layerIdx = 0; layerIdx < layerCount; layerIdx++) {
|
||||
errorCode = parseLayer(buffer, layerIdx);
|
||||
|
||||
@@ -52,6 +52,6 @@
|
||||
|
||||
// Functions:
|
||||
|
||||
parser_error_t ParseKeymap(config_buffer_t *buffer);
|
||||
parser_error_t ParseKeymap(config_buffer_t *buffer, uint8_t keymapIdx, uint8_t keymapCount);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user