From b82c4a8da395287b4d323cf46d0850575388f901 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Mon, 26 May 2014 12:48:10 +0900 Subject: [PATCH] Improve flexibility --- common/keymap_in_eeprom.c | 1 + common/keymap_in_eeprom.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/keymap_in_eeprom.c b/common/keymap_in_eeprom.c index 145b5e61..db5333df 100644 --- a/common/keymap_in_eeprom.c +++ b/common/keymap_in_eeprom.c @@ -19,6 +19,7 @@ along with this program. If not, see . #include #include "eeconfig.h" #include "keymap_in_eeprom.h" +#include "matrix.h" #include "debug.h" #ifdef KEYMAP_IN_EEPROM_ENABLE diff --git a/common/keymap_in_eeprom.h b/common/keymap_in_eeprom.h index 769dfa2e..7e124785 100644 --- a/common/keymap_in_eeprom.h +++ b/common/keymap_in_eeprom.h @@ -23,14 +23,16 @@ along with this program. If not, see . #include #include +#ifndef EECONFIG_KEYMAP_IN_EEPROM #define EECONFIG_KEYMAP_IN_EEPROM 0x10 +#endif #ifndef FN_ACTIONS_COUNT #define FN_ACTIONS_COUNT 32 #endif #ifndef KEYMAPS_COUNT #define KEYMAPS_COUNT 1 #endif -#define KEYS_COUNT (KEYMAPS_COUNT * MATRIX_ROWS * MATRIX_COLS) +#define KEYS_COUNT (KEYMAPS_COUNT * matrix_rows() * matrix_cols()) typedef struct { uint16_t checksum; @@ -45,7 +47,7 @@ typedef struct { #define KEYMAP_SIZE (sizeof(uint16_t) * FN_ACTIONS_COUNT + sizeof(uint8_t) * KEYS_COUNT) #define KEYMAP_WORD_SIZE ((KEYMAP_SIZE + 1) / 2) -#define KEY_OFFSET(layer, row, col) (layer * MATRIX_ROWS * MATRIX_COLS + row * MATRIX_COLS + col) +#define KEY_OFFSET(layer, row, col) (layer * matrix_rows() * matrix_cols() + row * matrix_cols() + col) void keymap_in_eeprom_init(void); void keymap_in_eeprom_disable(void);