Fix some debug codes
This commit is contained in:
parent
e5a48615ec
commit
09d9249310
@ -32,6 +32,12 @@ void keymap_init(void) {
|
|||||||
bool check_keymap_in_eeprom(void) {
|
bool check_keymap_in_eeprom(void) {
|
||||||
uint16_t checksum_in_eeprom = eeprom_read_word(&((keymap_ex_t*)EECONFIG_KEYMAP_EX)->checksum);
|
uint16_t checksum_in_eeprom = eeprom_read_word(&((keymap_ex_t*)EECONFIG_KEYMAP_EX)->checksum);
|
||||||
uint16_t checksum = EECONFIG_MAGIC_NUMBER;
|
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));
|
||||||
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
eeprom_write_word((void*)(EECONFIG_KEYMAP_DEBUG), checksum);
|
||||||
|
#endif
|
||||||
return (checksum_in_eeprom == checksum);
|
return (checksum_in_eeprom == checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,13 @@ typedef struct {
|
|||||||
uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS];
|
uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS];
|
||||||
} keymap_ex_t;
|
} keymap_ex_t;
|
||||||
|
|
||||||
|
#define EECONFIG_KEYMAP_DEBUG (EECONFIG_KEYMAP_EX - sizeof(uint16_t))
|
||||||
#define EECONFIG_KEYMAP_CHECKSUM (EECONFIG_KEYMAP_EX)
|
#define EECONFIG_KEYMAP_CHECKSUM (EECONFIG_KEYMAP_EX)
|
||||||
#define EECONFIG_KEYMAP_FN_ACTIONS (EECONFIG_KEYMAP_EX + sizeof(uint16_t))
|
#define EECONFIG_KEYMAP_FN_ACTIONS (EECONFIG_KEYMAP_EX + sizeof(uint16_t))
|
||||||
#define EECONFIG_KEYMAP_KEYMAPS (EECONFIG_KEYMAP_FN_ACTIONS + sizeof(uint16_t) * FN_ACTIONS_COUNT)
|
#define EECONFIG_KEYMAP_KEYMAPS (EECONFIG_KEYMAP_FN_ACTIONS + sizeof(uint16_t) * FN_ACTIONS_COUNT)
|
||||||
|
|
||||||
#define KEYS_COUNT (KEYMAPS_COUNT * MATRIX_ROWS * MATRIX_COLS)
|
#define KEYS_COUNT (KEYMAPS_COUNT * MATRIX_ROWS * MATRIX_COLS)
|
||||||
|
#define KEYMAP_SIZE (sizeof(uint16_t) * FN_ACTIONS_COUNT + sizeof(uint8_t) * KEYS_COUNT)
|
||||||
#define FN_ACTION_OFFSET(index) (sizeof(uint16_t) * index)
|
#define FN_ACTION_OFFSET(index) (sizeof(uint16_t) * index)
|
||||||
#define KEY_OFFSET(layer, row, col) (sizeof(uint8_t) * (layer * MATRIX_ROWS * MATRIX_COLS + row * MATRIX_COLS + col))
|
#define KEY_OFFSET(layer, row, col) (sizeof(uint8_t) * (layer * MATRIX_ROWS * MATRIX_COLS + row * MATRIX_COLS + col))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user