moving logic to via.c, reverting dynamic_keymap.c changes

This commit is contained in:
Garretonzo 2024-10-24 19:28:48 -07:00
parent 9f3e5fae78
commit d3b8178e7c
2 changed files with 3 additions and 3 deletions

View File

@ -121,12 +121,10 @@ uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column)
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) { void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) {
if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || row >= MATRIX_ROWS || column >= MATRIX_COLS) return; if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || row >= MATRIX_ROWS || column >= MATRIX_COLS) return;
uint16_t prev_keycode = dynamic_keymap_get_keycode(layer, row, column);
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want // Big endian, so we can read/write EEPROM directly from host if we want
eeprom_update_byte(address, (uint8_t)(keycode >> 8)); eeprom_update_byte(address, (uint8_t)(keycode >> 8));
eeprom_update_byte(address + 1, (uint8_t)(keycode & 0xFF)); eeprom_update_byte(address + 1, (uint8_t)(keycode & 0xFF));
unregister_code(prev_keycode);
} }
#ifdef ENCODER_MAP_ENABLE #ifdef ENCODER_MAP_ENABLE

View File

@ -374,7 +374,9 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
break; break;
} }
case id_dynamic_keymap_set_keycode: { case id_dynamic_keymap_set_keycode: {
uint16_t keycode = dynamic_keymap_get_keycode(command_data[0], command_data[1], command_data[2]);
dynamic_keymap_set_keycode(command_data[0], command_data[1], command_data[2], (command_data[3] << 8) | command_data[4]); dynamic_keymap_set_keycode(command_data[0], command_data[1], command_data[2], (command_data[3] << 8) | command_data[4]);
unregister_code(keycode);
break; break;
} }
case id_dynamic_keymap_reset: { case id_dynamic_keymap_reset: {