kimera: Add support for two-handed split keyboard
- Enable with 'TWO_HEADED_KIMERA'
This commit is contained in:
parent
34de691cde
commit
bcee04659b
@ -28,14 +28,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define DESCRIPTION t.m.k. keyboard firmware for Kimera
|
#define DESCRIPTION t.m.k. keyboard firmware for Kimera
|
||||||
|
|
||||||
/* key matrix size */
|
/* key matrix size */
|
||||||
#define MATRIX_ROWS 24
|
#define MATRIX_ROWS 32
|
||||||
#define MATRIX_COLS 24
|
#define MATRIX_COLS 32
|
||||||
|
|
||||||
/* keymap in eeprom */
|
/* keymap in eeprom */
|
||||||
#define MATRIX_SIZE 16 * 16
|
#define MATRIX_SIZE 16 * 16
|
||||||
#define FN_ACTIONS_COUNT 32
|
#define FN_ACTIONS_COUNT 32
|
||||||
#define KEYMAPS_COUNT 3
|
#define KEYMAPS_COUNT 3
|
||||||
#define EECONFIG_KEYMAP_IN_EEPROM 40
|
#define EECONFIG_KEYMAP_IN_EEPROM 41
|
||||||
|
|
||||||
/* define if matrix has ghost */
|
/* define if matrix has ghost */
|
||||||
//#define MATRIX_HAS_GHOST
|
//#define MATRIX_HAS_GHOST
|
||||||
|
102
keyboard/kimera/keymap_two_headed.c
Normal file
102
keyboard/kimera/keymap_two_headed.c
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#include "keymap_common.h"
|
||||||
|
|
||||||
|
// Two-headed
|
||||||
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
|
const uint8_t keymaps[KEYMAPS_COUNT][MATRIX_SIZE] __attribute__ ((section (".keymap.keymaps"))) = {
|
||||||
|
#else
|
||||||
|
const uint8_t keymaps[][MATRIX_SIZE] PROGMEM = {
|
||||||
|
#endif
|
||||||
|
/* Keymap 0: Default Layer
|
||||||
|
* ,----------------------------------------. ,------------------------------------------------.
|
||||||
|
* | ||Esc| | F1| F2| F3| F4| | | F5| F6| F7| F8| | F9|F10|F11|F12||Psc|Slk|Pus|
|
||||||
|
* |---------------||-----------------------| |-----------------------------------||-----------|
|
||||||
|
* |Num| /| *| -|| `| 1| 2| 3| 4| 5| | 6| 7| 8| 9| 0| -| =|Backsp ||Ins|Hom|PgU|
|
||||||
|
* |---------------||-------------------------. `-----------------------------------||-----------|
|
||||||
|
* | 7| 8| 9| ||Tab | Q| W| E| R| T| | Y| U| I| O| P| [| ]| \||Del|End|PgD|
|
||||||
|
* |-----------| +||--------------------------. `---------------------------------||-----------|
|
||||||
|
* | 4| 5| 6| ||Caps | A| S| D| F| G| | H| J| K| L| ;| '|Return || |
|
||||||
|
* |---------------||----------------------------. `-------------------------------|| ,---. |
|
||||||
|
* | 1| 2| 3| ||Shift | Z| X| C| V| B| | N| M| ,| .| /|Shift || |Up | |
|
||||||
|
* |-----------|Ent||----------------------------| |------------------------------||-----------|
|
||||||
|
* | 0| .| ||Ctrl|Gui |Alt | Space | | Space |Alt |Gui |Fn0 |Ctrl||Lef|Dow|Rig|
|
||||||
|
* `---------------------------------------------' `-------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP_16x16(
|
||||||
|
NO, NO, NO, NO, ESC, NO, F1, F2, F3, F4, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NLCK,PSLS,PAST,PMNS,GRV, 1, 2, 3, 4, 5, NO, NO, NO, NO, NO, NO, \
|
||||||
|
P7, P8, P9, PPLS,TAB, Q, W, E, R, T, NO, NO, NO, NO, NO, NO, \
|
||||||
|
P4, P5, P6, NO, CAPS,A, S, D, F, G, NO, NO, NO, NO, NO, NO, \
|
||||||
|
P1, P2, P3, PENT,LSFT,Z, X, C, V, B, NO, NO, NO, NO, NO, NO, \
|
||||||
|
P0, NO, PDOT,NO, LCTL,LGUI,LALT,NO, SPC, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
|
||||||
|
F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,NO, NO, NO, NO, NO, \
|
||||||
|
6, 7, 8, 9, 0, MINS,EQL, BSPC,INS, HOME,PGUP,NO, NO, NO, NO, NO, \
|
||||||
|
Y, U, I, O, P, LBRC,RBRC,BSLS,DEL, END, PGDN,NO, NO, NO, NO, NO, \
|
||||||
|
H, J, K, L, SCLN,QUOT,NO, ENT, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
N, M, COMM,DOT, SLSH,NO, NO, RSFT,NO, UP, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, SPC, NO, RALT,RGUI,FN0, RCTL,NO, LEFT,DOWN,RGHT,NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO ),
|
||||||
|
|
||||||
|
/* Keymap 1: Fn Layer
|
||||||
|
* ,----------------------------------------. ,------------------------------------------------.
|
||||||
|
* | || | | | | | | | | | | | | | | | | ||Fn2|Fn1|Fn3|
|
||||||
|
* |---------------||-----------------------| |-----------------------------------||-----------|
|
||||||
|
* | | | | || | | | | | | | | | | | | | | || | | |
|
||||||
|
* |---------------||-------------------------. `-----------------------------------||-----------|
|
||||||
|
* | | | | || | | | | | | | | | | | | | | || | | |
|
||||||
|
* |-----------| ||--------------------------. `---------------------------------||-----------|
|
||||||
|
* | | | | || | | | | | | | | | | | | | || |
|
||||||
|
* |---------------||----------------------------. `-------------------------------|| ,---. |
|
||||||
|
* | | | | || | | | | | | | | | | | | || | | |
|
||||||
|
* |-----------| ||----------------------------| |------------------------------||-----------|
|
||||||
|
* | | | || | | | | | | | | | || | | |
|
||||||
|
* `---------------------------------------------' `-------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP_16x16(
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, FN2, FN1, FN3, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
|
||||||
|
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO ),
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fn action definition
|
||||||
|
*/
|
||||||
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
|
const uint16_t fn_actions[FN_ACTIONS_COUNT] __attribute__ ((section (".keymap.fn_actions"))) = {
|
||||||
|
#else
|
||||||
|
const uint16_t fn_actions[] PROGMEM = {
|
||||||
|
#endif
|
||||||
|
/* Poker2 Layout */
|
||||||
|
[0] = ACTION_LAYER_MOMENTARY(1),
|
||||||
|
[1] = ACTION_BACKLIGHT_TOGGLE(),
|
||||||
|
[2] = ACTION_BACKLIGHT_DECREASE(),
|
||||||
|
[3] = ACTION_BACKLIGHT_INCREASE(),
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef KEYMAP_IN_EEPROM_ENABLE
|
||||||
|
uint16_t keys_count(void) {
|
||||||
|
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t fn_actions_count(void) {
|
||||||
|
return sizeof(fn_actions) / sizeof(fn_actions[0]);
|
||||||
|
}
|
||||||
|
#endif
|
@ -33,26 +33,45 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
extern uint8_t i2c_force_stop;
|
extern uint8_t i2c_force_stop;
|
||||||
|
|
||||||
uint8_t row_mapping[PX_COUNT] = {
|
uint8_t row_mapping[PX_COUNT] = {
|
||||||
|
#ifndef TWO_HEADED_KIMERA
|
||||||
0, 1, 2, 3, 4, 5, 6, 7,
|
0, 1, 2, 3, 4, 5, 6, 7,
|
||||||
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED,
|
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED,
|
||||||
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED,
|
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED,
|
||||||
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED
|
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED
|
||||||
|
#else
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7,
|
||||||
|
32, 33, 34, 35, 36, 37, 38, 39,
|
||||||
|
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED,
|
||||||
|
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
uint8_t col_mapping[PX_COUNT] = {
|
uint8_t col_mapping[PX_COUNT] = {
|
||||||
|
#ifndef TWO_HEADED_KIMERA
|
||||||
8, 9, 10, 11, 12, 13, 14, 15,
|
8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
16, 17, 18, 19, 20, 21, 22, 23,
|
16, 17, 18, 19, 20, 21, 22, 23,
|
||||||
24, 25, 26, 27, 28, 29, 30, 31,
|
24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED
|
UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED, UNCONFIGURED
|
||||||
|
#else
|
||||||
|
8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
|
16, 17, 18, 19, 20, 21, 22, 23,
|
||||||
|
40, 41, 42, 43, 44, 45, 46, 47,
|
||||||
|
48, 49, 50, 51, 52, 53, 54, 55
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
#ifndef TWO_HEADED_KIMERA
|
||||||
uint8_t row_count = 8;
|
uint8_t row_count = 8;
|
||||||
uint8_t col_count = 24;
|
uint8_t col_count = 24;
|
||||||
|
#else
|
||||||
|
uint8_t row_count = 16;
|
||||||
|
uint8_t col_count = 32;
|
||||||
|
#endif
|
||||||
uint8_t data[EXP_COUNT][EXP_PORT_COUNT];
|
uint8_t data[EXP_COUNT][EXP_PORT_COUNT];
|
||||||
uint8_t exp_status = 0;
|
uint8_t exp_status = 0;
|
||||||
|
|
||||||
void kimera_init(void)
|
void kimera_init(void)
|
||||||
{
|
{
|
||||||
/* read config */
|
/* read config */
|
||||||
write_matrix_mapping(); /* debug */
|
//write_matrix_mapping(); /* debug */
|
||||||
if (read_matrix_mapping()) {
|
if (read_matrix_mapping()) {
|
||||||
write_matrix_mapping();
|
write_matrix_mapping();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
`----------' `----------'
|
`----------' `----------'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef TWO_HEADED_KIMERA
|
||||||
#define EXP_COUNT 2
|
#define EXP_COUNT 2
|
||||||
|
#else
|
||||||
|
#define EXP_COUNT 4
|
||||||
|
#endif
|
||||||
#define EXP_ADDR(n) ((0x20+(n))<<1)
|
#define EXP_ADDR(n) ((0x20+(n))<<1)
|
||||||
#define EXP_OUTPUT 0
|
#define EXP_OUTPUT 0
|
||||||
#define EXP_INPUT 1
|
#define EXP_INPUT 1
|
||||||
|
@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "kimera.h"
|
#include "kimera.h"
|
||||||
|
#include "keymap_in_eeprom.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef DEBOUNCE
|
#ifndef DEBOUNCE
|
||||||
@ -51,7 +52,11 @@ uint8_t matrix_rows(void)
|
|||||||
inline
|
inline
|
||||||
uint8_t matrix_cols(void)
|
uint8_t matrix_cols(void)
|
||||||
{
|
{
|
||||||
|
#ifndef TWO_HEADED_KIMERA
|
||||||
return col_count;
|
return col_count;
|
||||||
|
#else
|
||||||
|
return col_count / 2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_init(void)
|
void matrix_init(void)
|
||||||
@ -82,7 +87,17 @@ uint8_t matrix_scan(void)
|
|||||||
for (uint8_t i = 0; i < matrix_rows(); i++) {
|
for (uint8_t i = 0; i < matrix_rows(); i++) {
|
||||||
select_row(i);
|
select_row(i);
|
||||||
_delay_us(30); // without this wait read unstable value.
|
_delay_us(30); // without this wait read unstable value.
|
||||||
|
#ifndef TWO_HEADED_KIMERA
|
||||||
matrix_row_t cols = read_cols();
|
matrix_row_t cols = read_cols();
|
||||||
|
#else
|
||||||
|
matrix_row_t cols = read_cols();
|
||||||
|
if (i < 8) {
|
||||||
|
cols &= 0xFFFFUL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cols >>= 16;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (matrix_debouncing[i] != cols) {
|
if (matrix_debouncing[i] != cols) {
|
||||||
matrix_debouncing[i] = cols;
|
matrix_debouncing[i] = cols;
|
||||||
if (debouncing) {
|
if (debouncing) {
|
||||||
|
Reference in New Issue
Block a user