1
0

Change checksum algorism

This commit is contained in:
Kai Ryu 2013-12-02 11:22:34 +09:00
parent 09d9249310
commit 17bf466ab5
2 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ bool check_keymap_in_eeprom(void) {
uint16_t checksum_in_eeprom = eeprom_read_word(&((keymap_ex_t*)EECONFIG_KEYMAP_EX)->checksum);
uint16_t checksum = EECONFIG_MAGIC_NUMBER;
for (uint16_t i = 0; i < KEYMAP_SIZE; i += 2) {
checksum ^= eeprom_read_word((void*)(EECONFIG_KEYMAP_FN_ACTIONS + i));
checksum += eeprom_read_word((void*)(EECONFIG_KEYMAP_FN_ACTIONS + i));
}
#ifdef DEBUG
eeprom_write_word((void*)(EECONFIG_KEYMAP_DEBUG), checksum);
@ -54,7 +54,7 @@ void write_keymap_to_eeprom(void) {
fn_action = pgm_read_word(fn_actions + i);
}
eeconfig_write_keymap_fn_action(i, fn_action);
checksum ^= fn_action;
checksum += fn_action;
}
}
// write keymaps
@ -70,7 +70,7 @@ void write_keymap_to_eeprom(void) {
if (i & 1) {
keymap_word = keymap << 8;
}
checksum ^= keymap_word;
checksum += keymap_word;
}
}
// write checksum

View File

@ -10,7 +10,7 @@ static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
* |-----------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
* |-----------------------------------------------------------|
* |Caps | A| S| D| F| G| H| J| K| L|Fn3| '|Return |
* |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
* |-----------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
* |-----------------------------------------------------------|