SRC := keymap_poker.c $(SRC) | SRC := keymap_poker.c $(SRC) | ||||
endif | endif | ||||
CONFIG_H = config.h | CONFIG_H = config.h | ||||
# USBaspLoader 2048 | # USBaspLoader 2048 | ||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||||
# PCB Revision | |||||
ifdef REV | |||||
OPT_DEFS += -DGH60_REV_$(REV) | |||||
endif | |||||
OPT_DEFS += -DBACKLIGHT_CUSTOM | |||||
# Build Options | # Build Options | ||||
# comment out to disable the options. | # comment out to disable the options. |
#include <avr/pgmspace.h> | #include <avr/pgmspace.h> | ||||
#include "backlight.h" | #include "backlight.h" | ||||
#ifdef GH60_REV_C | |||||
#ifdef GH60_REV_CHN | |||||
static const uint8_t backlight_table[] PROGMEM = { | static const uint8_t backlight_table[] PROGMEM = { | ||||
0, 16, 128, 255 | 0, 16, 128, 255 | ||||
}; | }; | ||||
OCR1B = 0; | OCR1B = 0; | ||||
} | } | ||||
} | } | ||||
#else | |||||
void backlight_set(uint8_t level) {} | |||||
#endif | #endif |
*/ | */ | ||||
#include "keymap_common.h" | #include "keymap_common.h" | ||||
/* translates key to keycode */ | /* translates key to keycode */ | ||||
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) | uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) | ||||
{ | { | ||||
#ifndef KEYMAP_EX_ENABLE | |||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); | return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); | ||||
#else | |||||
return eeconfig_read_keymap_key(layer, key.row, key.col); | |||||
#endif | |||||
} | } | ||||
/* translates Fn keycode to action */ | /* translates Fn keycode to action */ | ||||
action_t keymap_fn_to_action(uint8_t keycode) | action_t keymap_fn_to_action(uint8_t keycode) | ||||
{ | { | ||||
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; | |||||
return (action_t) { | |||||
#ifndef KEYMAP_EX_ENABLE | |||||
.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) | |||||
#else | |||||
.code = eeconfig_read_keymap_fn_action(FN_INDEX(keycode)) | |||||
#endif | |||||
}; | |||||
} | |||||
#ifdef KEYMAP_EX_ENABLE | |||||
const uint8_t* keymaps_pointer(void) { | |||||
return (const uint8_t*)keymaps; | |||||
} | |||||
const uint16_t* fn_actions_pointer(void) { | |||||
return fn_actions; | |||||
} | } | ||||
#endif |
#include "print.h" | #include "print.h" | ||||
#include "debug.h" | #include "debug.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
#include "keymap_ex.h" | |||||
/* | |||||
#ifdef KEYMAP_EX_ENABLE | |||||
extern const uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[FN_ACTIONS_COUNT]; | |||||
#else | |||||
*/ | |||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | ||||
extern const uint16_t fn_actions[]; | extern const uint16_t fn_actions[]; | ||||
//#endif | |||||
/* GH60 keymap definition macro | /* GH60 keymap definition macro |
[7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout | [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout | ||||
[8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout | [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout | ||||
}; | }; | ||||
#ifdef KEYMAP_EX_ENABLE | |||||
uint16_t keys_count(void) { | |||||
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS; | |||||
} | |||||
uint16_t fn_actions_count(void) { | |||||
return sizeof(fn_actions) / sizeof(fn_actions[0]); | |||||
} | |||||
#endif |
#include "keymap_common.h" | |||||
// Poker2 | // Poker2 | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { | |||||
const uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = { | |||||
#else | #else | ||||
static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||||
#endif | #endif | ||||
/* Keymap 0: Default Layer | /* Keymap 0: Default Layer | ||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const uint16_t fn_actions[FN_ACTIONS_COUNT] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
#else | #else | ||||
static const uint16_t fn_actions[] PROGMEM = { | |||||
const uint16_t fn_actions[] PROGMEM = { | |||||
#endif | #endif | ||||
/* Poker2 Layout */ | /* Poker2 Layout */ | ||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[2] = ACTION_BACKLIGHT_TOGGLE(), | [2] = ACTION_BACKLIGHT_TOGGLE(), | ||||
[3] = ACTION_BACKLIGHT_INCREASE() | [3] = ACTION_BACKLIGHT_INCREASE() | ||||
}; | }; | ||||
#ifdef KEYMAP_EX_ENABLE | |||||
uint16_t keys_count(void) { | |||||
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS; | |||||
} | |||||
uint16_t fn_actions_count(void) { | |||||
return sizeof(fn_actions) / sizeof(fn_actions[0]); | |||||
} | |||||
#endif |