aboutsummaryrefslogtreecommitdiff
path: root/keyboard/hid_liber/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/hid_liber/keymap.c')
-rw-r--r--keyboard/hid_liber/keymap.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/keyboard/hid_liber/keymap.c b/keyboard/hid_liber/keymap.c
index f3d6bfa2e..609edb5e1 100644
--- a/keyboard/hid_liber/keymap.c
+++ b/keyboard/hid_liber/keymap.c
@@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
24#include "keycode.h" 24#include "keycode.h"
25#include "action.h" 25#include "action.h"
26#include "action_macro.h" 26#include "action_macro.h"
27#include "layer_switch.h"
28#include "report.h" 27#include "report.h"
29#include "host.h" 28#include "host.h"
30#include "print.h" 29#include "print.h"
@@ -160,8 +159,6 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
160 159
161}; 160};
162 161
163static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {};
164
165/* 162/*
166 * Fn action definition 163 * Fn action definition
167 */ 164 */
@@ -179,33 +176,15 @@ static const uint16_t PROGMEM fn_actions[] = {
179#endif 176#endif
180 177
181#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0])) 178#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
182#define OVERLAYS_SIZE (sizeof(overlays) / sizeof(overlays[0]))
183#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0])) 179#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
184 180
185/* translates key to keycode */ 181/* translates key to keycode */
186uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) 182uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
187{ 183{
188 /* Overlay: 16-31(OVERLAY_BIT(0x10) | overlay_layer) */ 184 if (layer < KEYMAPS_SIZE) {
189 if (layer & OVERLAY_BIT) { 185 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
190 layer &= OVERLAY_MASK; 186 } else {
191 if (layer < OVERLAYS_SIZE) { 187 return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
192 return pgm_read_byte(&overlays[(layer)][(key.row)][(key.col)]);
193 } else {
194 // XXX: this may cuaes bootlaoder_jump incositent fail.
195 //debug("key_to_keycode: overlay "); debug_dec(layer); debug(" is invalid.\n");
196 return KC_TRANSPARENT;
197 }
198 }
199 /* Keymap: 0-15 */
200 else {
201 if (layer < KEYMAPS_SIZE) {
202 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
203 } else {
204 // XXX: this may cuaes bootlaoder_jump incositent fail.
205 //debug("key_to_keycode: base "); debug_dec(layer); debug(" is invalid.\n");
206 // fall back to layer 0
207 return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
208 }
209 } 188 }
210} 189}
211 190