Fix for tmk's changes
This commit is contained in:
parent
63b3ea9a1e
commit
2bcd171104
@ -59,6 +59,7 @@ else
|
||||
SRC := keymap_poker.c $(SRC)
|
||||
endif
|
||||
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
|
||||
@ -111,6 +112,12 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
# PCB Revision
|
||||
ifdef REV
|
||||
OPT_DEFS += -DGH60_REV_$(REV)
|
||||
endif
|
||||
|
||||
OPT_DEFS += -DBACKLIGHT_CUSTOM
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <avr/pgmspace.h>
|
||||
#include "backlight.h"
|
||||
|
||||
#ifdef GH60_REV_C
|
||||
#ifdef GH60_REV_CHN
|
||||
static const uint8_t backlight_table[] PROGMEM = {
|
||||
0, 16, 128, 255
|
||||
};
|
||||
@ -51,4 +51,6 @@ void backlight_set(uint8_t level)
|
||||
OCR1B = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void backlight_set(uint8_t level) {}
|
||||
#endif
|
||||
|
@ -16,15 +16,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "keymap_common.h"
|
||||
|
||||
|
||||
/* translates key to keycode */
|
||||
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)]);
|
||||
#else
|
||||
return eeconfig_read_keymap_key(layer, key.row, key.col);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* translates Fn keycode to action */
|
||||
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
|
||||
|
@ -28,10 +28,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "print.h"
|
||||
#include "debug.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 uint16_t fn_actions[];
|
||||
//#endif
|
||||
|
||||
|
||||
/* GH60 keymap definition macro
|
||||
|
@ -102,3 +102,13 @@ const uint16_t PROGMEM fn_actions[] = {
|
||||
[7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak 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
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include "keymap_common.h"
|
||||
|
||||
// Poker2
|
||||
#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
|
||||
static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
||||
#endif
|
||||
/* Keymap 0: Default Layer
|
||||
* ,-----------------------------------------------------------.
|
||||
@ -48,9 +50,9 @@ static const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
||||
* Fn action definition
|
||||
*/
|
||||
#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
|
||||
static const uint16_t fn_actions[] PROGMEM = {
|
||||
const uint16_t fn_actions[] PROGMEM = {
|
||||
#endif
|
||||
/* Poker2 Layout */
|
||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
||||
@ -58,3 +60,13 @@ static const uint16_t fn_actions[] PROGMEM = {
|
||||
[2] = ACTION_BACKLIGHT_TOGGLE(),
|
||||
[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
|
Reference in New Issue
Block a user