1
0
Fork 0

Merge branch 'qmk/master'

This commit is contained in:
Gabriel Young 2017-02-19 14:34:58 -08:00
commit 40a8a88e72
49 changed files with 1471 additions and 1537 deletions

View file

@ -161,18 +161,26 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio/luts.c
endif
ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
OPT_DEFS += -DFAUXCLICKY_ENABLE
SRC += $(QUANTUM_DIR)/fauxclicky.c
endif
ifeq ($(strip $(UCIS_ENABLE)), yes)
OPT_DEFS += -DUCIS_ENABLE
UNICODE_ENABLE = yes
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
endif
ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
OPT_DEFS += -DUNICODEMAP_ENABLE
UNICODE_ENABLE = yes
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
endif
ifeq ($(strip $(UNICODE_ENABLE)), yes)
OPT_DEFS += -DUNICODE_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
endif

View file

@ -312,6 +312,8 @@ uint16_t hex_to_keycode(uint8_t hex)
return NEO_E;
case 0xF:
return NEO_F;
default:
return KC_NO;
}
}
}

View file

@ -9,6 +9,7 @@
#define SYMB 1 // symbols layer
#define MDIA 2 // media layer
#define SPEC 3 // special layer
#define RBASE 4 // reverse default layer
#define LSymb 10 // left symbol-shift key
#define LMdia 11 // left media-shift key
@ -17,15 +18,23 @@
#define RMdia 14 // right media-shift key
#define RSpec 15 // right special-shift key
#define NotEq 16 // != macro
#define GrtEq 17 // >= macro
#define LesEq 18 // <= macro
#define DeRef 19 // -> macro
#define MUL 20 // mouse up left
#define MUR 21 // mouse up right
#define MDL 22 // mouse down left
#define MDR 23 // mouse down right
/*
* The Ordinary Layout for the Ergodox EZ keyboard, v4.20
* The Ordinary Layout for the Ergodox EZ keyboard, v5
*
* Modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com
* Modifications from the default Ergodox EZ layout
* by Nicholas Keene ergodoxez@nicholaskeene.com
*
* No rights reserved. This software is in the public domain.
* Credit me if you are friendly but if you're a jerk don't bother.
@ -44,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------------+------+------+------+------+-------------| |------+------+------+------+------+------+------------|
* | Media Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \| Media |
* |------------+------+------+------+------+------| | | |------+------+------+------+------+------------|
* | Symbol | A | S | D | F | G |------| |------| H | J | K | L | ; | '" Symbol |
* | Symbol | ^A | S | D | ^F | G |------| |------| H | ^J | K | L | ^; | '" Symbol |
* |------------+------+------+------+------+------|Shift | | Tab |------+------+------+------+------+------------|
* | Capitals | Z | X | C | V | B | -Tab | | | N | M | , | . | / | Capitals |
* `------------+------+------+------+------+-------------' `-------------+------+------+------+------+------------'
@ -60,24 +69,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[BASE] = KEYMAP(
// left hand
F(LSpec) ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,F(LMdia) ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,M(LSymb) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
,KC_LCTL ,KC_MEH ,KC_HYPR,KC_LALT,KC_LGUI
F(LSpec) ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,F(LMdia) ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,M(LSymb) ,LT(RBASE, KC_A),KC_S ,KC_D ,LT(RBASE, KC_F) ,KC_G
,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
,KC_LCTL ,MEH_T(KC_NO) ,ALL_T(KC_NO),KC_LALT,KC_LGUI
,KC_HOME,KC_END
,KC_PGUP
,KC_BSPC,KC_DEL ,KC_PGDN
// right hand
,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec)
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia)
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,F(RSymb)
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
,KC_RGUI,KC_RALT,KC_HYPR ,KC_MEH ,KC_RCTL
,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec)
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia)
,KC_H ,LT(RBASE, KC_J),KC_K ,KC_L ,LT(RBASE,KC_SCLN),F(RSymb)
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
,KC_RGUI ,KC_RALT,KC_HYPR,KC_MEH ,KC_RCTL
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_DOWN ,KC_ENT ,KC_SPC
),
),
/******* Symbols Layer *************************************************************************************************
*
@ -87,52 +96,52 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | |
* |-----------+------+------+------+------+------| Tab | | Shift|------+------+------+------+------+-----------|
* | | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | |
* |-----------+------+------+------+------+------| ' | | " |------+------+------+------+------+-----------|
* | | % | ^ | [ | ] | ~ | | | | \ | 1 | 2 | 3 | - | |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | LCtrl | Meh |Hyper | LAlt | LGui | | 0 | . | = | + | Ent |
* | ; | & | * | < | > | | 0 | . | = | + | Enter |
* `-----------------------------------' `-----------------------------------'
* ,-------------. ,-------------.
* | Left | Right| | Home | End |
* | |||| | |||| | | |||| | |||| |
* ,------|------|------| |------+------+------.
* | | | Up | | PgUp | | |
* |Space |Enter |------| |------|BackSp| Del |
* | | | Down | | PgDn | | |
* | Plus | Equal| |||| | | |||| | Under| Dash |
* | | |------| |------| Score| |
* | + | = | != | | -> | _ | - |
* `--------------------' `--------------------'
*/
[SYMB] = KEYMAP(
// left hand
KC_TRNS ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_ESC
,KC_TRNS ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,KC_TRNS ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,KC_TRNS ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_TAB
,KC_LCTL ,KC_MEH ,KC_HYPR ,KC_LALT ,KC_LGUI
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_SPC ,KC_ENT ,KC_DOWN
KC_TRNS ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_ESC
,KC_TRNS ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,KC_TRNS ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,KC_TRNS ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_QUOT
,KC_SCLN ,KC_AMPR ,KC_ASTR ,LSFT(KC_COMM),LSFT(KC_DOT)
,M(GrtEq),M(LesEq)
,KC_NO
,KC_PLUS ,KC_EQL ,M(NotEq)
// right hand
,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_TRNS
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,KC_TRNS
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,KC_TRNS
,LSFT(KC_TAB),KC_BSLS ,KC_1 ,KC_2 ,KC_3 ,KC_MINS ,KC_TRNS
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,KC_HOME ,KC_END
,KC_PGUP
,KC_PGDN ,KC_BSPC ,KC_DEL
,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_TRNS
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,KC_TRNS
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,KC_TRNS
,LSFT(KC_QUOT),KC_BSLS ,KC_1 ,KC_2 ,KC_3 ,KC_MINS ,KC_TRNS
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,KC_NO ,KC_NO
,KC_NO
,M(DeRef) ,LSFT(KC_MINS),KC_MINS
),
/******* Media Layer *******************************************************************************************************
*
* ,---------------------------------------------------------------. ,---------------------------------------------------------------.
* | | F11 | F12 | F13 | F14 | F15 | Esc | | | F16 | F17 | F18 | F19 | F20 | |
* | | F11 | F12 | F13 | F14 | F15 | Esc | | |||| | F16 | F17 | F18 | F19 | F20 | |
* |------+---------+---------+---------+---------+----------------| |------+---------+---------+---------+---------+---------+------|
* | |Shut Down|MouseUpLf|Mouse Up |MouseUpRg|Volume Up|Scroll| |Scroll|PrintScrn| Home | Up | PgUp | Mail | |
* |------+---------+---------+---------+---------+---------| Up | | Up |---------+---------+---------+---------+---------+------|
* | | Sleep |MouseLeft|MouseDown|MouseRght|Volume Dn|------| |------| Num Lock| Left | Down | Right | MyComp | |
* |------+---------+---------+---------+---------+---------|Scroll| |Scroll|---------+---------+---------+---------+---------+------|
* | | |MouseDnLf|MouseDown|MouseDnRg| Mute | Down | | Down | | End | Down | PgDn | | |
* | | |||| |MouseDnLf|MouseDown|MouseDnRg| Mute | Down | | Down | |||| | End | Down | PgDn | |||| | |
* `------+---------+---------+---------+---------+----------------' `----------------+---------+---------+---------+---------+------'
* |LCtrl| Meh | MClick | LClick | R Click| |Cmd/Insrt|Optn/Del | Hyper | Meh |RCtrl|
* | ||| | |||| | MClick | LClick | R Click| | Insert | Del | |||| | |||| | ||| |
* `---------------------------------------------' `---------------------------------------------'
* ,-------------. ,-------------.
* | Stop |Refrsh| | Prev | Next |
@ -148,7 +157,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_TRNS ,KC_POWER ,M(MUL) ,KC_MS_U ,M(MUR) ,KC_VOLU ,KC_WH_U
,KC_TRNS ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD
,KC_TRNS ,KC_NO ,M(MDL) ,KC_MS_D ,M(MDR) ,KC_MUTE ,KC_WH_D
,KC_LCTL ,KC_MEH ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
,KC_NO ,KC_NO ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
,KC_WSTP ,KC_WREF
,KC_WSCH
,KC_WBAK ,KC_NO ,KC_WHOM
@ -157,7 +166,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_WH_U ,KC_PSCR ,KC_HOME ,KC_UP ,KC_PGUP ,KC_MAIL ,KC_TRNS
,KC_NLCK ,KC_LEFT ,KC_DOWN ,KC_RIGHT,KC_MYCM ,KC_TRNS
,KC_WH_D ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,KC_NO ,KC_TRNS
,GUI_T(KC_INS),ALT_T(KC_DEL),KC_HYPR ,KC_MEH ,KC_RCTL
,KC_INS ,KC_DEL ,KC_NO ,KC_NO ,KC_NO
,KC_MPRV ,KC_MNXT
,KC_VOLU
,KC_VOLD ,KC_MSTP ,KC_MPLY
@ -203,7 +212,49 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
)
),
/******* Reverse Base Layer *********************************************************************************************
*
* ,------------------------------------------------------. ,------------------------------------------------------.
* | =+ | 0 | 9 | 8 | 7 | 6 | - | | Esc | 5 | 4 | 3 | 2 | 1 | `~ |
* |------------+------+------+------+------+-------------| |------+------+------+------+------+------+------------|
* | \| | P | O | I | U | Y | ] | | [ | T | R | E | W | Q | Tab |
* |------------+------+------+------+------+------| | | |------+------+------+------+------+------------|
* | '" | ; | L | K | J | H |------| |------| G | F | D | S | A | |
* |------------+------+------+------+------+------| Tab | |Shift |------+------+------+------+------+------------|
* | Capitals | / | . | , | M | N | | | -Tab | B | V | C | X | Z | Capitals |
* `------------+------+------+------+------+-------------' `-------------+------+------+------+------+------------'
* | LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh | RCtrl |
* `-----------------------------------' `-----------------------------------'
* ,-------------. ,-------------.
* | Left | Right| | Home | End |
* ,------|------|------| |------+------+------.
* | | | Up | | PgUp | | |
* |Space |Enter |------| |------|BackSp| Del |
* | | | Down | | PgDn | | |
* `--------------------' `--------------------'
*/
[RBASE] = KEYMAP(
// left hand
KC_EQL ,KC_0 ,KC_9 ,KC_8 ,KC_7 ,KC_6 ,KC_MINS
,KC_BSLS ,KC_P ,KC_O ,KC_I ,KC_U ,KC_Y ,KC_RBRC
,KC_QUOT ,LT(RBASE, KC_SCLN) ,KC_L ,KC_K ,LT(RBASE, KC_J) ,KC_H
,KC_RSFT ,KC_SLSH ,KC_DOT ,KC_COMM,KC_M ,KC_N ,KC_TAB
,KC_RCTL ,MEH_T(KC_NO),ALL_T(KC_NO),KC_RALT,KC_RGUI
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_SPC ,KC_ENT ,KC_DOWN
// right hand
,KC_ESC ,KC_5 ,KC_4 ,KC_3 ,KC_2 ,KC_1 ,KC_GRV
,KC_LBRC ,KC_T ,KC_R ,KC_E ,KC_W ,KC_Q ,KC_TAB
,KC_G ,LT(RBASE, KC_F),KC_D ,KC_S ,LT(RBASE, KC_A) ,KC_NO
,LSFT(KC_TAB),KC_B ,KC_V ,KC_C ,KC_X ,KC_Z ,KC_LSFT
,KC_LGUI,KC_LALT,KC_HYPR ,KC_MEH,KC_LCTL
,KC_HOME ,KC_END
,KC_PGUP
,KC_PGDN ,KC_BSPC ,KC_DEL
)
};
const uint16_t PROGMEM fn_actions[] = {
@ -227,14 +278,13 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
// There are two shift keys for each layer so we increment a layer_shift var when one
// is pressed and decrement when one is released. If both are pressed at the same time
// then the layer is locked (or unlocked). The shift counts are bound between 0 and 2
// is pressed and decrement when one is released. The shift counts are bound between 0 and 2
// only because sometimes rapid pressing led to irregular events; this way the states
// are self healing during use.
case LSymb: //
if (record->event.pressed) { // when the LSymb button is pressed
if(++symb_shift > 2) mdia_shift = 2; // increment the symb shift count, max two
if(++symb_shift > 2) symb_shift = 2; // increment the symb shift count, max two
if(spec_shift) symb_lock = !symb_lock; // if the Special layer is on, toggle the shift lock
layer_on(SYMB); // in any case, turn on the Symbols layer
} else { // when the LSymb button is released
@ -264,7 +314,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
case LSpec:
if (record->event.pressed) { // when the LSpec button is pressed
if(symb_shift) symb_lock == !symb_lock; // if another layer button is engaged, then
if(symb_shift) symb_lock = !symb_lock; // if another layer button is engaged, then
else if(mdia_shift) mdia_lock = !mdia_lock; // lock that layer, be it caps or symb or mdia
else if (record->tap.count && !record->tap.interrupted && (!spec_shift)) {
register_code(KC_GRV); // otherwise, if it's an uninterrupted tap, emit a char
@ -340,6 +390,30 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
}
break;
case NotEq:
if (record->event.pressed) {
return MACRO( I(10), D(LSFT), T(EXLM), U(LSFT), T(EQL), END ); // !=
}
break;
case GrtEq:
if (record->event.pressed) {
return MACRO( I(10), D(LSFT), T(COMM), U(LSFT), T(EQL), END ); // <=
}
break;
case LesEq:
if (record->event.pressed) {
return MACRO( I(10), D(LSFT), T(DOT), U(LSFT), T(EQL), END ); // >=
}
break;
case DeRef:
if (record->event.pressed) {
return MACRO( I(10), T(MINS), D(LSFT), T(DOT), U(LSFT), END ); // ->
}
break;
// mouse diagonals
case MUL: // mouse up left

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View file

@ -7,10 +7,10 @@
[{y:-0.875,x:5.5},"T",{h:1.5},"{\n\n\n\n\n\n[",{x:4.5,h:1.5},"}\n\n\n\n\n\n]","Y"],
[{y:-0.875,c:"#c6c600",t:"#002299",w:1.5},"Media\n\nTab\n\n\n\nShift",{c:"#cccccc",t:"#000000"},"Q",{x:14.5},"P",{c:"#c6c600",t:"#002299",w:1.5},"|\n\\\nMedia\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#cccccc",t:"#000000"},"D",{x:10.5},"K"],
[{y:-0.875,x:2.5},"S",{x:1},"F",{x:8.5},"J",{x:1},"L"],
[{y:-0.875,x:2.5},"S",{x:1,fa:[0,0,0,1]},"F\n\n\nreverse",{x:8.5},"J\n\n\nreverse",{x:1},"L"],
[{y:-0.875,x:5.5},"G",{x:6.5},"H"],
[{y:-0.875,c:"#c6c600",t:"#007d00",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#cccccc",t:"#000000"},"A",{x:14.5},":\n;",{c:"#c6c600",t:"#007d00",w:1.5},"\"\n'\nSymbols\n\n\n\n\nShift"],
[{y:-0.625,x:6.5,c:"#ff8500",t:"#000000",fa:[0,0,0,1],h:1.5},"< Tab\n\n\nShift Tab",{x:4.5,h:1.5},"Tab >\n\n\nTab"],
[{y:-0.875,c:"#c6c600",t:"#007d00",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#cccccc",t:"#000000"},"A\n\n\nreverse",{x:14.5},":\n;\n\nreverse",{c:"#c6c600",t:"#007d00",w:1.5},"\"\n'\nSymbols\n\n\n\n\nShift"],
[{y:-0.625,x:6.5,c:"#ff8500",t:"#000000",h:1.5},"< Tab\n\n\nShift Tab",{x:4.5,h:1.5},"Tab >\n\n\nTab"],
[{y:-0.75,x:3.5,c:"#cccccc"},"C",{x:10.5},"<\n,"],
[{y:-0.875,x:2.5},"X",{x:1},"V",{x:8.5},"M",{x:1},">\n."],
[{y:-0.875,x:5.5},"B",{x:6.5},"N"],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View file

@ -15,10 +15,10 @@
[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nDnLeft",{x:1},"Mouse\n\n\n\n\n\nDnRgt",{x:8.5,c:"#1e8fff"},"End",{x:1},"Page\n\n\n\n\n\nDown"],
[{y:-0.875,x:5.5,c:"#9977ee"},"Mute",{x:6.5,c:"#737373",a:7},""],
[{y:-0.875,c:"#c6c600",t:"#9e0000",a:4,w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#737373",t:"#000000",a:7},"",{x:14.5},"",{c:"#c6c600",t:"#9e0000",a:4,w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#0066cc",t:"#000000"},"Middle\n\n\n\n\n\nClick",{x:10.5,c:"#1e8fff",fa:[0,0,0,1]},"Delete\n\n\nOption"],
[{y:-0.875,x:2.5,c:"#0066cc"},"Left\n\n\n\n\n\nClick",{x:1},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#1e8fff"},"Insert\n\n\nCmd",{x:1,c:"#dddd77"},"Hyper"],
[{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Crtl\n\n\nRCtrl"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#6633ee"},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"],
[{y:-0.375,x:3.5,c:"#0066cc",t:"#000000"},"Middle\n\n\n\n\n\nClick",{x:10.5,c:"#1e8fff"},"Delete"],
[{y:-0.875,x:2.5,c:"#0066cc"},"Left\n\n\n\n\n\nClick",{x:1},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#1e8fff"},"Insert",{x:1,c:"#737373",a:7},""],
[{y:-0.75,x:0.5},"","",{x:14.5},"",""],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#6633ee",a:4,fa:[0,0,0,1]},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"],
[{h:2},"< Web\n\n\nBrowser",{h:2},"Web >\n\n\nBrowser","Search\n\n\nBrowser"],
[{x:2},"Home\n\n\nBrowser"],
[{r:-30,rx:13,y:-1,x:-3},"Prev\n\n\nAudio\n\n\nTrack","Next\n\n\nAudio\n\n\nTrack"],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View file

@ -10,18 +10,18 @@
[{y:-0.875,x:2.5,c:"#bbddbb"},"$",{x:1},")",{x:8.5,c:"#89b087"},"4",{x:1},"6"],
[{y:-0.875,x:5.5,c:"#bbddbb"},"`",{x:6.5},"/"],
[{y:-0.875,c:"#000000",t:"#007d00",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#bbddbb",t:"#000000"},"#",{x:14.5,c:"#89b087"},"*",{c:"#000000",t:"#007d00",w:1.5},"\n\nSymbols\n\n\n\n\nShift"],
[{y:-0.625,x:6.5,c:"#ff8500",t:"#000000",fa:[0,0,0,1],h:1.5},"Tab >\n\n\nTab",{x:4.5,h:1.5},"< Tab\n\n\nShift Tab"],
[{y:-0.75,x:3.5,c:"#bbddbb"},"[",{x:10.5,c:"#89b087"},"2"],
[{y:-0.625,x:6.5,c:"#bbddbb",t:"#000000",a:6,h:1.5},"'",{x:4.5,h:1.5},"\""],
[{y:-0.75,x:3.5,a:4},"[",{x:10.5,c:"#89b087"},"2"],
[{y:-0.875,x:2.5,c:"#bbddbb"},"^",{x:1},"]",{x:8.5,c:"#89b087"},"1",{x:1},"3"],
[{y:-0.875,x:5.5,c:"#bbddbb"},"~",{x:6.5},"\\"],
[{y:-0.875,c:"#c6c600",t:"#9e0000",w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#bbddbb",t:"#000000"},"%",{x:14.5,c:"#89b087"},"-",{c:"#c6c600",t:"#9e0000",w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#dddd77",t:"#000000"},"Option\n\n\nLAlt",{x:10.5,c:"#89b087"},"."],
[{y:-0.875,x:2.5,c:"#dddd77"},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5,c:"#89b087"},"0",{x:1},"="],
[{y:-0.75,x:0.5,c:"#dddd77"},"Ctrl\n\n\nLCtrl","Meh",{x:14.5,c:"#89b087"},"+","Enter"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#ff8500"},"Left","Right"],
[{h:2},"Space",{h:2},"Enter","Up"],
[{x:2},"Down"],
[{r:-30,rx:13,y:-1,x:-3},"Home","End"],
[{x:-3},"Page\n\n\n\n\n\nUp",{h:2},"< Del\n\n\nBackspace",{h:2},"Del >\n\n\nDelete"],
[{x:-3},"Page\n\n\n\n\n\nDown"]
[{y:-0.375,x:3.5,c:"#bbddbb",t:"#000000"},"<",{x:10.5,c:"#89b087"},"."],
[{y:-0.875,x:2.5,c:"#bbddbb"},"*",{x:1},">",{x:8.5,c:"#89b087"},"0",{x:1},"="],
[{y:-0.75,x:0.5,c:"#bbddbb"},";","&",{x:14.5,c:"#89b087"},"+","Enter"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#bbddbb"},"<=",">="],
[{a:7,h:2},"+",{h:2},"=",{c:"#737373"},""],
[{x:2,c:"#bbddbb",a:4},"!="],
[{r:-30,rx:13,y:-1,x:-3,c:"#737373",a:7},"",""],
[{x:-3},"",{c:"#bbddbb",h:2},"_",{h:2},"-"],
[{x:-3,a:4},"->"]

View file

@ -10,12 +10,13 @@ no rights reserved, use for any purposes, credit me if you are a nice person
## The Base Layout ##
* *White Keys* are all the normal characters and symbols in all the normal locations (except for the brackets).
* *Modifier Keys* are light yellow and in the traditional location: Control, Option, Command, plus Hyper and Meh.
* *Shift Keys* are dark yellow, found on the outsides of the keyboard. Capitals Shift (traditional shift) is found in the usual place and above that is found Symbol Shift, Media Shift, and Special Shift (Shift Lock).
* *White Keys* are all the normal characters and symbols in all the normal locations (except for the brackets, and who touch-types brackets?).
* *Modifier Keys* are light yellow and in the traditional locationn at the bottom of the keyboard: Control, Option, Command, plus Hyper and Meh. Modifier keys are only found on the base layout.
* *Shift Keys* are dark yellow, found on the outsides of the keyboard. Capitals Shift (traditional Shift) is found in the usual place and above that are Symbol Shift, Media Shift, and Special Shift (Shift Lock).
* Several of the shift keys double for entry of characters which would typically be in those locations.
* *Thumb Keys* shown in orange are for text navigation and manipulation.
* *Escape* is red and it is always found in that location no matter what.
* The keys under pinky fingers and index fingers will *reverse* the keyboard layout.
* *Escape* is red and it is always found in that location (*except* when the layout is reversed).
![Ordinary base layout](ordinary-base.png)
@ -23,12 +24,16 @@ The four big orange keys are arranged differently than in the default Ergodox EZ
The Forward Tab and Backward Tab keys are in their locations mostly because I ended up with two extra buttons and needed something to do with them. My muscle memory from using the Truly Ergonomic Keyboard makes me look for the Tab key with my right index finger, so it is handy to have this redundant Tab, and the idea with the Backward Tab key is that it becomes easy to navigate text fields in forms, or to indent/unindent code.
#### Reversing The Base Layout ####
The Ordinary Layout can be used to perform one-handed chorded text input. If you hold down the key under either index finger or either pinky finger (A, F, J and Semicolon), the whole base layout reverses order. Most keys are _mirrored_ but the delete keys, home/end, and left/right arrow keys are merely *translated* to preserve directionality. Pro-tip: This feature is particularly handly for bringing the Enter key to the left hand when the right hand is using the mouse.
## The Symbols Layer ##
* *Symbols* shown in light green. All kinds of brackets are available on this layer. Ampersand and Pipe justapose each other. Pipe, slash, and backslash are arranged in a column.
* *F-Keys* are bright green and overlay the row of numerals.
* *Symbols* shown in light green. All kinds of brackets are available on this layer. Ampersand and Pipe juxtapose each other. Pipe, slash, and backslash are arranged in a column.
* *F-Keys* are bright green and overlay the row of numerals. This layer has F1-F10, higher *F-Keys* are on the Symbols layer.
* *Number pad* in dark green under the right hand includes all four arithmetic operations in the same order found on most number pads and features an Enter key. The keycodes emitted here are normal numeric keycodes, not the number-pad specific keycodes emitted by most number pads so that NumLock is not needed.
* *Thumb keys* on this layer are the *reverse* of the orange keys on the base layer, with the keys either mirrored or shifted. This is powerful! Often I find myself using the mouse with my right hand, and the left hand needs to press Enter. Instead of reaching the left hand over to the right side of the keyboard, now I simply tap Symbols to reverse the turquoise keys, and Enter is right where it should be.
* The dark gray keys do nothing in case you bump them by accident.
![Ordinary symbol layout](ordinary-symbol.png)
@ -42,7 +47,7 @@ The Symbols Layer is based on the Coder Layer from the default Ergodox EZ layout
* Higher-order *F-Keys* are shown in bright green overylaying the numerals.
* *Application Keys* to control web browsers and audio players are dark purple but don't get too excited because these have weak support on operating systems I've looked at. Good luck.
* The light purple keys are various operating system keys such as NumLock and Mute and a button to navigate to My Computer (usually your home dir).
* The dark gray keys do nothing in case you bump them by accident
* The dark gray keys do nothing in case you bump them by accident.
![Ordinary media layout](ordinary-media.png)
@ -64,27 +69,33 @@ Multiple layers can be turned on at once. The Capitals layer will affect charact
The Special Shift layer is mostly used to lock the shift keys but in order to make this layout more _ordinary_ there are a few special sequences which put some keys near their most common traditional locations.
### Escape ###
#### Escape ####
The One True Location for the Escape key is segregated way up on the top left of the keyboard. The Ergodox does not have a physical button in such a location and the nearest one is home to the tilde (er, grave) which is commonly found there. In the Ordinary layout the Escape key is found on all layers in the prominent location in the corner next to the 5, which is easy to remember, and yet it isn't natural for those of us with muscle memory flicking our wrists up and to the left looking for Escape.
The One True Location for an Escape key is separated from the rest of the keys, way up on the top left of the keyboard. The Ergodox does not have a physical button in such a location, however, and the nearest one is home to the tilde (er, *grave*) which is commonly found there. In the Ordinary layout the Escape key is found on all layers in the prominent location in the corner next to the 5, which is easy to remember, and yet it isn't natural for those of us with muscle memory flicking our wrists up and to the left looking for Escape.
The Ordinary layout offers as a consolation prize a Special sequence for Escape: Special Shift + 1. This is natural so you can tap the top left button, then the button next to it and get Escape. This gesture works in all layers.
The Ordinary layout offers as a consolation prize, a Special sequence for Escape: **Special Shift + 1**. This is natural so you can tap the top left button, then the button next to it and get Escape. This gesture works in all layers.
### Backspace ###
#### Backspace ####
At the top right corner of the Ergodox EZ you can a gesture similar to the special Escape sequence using the 0 key to produce a Backspace. Users of this keyboard and this layout are well advised to learn to use their thumbs for deleting text, but sometimes you are doing other computery things and just want to flick your digits up to the right and press backspace a bunch times.
At the top right corner of the Ergodox EZ you can do **Special Shift + 0** to produce a Backspace. Users of this keyboard and this layout are well advised to learn to use their thumbs for deleting text, but sometimes you are doing other computery things and just want to flick your digits up to the right and press backspace a bunch times.
### Other Characters ###
#### Other Characters ####
The Escape and Backspace special sequences are so useful why not have a few more? You can find dash under 9, left bracket under o, and right bracket under p. That's pretty much all the characters from the top right corner of the keyboard which moved to make room for the columnar layout.
## Errata ##
Some of the symbols on the Symbols layer are produced by the keyboard by "capitalizing" another character (such as *!* from *1*) so when you type that key you will notice the Capitals Shift red LED turn on.
****
The Ordinary Layout for the Ergodox EZ keyboard, v4.20
The Ordinary Layout for the Ergodox EZ keyboard, v5
Modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com
No rights reserved. This software is in the public domain. Credit me if you are friendly but if you're a jerk don't bother.
Keyboard layout images were created with http://www.keyboard-layout-editor.com/ by Ian Prest my thanks to that free service
Details: readme.md
https://github.com/nrrkeene/qmk_firmware/tree/master/keyboards/ergodox/keymaps/ordinary

View file

@ -205,6 +205,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
__attribute__ ((unused))
uint32_t layer0 = layer_state & (1UL << 0),
layer1 = layer_state & (1UL << 1),
layer2 = layer_state & (1UL << 2),

View file

@ -1,14 +1,24 @@
#include "gonnerd.h"
// Keymap layers
#define __x__ KC_NO
// Keymap layers
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP_60( /* Base */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC,\
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS,\
KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NO, KC_ENT, \
KC_LSFT,KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT,KC_NO, \
KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,MO(1), KC_RCTL),
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, __x__, KC_ENT, \
KC_LSFT, __x__, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, __x__, \
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(1), KC_RCTL \
),
[1] = KEYMAP_60( /* System layer to have access to RESET button */
RESET, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
__x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
__x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
__x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
__x__, __x__, __x__, __x__, __x__, __x__, KC_TRNS, __x__ \
),
};
const uint16_t PROGMEM fn_actions[] = {

View file

@ -23,11 +23,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------'
*/
[BASE_LAYER] = KEYMAP_60(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, __x__, KC_ENT, \
KC_LSFT, __x__, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, __x__, \
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, MO(3), KC_RCTL \
MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, __x__, KC_ENT, \
KC_LSFT, __x__, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, __x__, \
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, MO(2), KC_RCTL \
),
/* Layer 1: Function Layer
@ -45,10 +45,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[FUNCTION_LAYER] = KEYMAP_60(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \
__x__, KC_MPRV, KC_MPLY, KC_MNXT, __x__, __x__, KC_PGUP, KC_HOME, KC_UP, KC_END, __x__, KC_SLCK, KC_PAUS, __x__, \
KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, __x__, __x__, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, __x__, __x__, __x__, __x__, \
KC_LSFT, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, __x__, __x__, __x__, __x__ \
__x__, KC_MPRV, KC_MPLY, KC_MNXT, __x__, __x__, KC_PGUP, KC_HOME, KC_UP, KC_END, __x__, KC_SLCK, KC_PAUS, __x__, \
KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, __x__, __x__, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, __x__, __x__, __x__, __x__, \
KC_LSFT, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, __x__, __x__, __x__, __x__ \
),
/* Layer 2: System Layer
@ -69,10 +69,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
__x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
__x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
__x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, __x__, \
__x__, __x__, __x__, __x__, __x__, __x__, KC_TRNS, __x__ \
__x__, __x__, __x__, __x__, __x__, __x__, KC_TRNS, __x__ \
),
};
const uint16_t PROGMEM fn_actions[] = {
enum function_id {
ESC_GRV, // Makes Esc behave like `~ when pressed with the left GUI modifier. This is the "switch between windows of the same application" key combination in macOS
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(ESC_GRV),
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
static uint8_t esc_grv_mask;
switch (id) {
case ESC_GRV:
esc_grv_mask = get_mods() & MOD_BIT(KC_LGUI);
if (record->event.pressed) {
if (esc_grv_mask) {
add_key(KC_GRV);
send_keyboard_report();
} else {
add_key(KC_ESC);
send_keyboard_report();
}
} else {
if (esc_grv_mask) {
del_key(KC_GRV);
send_keyboard_report();
} else {
del_key(KC_ESC);
send_keyboard_report();
}
}
break;
}
}

View file

@ -11,6 +11,10 @@ It is possible to change the bootloader of the GON NerD with an ISP programmer.
_After changing the bootloader on your GON NerD PCB you will not be able to go back to the original firmware and the official configuration software will
not work anymore. You will lose your warranty and official support from GON!_
## Reset button
To run the `make dfu` command to flash keymaps onto the board, you need to put the board into DFU mode. As the GON NerD PCBs do not have a reset button on the board to put it into DFU mode, be sure to include a `RESET` button on your keymap. Otherwise you'll have to unscrew your keyboard from the case and short the GND and RST pins.
## Building
Download or clone the whole firmware and navigate to the keyboards/gonnerd folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file.

View file

@ -152,6 +152,110 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#define PS2_INIT_DELAY 2000
#define BATTERY_PIN 9
#define BATTERY_POLL 30000
#define MAX_VOLTAGE 4.2
#define MIN_VOLTAGE 3.2
#define KEYMAP( \
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
) \
{ \
{k11, k12, k13, k14, k15, k16}, \
{k21, k22, k23, k24, k25, k26}, \
{k31, k32, k33, k34, k35, k36}, \
{k41, k42, k43, k44, k45, k46}, \
{k17, k18, k19, k1a, k1b, k1c}, \
{k27, k28, k29, k2a, k2b, k2c}, \
{k37, k38, k39, k3a, k3b, k3c}, \
{k47, k48, k49, k4a, k4b, k4c} \
}
#ifndef __ASSEMBLER__ // assembler doesn't like enum in .h file
enum led_sequence {
LED_IND_BLUETOOTH,
LED_IND_USB,
LED_IND_BATTERY,
LED_IND_FUN,
LED_IND_NUM,
LED_IND_EMOJI,
LED_BKSP,
LED_ENT,
LED_RSFT,
LED_RCTL,
LED_RGUI,
LED_SLSH,
LED_SCLN,
LED_P,
LED_O,
LED_L,
LED_DOT,
LED_RALT,
LED_EMOJI,
LED_COMM,
LED_K,
LED_I,
LED_U,
LED_J,
LED_M,
LED_FUN,
LED_RSPC,
LED_N,
LED_HH,
LED_Y,
LED_TRACKPOINT3,
LED_TRACKPOINT2,
LED_TRACKPOINT1,
LED_LSPC,
LED_B,
LED_G,
LED_T,
LED_R,
LED_F,
LED_V,
LED_NUM,
LED_PUNC,
LED_C,
LED_D,
LED_E,
LED_W,
LED_S,
LED_X,
LED_LALT,
LED_LGUI,
LED_Z,
LED_A,
LED_Q,
LED_TAB,
LED_ESC,
LED_LSFT,
LED_LCTL,
LED_TOTAL
};
#define RGB_DI_PIN B5
#define RGBSPS_NUM LED_TOTAL
#endif
/* PS/2 mouse */
#ifdef PS2_USE_BUSYWAIT
# define PS2_CLOCK_PORT PORTD

View file

@ -0,0 +1,44 @@
Priyadi Keymap for Planck-like Keyboards
========================================
Main layer modifications from default Planck layout:
* Enter moved to quotes position
* Quotes moved to semicolon position.
* QWERTZ style colon & semicolon. shift-. = : shift-, = ; This is done in hardware, no layout switching needed in software.
* < & > occupied precious real estate, and so they are moved down to punctuation layer.
* Right-shift on Enter position.
* Removed arrow keys, they are on another layer now.
* Put Ctrl-Alt-Super and Super-AltGr-Ctrl in left & right corners.
* Lower & Raise is now called Num and Fun.
* OS & Left keys become another thumb modifier: Empty & Greek (Empty because I used this for another use and my muscle memory is not adapted to it yet)
On Promethium, Trackpoint is enabled on PD2 and PD2. We impersonate a Thinkpad keyboard to be able to use Thinkpad driver on Windows (still needs verification).
AltGr & Compose dual use key. Tap for Compose (mapped to Scroll Lock in hardware) and press for AltGr.
Supported layouts: QWERTY, DVORAK, Colemak, Workman, Norman. Switchable from SYS layer. In DVORAK, semicolon is replaced by /? key.
Num activates NUM layer: hexkeypad on the right side and most punctuation on the left side. Hexkeypad is optimized for C-style hex, IPv6, HTML RGB triplets, etc.
Fun activates FUN layer: arrow cluster on right home row, F-numbers on left side.
Pressing Num+Fun activates PUNC layer: same punctuations as NUM layer on the left side, parens on the right side.
Greek activates either GREEKU or GREEKL layer, depending whether shift is pressed or not. Shift state changes are also taken into account when the layer is active.
Greek+Empty activates EMOJI layer. The whole keyboard now outputs emojis!
Pressing both spacebars (spacekeys, actually) activates GUI layer. QWERTYUIOP switches to a virtual desktop. J & L switches virtual desktop to the left or right. S & F behaves like Alt-Tab and Alt-Shift-Tab. This works by sending Alt press when entering the layer, and Alt release when other than S or F keys are pressed.
Pressing both Ctrls activates SYS layer for configuring the keyboard.
On Promethium, USB or Bluetooth output is detected on startup. If USB is connected, then USB is used initially. SYS-U and SYS-B switch output to USB or Bluetooth at runtime. Current active output is indicated with LEDs.
SYS-W, SYS-L, SYS-M switch Unicode input method. SYS-Q, SYS-D, SYS-C, SYS-K, SYS-N switch to QWERTY, DVORAK, Colemak, Workman and Norman, respectively.
On Planck, SYS-A (mnemonic: audio) toggles faux clicky: use buzzer to emit clicks on key presses and releases.
On Promethium there are 6 indicator LEDs, and under switch LEDs on each switches, including Trackpoint buttons. Totaling 57 LEDs. Output is limited to 0xF for each LEDs to conserve power. SYS-G (mnemonic: glow) toggles various backlighting modes.
On Promethium, there's a LED to indicate battery level. Hue indicates level: green is full, red is empty.

View file

@ -3,6 +3,8 @@
#include "../../config.h"
#define PRIYADI_PROMETHIUM
/* bootmagic salt key */
#define BOOTMAGIC_KEY_SALT KC_ESC
@ -11,8 +13,9 @@
#define PREVENT_STUCK_MODIFIERS
#define RGB_DI_PIN B5
#define RGBSPS_NUM 57
#define RGBSPS_ENABLE
#define UNICODE_TYPE_DELAY 0
#define LAYOUT_DVORAK
#define LAYOUT_COLEMAK
@ -20,5 +23,6 @@
#define LAYOUT_WORKMAN
#define DOUBLESPACE_LAYER_ENABLE
// #define TOLELOT_ENABLE
#endif

View file

@ -1,14 +1,44 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
/*
Copyright 2017 Priyadi Iman Nurcahyo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(PRIYADI_PROMETHIUM)
#include "promethium.h"
#elif defined(PRIYADI_PLANCK)
#include "planck.h"
#else
#error "no keyboard defined"
#endif
#include "promethium.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#include "musical_notes.h"
#endif
#include "eeconfig.h"
#include "process_unicode.h"
#include "quantum.h"
#ifdef RGBSPS_ENABLE
#include "rgbsps.h"
#endif
#ifdef PS2_MOUSE_ENABLE
#include "ps2_mouse.h"
#include "ps2.h"
#endif
#ifdef FAUXCLICKY_ENABLE
#include "fauxclicky.h"
#endif
#include "outputselect.h"
#include "led.h"
#define COUNT(x) (sizeof (x) / sizeof (*(x)))
@ -41,25 +71,29 @@ enum glow_modes {
};
uint8_t glow_mode = GLOW_MIN;
void turn_off_capslock(void);
extern keymap_config_t keymap_config;
// layers, ordering is important!
enum layers {
_QWERTY,
_DVORAK,
_COLEMAK,
_WORKMAN,
_NORMAN,
_PUNC,
_NUM,
_FUNC,
_DEFAULT_LAYER_MAX = _NORMAN,
_GREEKU,
_GREEKL,
_NUM,
_FUN,
_PUNC,
_EMPTY,
_EMOJI,
_GUI,
_SYS,
_SYS
};
// double-space layer
@ -74,9 +108,6 @@ enum planck_keycodes {
NORMAN,
// layer switchers
PUNC,
NUM,
FUNC,
EMOJI,
GUI,
GREEK,
@ -90,9 +121,22 @@ enum planck_keycodes {
LSPACE,
RSPACE,
GLOW,
AUDIO
// stub
#ifndef FAUXCLICKY_ENABLE
FC_TOG,
#endif
#ifndef ADAFRUIT_BLE_ENABLE
OUT_BLE,
#endif
KEYCODE_END
};
#define EMPTY MO(_EMPTY)
#define NUM MO(_NUM)
#define FUN MO(_FUN)
#define FUN0 LT(_FUN, KC_0)
// unicode map
enum unicode_name {
@ -196,6 +240,11 @@ enum unicode_name {
LOMEG,
FSIGM,
LTEQ,
GTEQ,
NOTEQ,
PLMIN,
};
const uint32_t PROGMEM unicode_map[] = {
@ -297,10 +346,17 @@ const uint32_t PROGMEM unicode_map[] = {
[LPSI] = 0x03C8,
[LOMEG] = 0x03C9,
[FSIGM] = 0x03C2,
// other
[LTEQ] = 0x2264, // less than or equal
[GTEQ] = 0x2265, // greater than or equal
[NOTEQ] = 0x2260, // not equal
[PLMIN] = 0xB1, // plus minus
};
// RGBSPS
#ifdef RGBSPS_ENABLE
const uint8_t PROGMEM LED_ALNUM[] = {
LED_Z,
LED_A,
@ -365,14 +421,14 @@ const uint8_t PROGMEM LED_MODS[] = {
const uint8_t PROGMEM LED_FN[] = {
LED_PUNC,
LED_NUM,
LED_FUNC,
LED_FUN,
LED_EMOJI
};
const uint8_t PROGMEM LED_INDICATORS[] = {
LED_IND_EMOJI,
LED_IND_NUM,
LED_IND_FUNC,
LED_IND_FUN,
LED_IND_BATTERY,
LED_IND_USB,
LED_IND_BLUETOOTH,
@ -431,7 +487,7 @@ void led_reset(void) {
void led_set_layer_indicator(void) {
static uint8_t oldlayer = 255;
rgbsps_set(LED_IND_FUNC, 0, 0, 0);
rgbsps_set(LED_IND_FUN, 0, 0, 0);
// rgbsps_set(LED_IND_NUM, 0, 0, 0);
rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
@ -444,14 +500,14 @@ void led_set_layer_indicator(void) {
oldlayer = layer;
if (layer <= _NORMAN) {
if (layer <= _DEFAULT_LAYER_MAX) {
rgbsps_send();
return;
}
switch(layer) {
case _FUNC:
rgbsps_set(LED_IND_FUNC, 15, 0, 0);
case _FUN:
rgbsps_set(LED_IND_FUN, 15, 0, 0);
break;
// case _NUM:
// rgbsps_set(LED_IND_NUM, 0, 0, 15);
@ -460,8 +516,8 @@ void led_set_layer_indicator(void) {
rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
break;
default:
rgbsps_set(LED_IND_FUNC, 3, 3, 3);
rgbsps_set(LED_IND_NUM, 3, 3, 3);
rgbsps_set(LED_IND_FUN, 3, 3, 3);
// rgbsps_set(LED_IND_NUM, 3, 3, 3);
rgbsps_set(LED_IND_EMOJI, 3, 3, 3);
}
@ -495,7 +551,7 @@ void led_init(void) {
rgbsps_set(LED_TRACKPOINT2, 0, 0, 15);
rgbsps_set(LED_TRACKPOINT3, 15, 0, 0);
}
#endif // RGBSPS_ENABLE
// keymaps
@ -509,14 +565,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | Alt | GUI | Punc | Num | Space | Func |Greek | GUI |AltGr | Ctrl |
* | Ctrl | Alt | GUI | Punc | Num | Space | Fun |Greek | GUI |AltGr | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT ,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LALT, KC_LGUI, PUNC, NUM, LSPACE, RSPACE, FUNC, GREEK, KC_RGUI, KC_RALT, KC_RCTL
KC_LCTL, KC_LALT, KC_LGUI, EMPTY, NUM, LSPACE, RSPACE, FUN, GREEK, KC_RGUI, KC_RALT, KC_RCTL
),
/* Dvorak
@ -604,38 +660,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Punc
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ` |
* | ~ | ! | @ | # | $ | % | ^ | & | * | | | ` |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | * | \ | - | = | / | | ( | ) | < | > | |
* | | * | \ | - | = | / | | ( | ) | < | > | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | & | ^ | | | _ | + | ? | | [ | ] | { | } | : |
* | & | ^ | | | _ | + | ? | ± | [ | ] | { | } | : |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_PUNC] = KEYMAP(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV ,
XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, XXXXXXX, KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, XXXXXXX,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_COLN,
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, X(LTEQ), X(GTEQ), _______,
KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, X(NOTEQ),KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, _______,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, X(PLMIN),KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_COLN,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Num
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | A | 7 | 8 | 9 | D | ` |
* | ~ | ! | @ | # | $ | % | A | 7 | 8 | 9 | D | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | * | \ | - | = | / | B | 4 | 5 | 6 | E | |
* | ` | * | \ | - | = | / | B | 4 | 5 | 6 | E | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | & | ^ | | | _ | + | ? | C | 1 | 2 | 3 | F | : |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | x | 0 | , | . | | |
* | | | | | | | | 0 | , | . | x | |
* `-----------------------------------------------------------------------------------'
*/
[_NUM] = KEYMAP(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), KC_GRV,
XXXXXXX, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN,
_______, _______, _______, _______, _______, _______, _______, KC_0, KC_COMM, KC_DOT, KC_X, _______
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), _______,
KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN,
_______, _______, _______, _______, _______, _______, _______, FUN0 , KC_COMM, KC_DOT, KC_X, _______
),
/* Func
@ -649,11 +705,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_FUNC] = KEYMAP(
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL,
XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8,KC_PSCREEN,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS,
_______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
[_FUN] = KEYMAP(
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL,
XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS,
_______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Uppercase Greek
@ -668,9 +724,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_GREEKU] = KEYMAP(
_______, _______, _______,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______,
_______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), _______, _______,
_______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), _______, _______, _______, _______,
_______, XXXXXXX, XXXXXXX,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______,
_______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), KC_QUOT, _______,
_______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
@ -686,9 +742,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_GREEKL] = KEYMAP(
_______, _______,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______,
_______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), _______, _______,
_______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), _______, _______, _______, _______,
_______, XXXXXXX,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______,
_______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), KC_QUOT, _______,
_______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Empty
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_EMPTY] = KEYMAP(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
@ -707,14 +781,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW),
X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS),
X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH),
X(POO), X(EYES), _______,X(HUNRD), X(SKULL),X(HORNS), X(HALO), X(FEAR),X(YUMMY),_______,X(DISAP),X(NOEVK)
X(POO), X(EYES), X(HUNRD),_______, X(SKULL),X(HORNS), X(HALO), X(FEAR),_______,X(YUMMY),X(DISAP),X(NOEVK)
),
/* GUI
* ,-----------------------------------------------------------------------------------.
* | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | Vol- | Mute | Vol+ | | | Prev | | Next | | |
* | Esc | | Btab | Esc | Tab | | | Prev | | Next | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | Prev | Play | Next | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
@ -723,9 +797,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_GUI] = KEYMAP(
XXXXXXX, G(KC_1), G(KC_2), G(KC_3), G(KC_4), G(KC_5), G(KC_6), G(KC_7), G(KC_8), G(KC_9), G(KC_0), XXXXXXX,
XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX, KC_WWWB, XXXXXXX, KC_WWWF, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, KC_SPC, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX
KC_ESC, XXXXXXX, S(KC_TAB),KC_ESC, KC_TAB, XXXXXXX, XXXXXXX, KC_WWWB, XXXXXXX, KC_WWWF, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, KC_SPC, KC_SPC, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
/* Sys
@ -741,11 +815,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_SYS] = KEYMAP(
XXXXXXX, QWERTY, WIN, XXXXXXX, RESET, XXXXXXX, XXXXXXX, OUT_USB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, AUDIO, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX,
XXXXXXX, FC_TOG, XXXXXXX, DVORAK, XXXXXXX, GLOW, XXXXXXX, XXXXXXX, WORKMAN, LINUX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, XXXXXXX, OUT_BLE, NORMAN, OSX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______
),
};
void persistant_default_layer_set(uint16_t default_layer) {
@ -753,9 +828,63 @@ void persistant_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
#ifdef DOUBLESPACE_LAYER_ENABLE
void process_doublespace(bool pressed, bool *isactive, bool *otheractive, bool *isemitted) {
if (pressed) {
*isactive = true;
if (*otheractive) {
layer_on(_SPACE);
register_code(KC_LALT); // sends alt and enter layer
space_layer_entered = true;
}
} else {
*isactive = false;
if (space_layer_entered) {
unregister_code(KC_LALT); // release alt and exit layer
layer_off(_SPACE);
if (!*otheractive) {
space_layer_entered = false;
}
} else {
if (!*isemitted) {
register_code(KC_SPC);
unregister_code(KC_SPC);
}
*isemitted = false;
}
}
}
#endif
uint32_t layer_state_set_kb(uint32_t state)
{
// turn on punc layer if both fun & num are on
if ((state & ((1UL<<_NUM) | (1UL<<_FUN))) == ((1UL<<_NUM) | (1UL<<_FUN))) {
state |= (1UL<<_PUNC);
} else {
state &= ~(1UL<<_PUNC);
}
// turn on emoji layer if empty and greek layer are on
if (
(state & ((1UL<<_EMPTY) | (1UL<<_GREEKU))) == ((1UL<<_EMPTY) | (1UL<<_GREEKU))
|| (state & ((1UL<<_EMPTY) | (1UL<<_GREEKL))) == ((1UL<<_EMPTY) | (1UL<<_GREEKL))
) {
state |= (1UL<<_EMOJI);
} else {
state &= ~(1UL<<_EMOJI);
}
return state;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
bool rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
static bool lshift = false;
static bool rshift = false;
static uint8_t layer = 0;
lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
layer = biton32(layer_state);
#ifdef DOUBLESPACE_LAYER_ENABLE
// double-space: send space immediately if any other key depressed before space is released
@ -779,6 +908,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
rspace_emitted = true;
}
}
if (layer == _SPACE && keycode != S(KC_TAB) && keycode != KC_TAB && keycode != KC_ESC && keycode != XXXXXXX) {
if (record->event.pressed) {
unregister_code(KC_LALT);
} else {
register_code(KC_LALT);
}
}
#endif
switch (keycode) {
@ -786,51 +923,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef DOUBLESPACE_LAYER_ENABLE
// double-space enter space layer
case LSPACE:
if (record->event.pressed) {
lspace_active = true;
if (rspace_active) {
layer_on(_SPACE);
space_layer_entered = true;
}
} else {
lspace_active = false;
if (space_layer_entered) {
layer_off(_SPACE);
if (!rspace_active) {
space_layer_entered = false;
}
} else {
if (!lspace_emitted) {
register_code(KC_SPC);
unregister_code(KC_SPC);
}
lspace_emitted = false;
}
}
process_doublespace(record->event.pressed, &lspace_active, &rspace_active, &lspace_emitted);
return false;
break;
case RSPACE:
if (record->event.pressed) {
rspace_active = true;
if (lspace_active) {
layer_on(_SPACE);
space_layer_entered = true;
}
} else {
rspace_active = false;
if (space_layer_entered) {
layer_off(_SPACE);
if (!lspace_active) {
space_layer_entered = false;
}
} else {
if (!rspace_emitted) {
register_code(KC_SPC);
unregister_code(KC_SPC);
}
rspace_emitted = false;
}
}
process_doublespace(record->event.pressed, &rspace_active, &lspace_active, &rspace_emitted);
return false;
break;
#endif
@ -840,7 +937,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_LSFT:
case KC_RSFT:
;
uint8_t layer = biton32(layer_state);
if (layer == _GREEKU || layer == _GREEKL) {
if (record->event.pressed) {
layer_on(_GREEKU);
@ -949,17 +1045,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
// layer switcher
case PUNC:
if (record->event.pressed) {
layer_on(_PUNC);
update_tri_layer(_PUNC, _GREEKL, _EMOJI);
} else {
layer_off(_PUNC);
update_tri_layer(_PUNC, _GREEKL, _EMOJI);
}
return false;
break;
//
case GREEK:
if (record->event.pressed) {
if (lshift || rshift) {
@ -968,31 +1054,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} else {
layer_on(_GREEKL);
layer_off(_GREEKU);
update_tri_layer(_PUNC, _GREEKL, _EMOJI);
}
} else {
layer_off(_GREEKU);
layer_off(_GREEKL);
update_tri_layer(_PUNC, _GREEKL, _EMOJI);
}
return false;
break;
case NUM:
if (record->event.pressed) {
turn_off_capslock();
layer_on(_NUM);
} else {
layer_off(_NUM);
}
return false;
break;
case FUNC:
if (record->event.pressed) {
layer_on(_FUNC);
} else {
layer_off(_FUNC);
}
return false;
break;
@ -1012,6 +1077,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
// glow mode changer
#ifdef RGBSPS_ENABLE
case GLOW:
if (record->event.pressed) {
glow_mode++;
@ -1023,16 +1089,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
#endif
// faux clicky toggle, TBD
case AUDIO:
return false;
// faux clicky indicator
#ifdef FAUXCLICKY_ENABLE
case FC_TOG:
return true;
break;
#endif
}
return true;
}
void set_output_user(uint8_t output) {
#ifdef ADAFRUIT_BLE_ENABLE
switch(output) {
case OUTPUT_USB:
led_set_output_usb();
@ -1043,42 +1113,27 @@ void set_output_user(uint8_t output) {
default:
led_set_output_none();
}
#endif
}
void matrix_init_user(void) {
void matrix_init_user() {
_delay_ms(500); // give time for usb to initialize
set_unicode_input_mode(UC_LNX);
#ifdef RGBSPS_ENABLE
led_init();
#endif
// auto detect output on init
#ifdef ADAFRUIT_BLE_ENABLE
uint8_t output = auto_detect_output();
if (output == OUTPUT_USB) {
set_output(OUTPUT_USB);
} else {
set_output(OUTPUT_ADAFRUIT_BLE);
}
}
void matrix_scan_user(void) {
led_set_layer_indicator();
}
void battery_poll(uint8_t level) {
rgbsps_sethsv(LED_IND_BATTERY, level * 120/255, 255, 15);
rgbsps_send();
}
void led_set_user(uint8_t usb_led) {
bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK);
if (new_capslock ^ capslock) { // capslock state is different
if (capslock = new_capslock) {
rgbsps_set(LED_IND_NUM, 15, 0, 0);
} else {
rgbsps_set(LED_IND_NUM, 0, 0, 0);
}
rgbsps_send();
}
#endif
}
void turn_off_capslock() {
@ -1088,37 +1143,62 @@ void turn_off_capslock() {
}
}
void ps2_mouse_init_user() {
uint8_t rcv;
#ifdef RGBSPS_ENABLE
void matrix_scan_user(void) {
led_set_layer_indicator();
}
// set TrackPoint sensitivity
PS2_MOUSE_SEND(0xE2, "tpsens: 0xE2");
PS2_MOUSE_SEND(0x81, "tpsens: 0x81");
PS2_MOUSE_SEND(0x4A, "tpsens: 0x4A");
PS2_MOUSE_SEND(0x49, "tpsens: 0x59");
void battery_poll(uint8_t level) {
rgbsps_sethsv(LED_IND_BATTERY, level * 120/255, 255, 15);
rgbsps_send();
}
// set TrackPoint Negative Inertia factor
PS2_MOUSE_SEND(0xE2, "tpnegin: 0xE2");
PS2_MOUSE_SEND(0x81, "tpnegin: 0x81");
PS2_MOUSE_SEND(0x4D, "tpnegin: 0x4D");
PS2_MOUSE_SEND(0x06, "tpnegin: 0x06");
// set TrackPoint speed
// (transfer function upper plateau speed)
PS2_MOUSE_SEND(0xE2, "tpsp: 0xE2");
PS2_MOUSE_SEND(0x81, "tpsp: 0x81");
PS2_MOUSE_SEND(0x60, "tpsp: 0x60");
PS2_MOUSE_SEND(0x61, "tpsp: 0x61");
// inquire pts status
rcv = ps2_host_send(0xE2);
rcv = ps2_host_send(0x2C);
rcv = ps2_host_recv_response();
if ((rcv & 1) == 1) {
// if on, disable pts
rcv = ps2_host_send(0xE2);
rcv = ps2_host_send(0x47);
rcv = ps2_host_send(0x2C);
rcv = ps2_host_send(0x01);
void led_set_user(uint8_t usb_led) {
bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK);
if (new_capslock ^ capslock) { // capslock state is different
if ((capslock = new_capslock)) {
rgbsps_set(LED_IND_NUM, 15, 0, 0);
} else {
rgbsps_set(LED_IND_NUM, 0, 0, 0);
}
rgbsps_send();
}
}
}
#endif
#ifdef PS2_MOUSE_ENABLE
void ps2_mouse_init_user() {
uint8_t rcv;
// set TrackPoint sensitivity
PS2_MOUSE_SEND(0xE2, "tpsens: 0xE2");
PS2_MOUSE_SEND(0x81, "tpsens: 0x81");
PS2_MOUSE_SEND(0x4A, "tpsens: 0x4A");
PS2_MOUSE_SEND(0x49, "tpsens: 0x59");
// set TrackPoint Negative Inertia factor
PS2_MOUSE_SEND(0xE2, "tpnegin: 0xE2");
PS2_MOUSE_SEND(0x81, "tpnegin: 0x81");
PS2_MOUSE_SEND(0x4D, "tpnegin: 0x4D");
PS2_MOUSE_SEND(0x06, "tpnegin: 0x06");
// set TrackPoint speed
// (transfer function upper plateau speed)
PS2_MOUSE_SEND(0xE2, "tpsp: 0xE2");
PS2_MOUSE_SEND(0x81, "tpsp: 0x81");
PS2_MOUSE_SEND(0x60, "tpsp: 0x60");
PS2_MOUSE_SEND(0x61, "tpsp: 0x61");
// inquire pts status
rcv = ps2_host_send(0xE2);
rcv = ps2_host_send(0x2C);
rcv = ps2_host_recv_response();
if ((rcv & 1) == 1) {
// if on, disable pts
rcv = ps2_host_send(0xE2);
rcv = ps2_host_send(0x47);
rcv = ps2_host_send(0x2C);
rcv = ps2_host_send(0x01);
}
}
#endif

View file

@ -36,3 +36,7 @@ void led_set_kb(uint8_t usb_led) {
led_set_user(usb_led);
}
__attribute__ ((weak))
void led_set_user(uint8_t usb_led) {
}

View file

@ -1,108 +1,10 @@
#ifndef PROMETHIUM_H
#define PROMETHIUM_H
#include "quantum.h"
#include "stdint.h"
#define PS2_INIT_DELAY 2000
#define UNICODE_TYPE_DELAY 0
#define BATTERY_PIN 9
#define BATTERY_POLL 30000
#define MAX_VOLTAGE 4.2
#define MIN_VOLTAGE 3.2
#define KEYMAP( \
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
) \
{ \
{k11, k12, k13, k14, k15, k16}, \
{k21, k22, k23, k24, k25, k26}, \
{k31, k32, k33, k34, k35, k36}, \
{k41, k42, k43, k44, k45, k46}, \
{k17, k18, k19, k1a, k1b, k1c}, \
{k27, k28, k29, k2a, k2b, k2c}, \
{k37, k38, k39, k3a, k3b, k3c}, \
{k47, k48, k49, k4a, k4b, k4c} \
}
enum led_sequence {
LED_IND_BLUETOOTH,
LED_IND_USB,
LED_IND_BATTERY,
LED_IND_FUNC,
LED_IND_NUM,
LED_IND_EMOJI,
LED_BKSP,
LED_ENT,
LED_RSFT,
LED_RCTL,
LED_RGUI,
LED_SLSH,
LED_SCLN,
LED_P,
LED_O,
LED_L,
LED_DOT,
LED_RALT,
LED_EMOJI,
LED_COMM,
LED_K,
LED_I,
LED_U,
LED_J,
LED_M,
LED_FUNC,
LED_RSPC,
LED_N,
LED_HH,
LED_Y,
LED_TRACKPOINT3,
LED_TRACKPOINT2,
LED_TRACKPOINT1,
LED_LSPC,
LED_B,
LED_G,
LED_T,
LED_R,
LED_F,
LED_V,
LED_NUM,
LED_PUNC,
LED_C,
LED_D,
LED_E,
LED_W,
LED_S,
LED_X,
LED_LALT,
LED_LGUI,
LED_Z,
LED_A,
LED_Q,
LED_TAB,
LED_ESC,
LED_LSFT,
LED_LCTL,
};
void battery_poll(uint8_t level);
void led_set_kb(uint8_t usb_led);
void led_set_user(uint8_t usb_led);
#endif
void battery_poll(uint8_t level);

View file

@ -1,8 +1,12 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#ifndef NO_DEBUG
#define NO_DEBUG
#endif
#ifndef NO_PRINT
#define NO_PRINT
#endif
#include "../../config.h"

View file

@ -10,12 +10,13 @@ COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
UNICODEMAP_ENABLE = yes # Unicode map
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
API_SYSEX_ENABLE = no
FAUXCLICKY_ENABLE = yes
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View file

@ -0,0 +1,39 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
#define PRIYADI_PLANCK
/* bootmagic salt key */
#define BOOTMAGIC_KEY_SALT KC_ESC
/* skip bootmagic and eeconfig */
#define BOOTMAGIC_KEY_SKIP KC_SPACE
#define PREVENT_STUCK_MODIFIERS
#define UNICODE_TYPE_DELAY 0
#define LAYOUT_DVORAK
#define LAYOUT_COLEMAK
#define LAYOUT_NORMAN
#define LAYOUT_WORKMAN
#define DOUBLESPACE_LAYER_ENABLE
// #define TOLELOT_ENABLE
#define KEYMAP( \
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
) \
{ \
{k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c}, \
{k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c}, \
{k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c}, \
{k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c} \
}
#endif

View file

@ -1,680 +1 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "planck.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#include "musical_notes.h"
#endif
#include "eeconfig.h"
#include "process_unicode.h"
#include "quantum.h"
// #define TOLELOT_ENABLE
extern keymap_config_t keymap_config;
enum layers {
_QWERTY,
_COLEMAK,
_WORKMAN,
_PUNC,
_NUM,
_FUNC,
_EMOJI,
_GREEKU,
_GREEKL,
_GUI,
};
enum planck_keycodes {
// layouts
QWERTY = SAFE_RANGE,
COLEMAK,
WORKMAN,
// layer switchers
PUNC,
NUM,
FUNC,
EMOJI,
GUI,
GREEK,
// os switchers
LINUX,
WIN,
OSX,
};
// Fillers to make layering clearer
#define _______ KC_TRNS
#define XXXXXXX KC_NO
// unicode map
enum unicode_name {
GRIN, // grinning face 😊
TJOY, // tears of joy 😂
SMILE, // grining face with smiling eyes 😁
HEART, // heart ❤
EYERT, // smiling face with heart shaped eyes 😍
CRY, // crying face 😭
SMEYE, // smiling face with smiling eyes 😊
UNAMU, // unamused 😒
KISS, // kiss 😘
HART2, // two hearts 💕
WEARY, // weary 😩
OKHND, // ok hand sign 👌
PENSV, // pensive 😔
SMIRK, // smirk 😏
RECYC, // recycle ♻
WINK, // wink 😉
THMUP, // thumb up 👍
THMDN, // thumb down 👎
PRAY, // pray 🙏
PHEW, // relieved 😌
MUSIC, // musical notes
FLUSH, // flushed 😳
CELEB, // celebration 🙌
CRY2, // crying face 😢
COOL, // smile with sunglasses 😎
NOEVS, // see no evil
NOEVH, // hear no evil
NOEVK, // speak no evil
POO, // pile of poo
EYES, // eyes
VIC, // victory hand
BHART, // broken heart
SLEEP, // sleeping face
SMIL2, // smiling face with open mouth & sweat
HUNRD, // 100
CONFU, // confused
TONGU, // face with tongue & winking eye
DISAP, // disappointed
YUMMY, // face savoring delicious food
CLAP, // hand clapping
FEAR, // face screaming in fear
HORNS, // smiling face with horns
HALO, // smiling face with halo
BYE, // waving hand
SUN, // sun
MOON, // moon
SKULL, // skull
// greek letters
UALPH,
UBETA,
UGAMM,
UDELT,
UEPSI,
UZETA,
UETA,
UTHET,
UIOTA,
UKAPP,
ULAMB,
UMU,
UNU,
UXI,
UOMIC,
UPI,
URHO,
USIGM,
UTAU,
UUPSI,
UPHI,
UCHI,
UPSI,
UOMEG,
LALPH,
LBETA,
LGAMM,
LDELT,
LEPSI,
LZETA,
LETA,
LTHET,
LIOTA,
LKAPP,
LLAMB,
LMU,
LNU,
LXI,
LOMIC,
LPI,
LRHO,
LSIGM,
LTAU,
LUPSI,
LPHI,
LCHI,
LPSI,
LOMEG,
FSIGM,
};
const uint32_t PROGMEM unicode_map[] = {
[GRIN] = 0x1F600,
[TJOY] = 0x1F602,
[SMILE] = 0x1F601,
[HEART] = 0x2764,
[EYERT] = 0x1f60d,
[CRY] = 0x1f62d,
[SMEYE] = 0x1F60A,
[UNAMU] = 0x1F612,
[KISS] = 0x1F618,
[HART2] = 0x1F495,
[WEARY] = 0x1F629,
[OKHND] = 0x1F44C,
[PENSV] = 0x1F614,
[SMIRK] = 0x1F60F,
[RECYC] = 0x267B,
[WINK] = 0x1F609,
[THMUP] = 0x1F44D,
[THMDN] = 0x1F44E,
[PRAY] = 0x1F64F,
[PHEW] = 0x1F60C,
[MUSIC] = 0x1F3B6,
[FLUSH] = 0x1F633,
[CELEB] = 0x1F64C,
[CRY2] = 0x1F622,
[COOL] = 0x1F60E,
[NOEVS] = 0x1F648,
[NOEVH] = 0x1F649,
[NOEVK] = 0x1F64A,
[POO] = 0x1F4A9,
[EYES] = 0x1F440,
[VIC] = 0x270C,
[BHART] = 0x1F494,
[SLEEP] = 0x1F634,
[SMIL2] = 0x1F605,
[HUNRD] = 0x1F4AF,
[CONFU] = 0x1F615,
[TONGU] = 0x1F61C,
[DISAP] = 0x1F61E,
[YUMMY] = 0x1F60B,
[CLAP] = 0x1F44F,
[FEAR] = 0x1F631,
[HORNS] = 0x1F608,
[HALO] = 0x1F607,
[BYE] = 0x1F44B,
[SUN] = 0x2600,
[MOON] = 0x1F314,
[SKULL] = 0x1F480,
// greek letters
[UALPH] = 0x0391,
[UBETA] = 0x0392,
[UGAMM] = 0x0393,
[UDELT] = 0x0394,
[UEPSI] = 0x0395,
[UZETA] = 0x0396,
[UETA] = 0x0397,
[UTHET] = 0x0398,
[UIOTA] = 0x0399,
[UKAPP] = 0x039A,
[ULAMB] = 0x039B,
[UMU] = 0x039C,
[UNU] = 0x039D,
[UXI] = 0x039E,
[UOMIC] = 0x039F,
[UPI] = 0x03A0,
[URHO] = 0x03A1,
[USIGM] = 0x03A3,
[UTAU] = 0x03A4,
[UUPSI] = 0x03A5,
[UPHI] = 0x03A6,
[UCHI] = 0x03A7,
[UPSI] = 0x03A8,
[UOMEG] = 0x03A9,
[LALPH] = 0x03B1,
[LBETA] = 0x03B2,
[LGAMM] = 0x03B3,
[LDELT] = 0x03B4,
[LEPSI] = 0x03B5,
[LZETA] = 0x03B6,
[LETA] = 0x03B7,
[LTHET] = 0x03B8,
[LIOTA] = 0x03B9,
[LKAPP] = 0x03BA,
[LLAMB] = 0x03BB,
[LMU] = 0x03BC,
[LNU] = 0x03BD,
[LXI] = 0x03BE,
[LOMIC] = 0x03BF,
[LPI] = 0x03C0,
[LRHO] = 0x03C1,
[LSIGM] = 0x03C3,
[LTAU] = 0x03C4,
[LUPSI] = 0x03C5,
[LPHI] = 0x03C6,
[LCHI] = 0x03C7,
[LPSI] = 0x03C8,
[LOMEG] = 0x03C9,
[FSIGM] = 0x03C2,
};
// hybrid shift - =
// #undef KC_LSFT
// #define KC_LSFT MT(MOD_LSFT, KC_MINS)
// #undef KC_RSFT
// #define KC_RSFT MT(MOD_LSFT, KC_EQL)
// hybrid right-gui & scroll lock (mapped to Compose in OS)
#undef KC_RCTL
#define KC_RCTL MT(MOD_LCTL, KC_SLCK)
// keymaps
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; |Enter |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |Greek |AltGr | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT },
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{KC_LCTL, KC_LALT, KC_LGUI, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, GREEK, KC_RALT, KC_RCTL}
},
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O |Enter |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = {
{_______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______},
{_______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______},
{_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Workman
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | D | R | W | B | J | F | U | P | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | H | T | G | Y | N | E | O | I |Enter |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | M | C | V | K | K | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[_WORKMAN] = {
{_______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______},
{_______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______},
{_______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Uppercase Greek
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_GREEKU] = {
{_______, _______, _______,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______},
{_______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), _______, _______},
{_______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Lowercase Greek
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_GREEKL] = {
{_______, _______,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______},
{_______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), _______, _______},
{_______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Punc
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ` |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | \ | - | = | < | > | ( | ) | ' | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | _ | + | { | } | [ | ] | " | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_PUNC] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV },
{XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Num
* ,-----------------------------------------------------------------------------------.
* | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | @ | A | B | C | ( | ) | 4 | 5 | 6 | : |Enter |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | & | # | D | E | F | [ | ] | 1 | 2 | 3 | / | * |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | x | | | 0 | , | . | + | - |
* `-----------------------------------------------------------------------------------'
*/
[_NUM] = {
{KC_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{ KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN, KC_4, KC_5, KC_6, KC_COLN, KC_ENT},
{KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR},
{_______, _______, _______, KC_X, _______, KC_SPC, KC_SPC, KC_0, KC_COMM, KC_DOT, KC_PLUS, KC_MINS}
},
/* Func
* ,-----------------------------------------------------------------------------------.
* | | F1 | F2 | F3 | F4 | | | PgUp | Up | PgDn | PgUp | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | F5 | F6 | F7 | F8 |PrtSc | | Left | Down | Right| PgDn | Ins |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F9 | F10 | F11 | F12 | | | | Home | End | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_FUNC] = {
{XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL},
{XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8,KC_PSCREEN,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS},
{_______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Emoji
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_EMOJI] = {
{X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW)},
{X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS)},
{X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH)},
{ X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK)}
},
/* GUI
* ,-----------------------------------------------------------------------------------.
* | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* |Linux | | Vol- | Mute | Vol+ | | | D- | | D+ | |Qwerty|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Win | | Prev | Play | Next | | | | | | |Colmak|
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | OSX | | | | | BL- | BL+ | | | | |Workmn|
* `-----------------------------------------------------------------------------------'
*/
[_GUI] = {
{_______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______},
{ LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,_______, QWERTY},
{ WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, COLEMAK},
{ OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, _______, _______, WORKMAN}
},
};
#ifdef AUDIO_ENABLE
float tone_startup[][2] = SONG(STARTUP_SOUND);
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float tone_workman[][2] = SONG(DVORAK_SOUND);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND);
float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND);
float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND);
float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2));
float tone_release[][2] = SONG(MUSICAL_NOTE(_A3, 2));
float tone_tolelot[][2] = SONG(Q__NOTE(_E5), Q__NOTE(_C5), Q__NOTE(_D5));
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// faux clicky
// if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0);
#ifdef AUDIO_ENABLE
#ifdef TOLELOT_ENABLE
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_tolelot, false, 0);
}
#else
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_click, false, 0);
} else {
PLAY_NOTE_ARRAY(tone_release, false, 0);
}
#endif
#endif
bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT);
bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT);
switch (keycode) {
// Greek layer handling
case GREEK:
if (record->event.pressed) {
if (lshifted || rshifted) {
layer_on(_GREEKU);
layer_off(_GREEKL);
} else {
layer_on(_GREEKL);
layer_off(_GREEKU);
}
} else {
layer_off(_GREEKU);
layer_off(_GREEKL);
}
return false;
break;
case KC_LSFT:
case KC_RSFT:
;
uint8_t layer = biton32(layer_state);
if (layer == _GREEKU || layer == _GREEKL) {
if (record->event.pressed) {
layer_on(_GREEKU);
layer_off(_GREEKL);
} else {
if (lshifted ^ rshifted) { // if only one shift is pressed
layer_on(_GREEKL);
layer_off(_GREEKU);
}
}
}
return true;
break;
// QWERTZ style comma and dot: semicolon and colon when shifted
case KC_COMM:
if (record->event.pressed) {
if (lshifted || rshifted) {
if (lshifted) unregister_code(KC_LSFT);
if (rshifted) unregister_code(KC_RSFT);
register_code(KC_SCLN);
unregister_code(KC_SCLN);
if (lshifted) register_code(KC_LSFT);
if (rshifted) register_code(KC_RSFT);
} else {
register_code(KC_COMM);
unregister_code(KC_COMM);
}
}
return false;
break;
case KC_DOT:
if (record->event.pressed) {
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT))) {
register_code(KC_SCLN);
unregister_code(KC_SCLN);
} else {
register_code(KC_DOT);
unregister_code(KC_DOT);
}
}
return false;
break;
// layout switcher
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
return false;
break;
case WORKMAN:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_workman, false, 0);
#endif
persistant_default_layer_set(1UL<<_WORKMAN);
}
return false;
break;
// layer switchers
case PUNC:
if (record->event.pressed) {
layer_on(_PUNC);
update_tri_layer(_PUNC, _EMOJI, _GUI);
} else {
layer_off(_PUNC);
update_tri_layer(_PUNC, _EMOJI, _GUI);
}
return false;
break;
case EMOJI:
if (record->event.pressed) {
layer_on(_EMOJI);
update_tri_layer(_PUNC, _EMOJI, _GUI);
} else {
layer_off(_EMOJI);
update_tri_layer(_PUNC, _EMOJI, _GUI);
}
return false;
break;
case NUM:
if (record->event.pressed) {
layer_on(_NUM);
} else {
layer_off(_NUM);
}
return false;
break;
case FUNC:
if (record->event.pressed) {
layer_on(_FUNC);
} else {
layer_off(_FUNC);
}
return false;
break;
// OS switchers
case LINUX:
set_unicode_input_mode(UC_LNX);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_linux, false, 0);
#endif
return false;
break;
case WIN:
set_unicode_input_mode(UC_WINC);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_windows, false, 0);
#endif
return false;
break;
case OSX:
set_unicode_input_mode(UC_OSX);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_osx, false, 0);
#endif
return false;
break;
}
return true;
}
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
startup_user();
#endif
set_unicode_input_mode(UC_LNX);
}
#ifdef AUDIO_ENABLE
void startup_user()
{
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
}
void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
_delay_ms(150);
stop_all_notes();
}
#endif
#include "../../../handwired/promethium/keymaps/priyadi/keymap.c"

View file

@ -195,24 +195,20 @@ const uint16_t PROGMEM fn_actions[] = {
};
#ifdef AUDIO_ENABLE
float tone_startup[][2] = {
{440.0*pow(2.0,(31)/12.0), 12},
{440.0*pow(2.0,(28)/12.0), 8},
{440.0*pow(2.0,(19)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{440.0*pow(2.0,(28)/12.0), 20}
};
float tone_startup[][2] = SONG(STARTUP_SOUND);
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float tone_plover[][2] = SONG(PLOVER_SOUND);
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float goodbye[][2] = SONG(GOODBYE_SOUND);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
@ -309,18 +305,35 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
};
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
_delay_ms(20); // stops the tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
#endif
#ifdef AUDIO_ENABLE
startup_user();
#endif
}
#ifdef AUDIO_ENABLE
void play_goodbye_tone()
void startup_user()
{
PLAY_NOTE_ARRAY(goodbye, false, 0);
_delay_ms(150);
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
}
void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
_delay_ms(150);
stop_all_notes();
}
void music_on_user(void)
{
music_scale_user();
}
void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
}
#endif

View file

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../../Makefile
endif

View file

@ -24,6 +24,7 @@ void voice_deiterate() {
float voice_envelope(float frequency) {
// envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
__attribute__ ((unused))
uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
switch (voice) {

68
quantum/fauxclicky.c Normal file
View file

@ -0,0 +1,68 @@
/*
Copyright 2017 Priyadi Iman Nurcahyo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include <timer.h>
#include <fauxclicky.h>
#include <stdbool.h>
#include <musical_notes.h>
__attribute__ ((weak))
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, 2);
__attribute__ ((weak))
float fauxclicky_released_note[2] = MUSICAL_NOTE(_A3, 2);
__attribute__ ((weak))
float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, 2);
bool fauxclicky_enabled = true;
uint16_t note_start = 0;
bool note_playing = false;
uint16_t note_period = 0;
void fauxclicky_init()
{
// Set port PC6 (OC3A and /OC4A) as output
DDRC |= _BV(PORTC6);
// TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
}
void fauxclicky_stop()
{
FAUXCLICKY_DISABLE_OUTPUT;
note_playing = false;
}
void fauxclicky_play(float note[2]) {
if (!fauxclicky_enabled) return;
if (note_playing) fauxclicky_stop();
FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER));
FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER)) / 2);
note_playing = true;
note_period = (note[1] / 16) * (60 / (float)FAUXCLICKY_TEMPO) * 100; // check this
note_start = timer_read();
FAUXCLICKY_ENABLE_OUTPUT;
}
void fauxclicky_check() {
if (!note_playing) return;
if (timer_elapsed(note_start) > note_period) {
fauxclicky_stop();
}
}

99
quantum/fauxclicky.h Normal file
View file

@ -0,0 +1,99 @@
/*
Copyright 2017 Priyadi Iman Nurcahyo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef AUDIO_ENABLE
#error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled"
#endif
#include "musical_notes.h"
#include "stdbool.h"
__attribute__ ((weak))
float fauxclicky_pressed_note[2];
__attribute__ ((weak))
float fauxclicky_released_note[2];
__attribute__ ((weak))
float fauxclicky_beep_note[2];
bool fauxclicky_enabled;
//
// tempo in BPM
//
#ifndef FAUXCLICKY_TEMPO
#define FAUXCLICKY_TEMPO TEMPO_DEFAULT
#endif
// beep on press
#define FAUXCLICKY_ACTION_PRESS fauxclicky_play(fauxclicky_pressed_note)
// beep on release
#define FAUXCLICKY_ACTION_RELEASE fauxclicky_play(fauxclicky_released_note)
// general purpose beep
#define FAUXCLICKY_BEEP fauxclicky_play(fauxclicky_beep_note)
// enable
#define FAUXCLICKY_ON fauxclicky_enabled = true
// disable
#define FAUXCLICKY_OFF do { \
fauxclicky_enabled = false; \
fauxclicky_stop(); \
} while (0)
// toggle
#define FAUXCLICKY_TOGGLE do { \
if (fauxclicky_enabled) { \
FAUXCLICKY_OFF; \
} else { \
FAUXCLICKY_ON; \
} \
} while (0)
//
// pin configuration
//
#ifndef FAUXCLICKY_CPU_PRESCALER
#define FAUXCLICKY_CPU_PRESCALER 8
#endif
#ifndef FAUXCLICKY_ENABLE_OUTPUT
#define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1);
#endif
#ifndef FAUXCLICKY_DISABLE_OUTPUT
#define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0));
#endif
#ifndef FAUXCLICKY_TIMER_PERIOD
#define FAUXCLICKY_TIMER_PERIOD ICR3
#endif
#ifndef FAUXCLICKY_DUTY_CYCLE
#define FAUXCLICKY_DUTY_CYCLE OCR3A
#endif
//
// definitions
//
void fauxclicky_init(void);
void fauxclicky_stop(void);
void fauxclicky_play(float note[2]);
void fauxclicky_check(void);

View file

@ -119,6 +119,9 @@ action_t action_for_key(uint8_t layer, keypos_t key)
mod = keycode & 0xFF;
action.code = ACTION_MODS_ONESHOT(mod);
break;
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
break;
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0x1F, keycode & 0xFF);
break;

View file

@ -4,7 +4,9 @@
#include "keymap.h"
// Alt gr
#ifndef ALGR
#define ALGR(kc) RALT(kc)
#endif
#define NO_ALGR KC_RALT
// Normal characters
@ -72,7 +74,7 @@
#define FR_PIPE ALGR(KC_6)
#define FR_GRV ALGR(KC_7)
#define FR_BSLS ALGR(KC_8)
#define FR_CIRC ALGR(KC_9)
#define FR_CCIRC ALGR(KC_9)
#define FR_AT ALGR(KC_0)
#define FR_RBRC ALGR(FR_RPRN)
#define FR_RCBR ALGR(FR_EQL)

View file

@ -0,0 +1,133 @@
#include "process_ucis.h"
qk_ucis_state_t qk_ucis_state;
void qk_ucis_start(void) {
qk_ucis_state.count = 0;
qk_ucis_state.in_progress = true;
qk_ucis_start_user();
}
__attribute__((weak))
void qk_ucis_start_user(void) {
unicode_input_start();
register_hex(0x2328);
unicode_input_finish();
}
static bool is_uni_seq(char *seq) {
uint8_t i;
for (i = 0; seq[i]; i++) {
uint16_t code;
if (('1' <= seq[i]) && (seq[i] <= '0'))
code = seq[i] - '1' + KC_1;
else
code = seq[i] - 'a' + KC_A;
if (i > qk_ucis_state.count || qk_ucis_state.codes[i] != code)
return false;
}
return (qk_ucis_state.codes[i] == KC_ENT ||
qk_ucis_state.codes[i] == KC_SPC);
}
__attribute__((weak))
void qk_ucis_symbol_fallback (void) {
for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
uint8_t code = qk_ucis_state.codes[i];
register_code(code);
unregister_code(code);
wait_ms(UNICODE_TYPE_DELAY);
}
}
void register_ucis(const char *hex) {
for(int i = 0; hex[i]; i++) {
uint8_t kc = 0;
char c = hex[i];
switch (c) {
case '0':
kc = KC_0;
break;
case '1' ... '9':
kc = c - '1' + KC_1;
break;
case 'a' ... 'f':
kc = c - 'a' + KC_A;
break;
case 'A' ... 'F':
kc = c - 'A' + KC_A;
break;
}
if (kc) {
register_code (kc);
unregister_code (kc);
wait_ms (UNICODE_TYPE_DELAY);
}
}
}
bool process_ucis (uint16_t keycode, keyrecord_t *record) {
uint8_t i;
if (!qk_ucis_state.in_progress)
return true;
if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH &&
!(keycode == KC_BSPC || keycode == KC_ESC || keycode == KC_SPC || keycode == KC_ENT)) {
return false;
}
if (!record->event.pressed)
return true;
qk_ucis_state.codes[qk_ucis_state.count] = keycode;
qk_ucis_state.count++;
if (keycode == KC_BSPC) {
if (qk_ucis_state.count >= 2) {
qk_ucis_state.count -= 2;
return true;
} else {
qk_ucis_state.count--;
return false;
}
}
if (keycode == KC_ENT || keycode == KC_SPC || keycode == KC_ESC) {
bool symbol_found = false;
for (i = qk_ucis_state.count; i > 0; i--) {
register_code (KC_BSPC);
unregister_code (KC_BSPC);
wait_ms(UNICODE_TYPE_DELAY);
}
if (keycode == KC_ESC) {
qk_ucis_state.in_progress = false;
return false;
}
unicode_input_start();
for (i = 0; ucis_symbol_table[i].symbol; i++) {
if (is_uni_seq (ucis_symbol_table[i].symbol)) {
symbol_found = true;
register_ucis(ucis_symbol_table[i].code + 2);
break;
}
}
if (!symbol_found) {
qk_ucis_symbol_fallback();
}
unicode_input_finish();
qk_ucis_state.in_progress = false;
return false;
}
return true;
}

View file

@ -0,0 +1,35 @@
#ifndef PROCESS_UCIS_H
#define PROCESS_UCIS_H
#include "quantum.h"
#include "process_unicode_common.h"
#ifndef UCIS_MAX_SYMBOL_LENGTH
#define UCIS_MAX_SYMBOL_LENGTH 32
#endif
typedef struct {
char *symbol;
char *code;
} qk_ucis_symbol_t;
typedef struct {
uint8_t count;
uint16_t codes[UCIS_MAX_SYMBOL_LENGTH];
bool in_progress:1;
} qk_ucis_state_t;
extern qk_ucis_state_t qk_ucis_state;
#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, NULL}}
#define UCIS_SYM(name, code) {name, #code}
extern const qk_ucis_symbol_t ucis_symbol_table[];
void qk_ucis_start(void);
void qk_ucis_start_user(void);
void qk_ucis_symbol_fallback (void);
void register_ucis(const char *hex);
bool process_ucis (uint16_t keycode, keyrecord_t *record);
#endif

View file

@ -1,103 +1,6 @@
#include "process_unicode.h"
#include "action_util.h"
static uint8_t input_mode;
uint8_t mods;
__attribute__((weak))
uint16_t hex_to_keycode(uint8_t hex)
{
if (hex == 0x0) {
return KC_0;
} else if (hex < 0xA) {
return KC_1 + (hex - 0x1);
} else {
return KC_A + (hex - 0xA);
}
}
void set_unicode_input_mode(uint8_t os_target)
{
input_mode = os_target;
}
uint8_t get_unicode_input_mode(void) {
return input_mode;
}
__attribute__((weak))
void unicode_input_start (void) {
// save current mods
mods = keyboard_report->mods;
// unregister all mods to start from clean state
if (mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT);
if (mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT);
if (mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL);
if (mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL);
if (mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT);
if (mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT);
if (mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI);
if (mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI);
switch(input_mode) {
case UC_OSX:
register_code(KC_LALT);
break;
case UC_LNX:
register_code(KC_LCTL);
register_code(KC_LSFT);
register_code(KC_U);
unregister_code(KC_U);
unregister_code(KC_LSFT);
unregister_code(KC_LCTL);
break;
case UC_WIN:
register_code(KC_LALT);
register_code(KC_PPLS);
unregister_code(KC_PPLS);
break;
case UC_WINC:
register_code(KC_RALT);
unregister_code(KC_RALT);
register_code(KC_U);
unregister_code(KC_U);
}
wait_ms(UNICODE_TYPE_DELAY);
}
__attribute__((weak))
void unicode_input_finish (void) {
switch(input_mode) {
case UC_OSX:
case UC_WIN:
unregister_code(KC_LALT);
break;
case UC_LNX:
register_code(KC_SPC);
unregister_code(KC_SPC);
break;
}
// reregister previously set mods
if (mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT);
if (mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT);
if (mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL);
if (mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL);
if (mods & MOD_BIT(KC_LALT)) register_code(KC_LALT);
if (mods & MOD_BIT(KC_RALT)) register_code(KC_RALT);
if (mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI);
if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI);
}
void register_hex(uint16_t hex) {
for(int i = 3; i >= 0; i--) {
uint8_t digit = ((hex >> (i*4)) & 0xF);
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
}
}
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
if (keycode > QK_UNICODE && record->event.pressed) {
uint16_t unicode = keycode & 0x7FFF;
@ -108,191 +11,3 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record) {
return true;
}
#ifdef UNICODEMAP_ENABLE
__attribute__((weak))
const uint32_t PROGMEM unicode_map[] = {
};
void register_hex32(uint32_t hex) {
uint8_t onzerostart = 1;
for(int i = 7; i >= 0; i--) {
if (i <= 3) {
onzerostart = 0;
}
uint8_t digit = ((hex >> (i*4)) & 0xF);
if (digit == 0) {
if (onzerostart == 0) {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
}
} else {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
onzerostart = 0;
}
}
}
__attribute__((weak))
void unicode_map_input_error() {}
bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
const uint32_t* map = unicode_map;
uint16_t index = keycode - QK_UNICODE_MAP;
uint32_t code = pgm_read_dword_far(&map[index]);
if (code > 0xFFFF && code <= 0x10ffff && input_mode == UC_OSX) {
// Convert to UTF-16 surrogate pair
code -= 0x10000;
uint32_t lo = code & 0x3ff;
uint32_t hi = (code & 0xffc00) >> 10;
unicode_input_start();
register_hex32(hi + 0xd800);
register_hex32(lo + 0xdc00);
unicode_input_finish();
} else if ((code > 0x10ffff && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) {
// when character is out of range supported by the OS
unicode_map_input_error();
} else {
unicode_input_start();
register_hex32(code);
unicode_input_finish();
}
}
return true;
}
#endif
#ifdef UCIS_ENABLE
qk_ucis_state_t qk_ucis_state;
void qk_ucis_start(void) {
qk_ucis_state.count = 0;
qk_ucis_state.in_progress = true;
qk_ucis_start_user();
}
__attribute__((weak))
void qk_ucis_start_user(void) {
unicode_input_start();
register_hex(0x2328);
unicode_input_finish();
}
static bool is_uni_seq(char *seq) {
uint8_t i;
for (i = 0; seq[i]; i++) {
uint16_t code;
if (('1' <= seq[i]) && (seq[i] <= '0'))
code = seq[i] - '1' + KC_1;
else
code = seq[i] - 'a' + KC_A;
if (i > qk_ucis_state.count || qk_ucis_state.codes[i] != code)
return false;
}
return (qk_ucis_state.codes[i] == KC_ENT ||
qk_ucis_state.codes[i] == KC_SPC);
}
__attribute__((weak))
void qk_ucis_symbol_fallback (void) {
for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
uint8_t code = qk_ucis_state.codes[i];
register_code(code);
unregister_code(code);
wait_ms(UNICODE_TYPE_DELAY);
}
}
void register_ucis(const char *hex) {
for(int i = 0; hex[i]; i++) {
uint8_t kc = 0;
char c = hex[i];
switch (c) {
case '0':
kc = KC_0;
break;
case '1' ... '9':
kc = c - '1' + KC_1;
break;
case 'a' ... 'f':
kc = c - 'a' + KC_A;
break;
case 'A' ... 'F':
kc = c - 'A' + KC_A;
break;
}
if (kc) {
register_code (kc);
unregister_code (kc);
wait_ms (UNICODE_TYPE_DELAY);
}
}
}
bool process_ucis (uint16_t keycode, keyrecord_t *record) {
uint8_t i;
if (!qk_ucis_state.in_progress)
return true;
if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH &&
!(keycode == KC_BSPC || keycode == KC_ESC || keycode == KC_SPC || keycode == KC_ENT)) {
return false;
}
if (!record->event.pressed)
return true;
qk_ucis_state.codes[qk_ucis_state.count] = keycode;
qk_ucis_state.count++;
if (keycode == KC_BSPC) {
if (qk_ucis_state.count >= 2) {
qk_ucis_state.count -= 2;
return true;
} else {
qk_ucis_state.count--;
return false;
}
}
if (keycode == KC_ENT || keycode == KC_SPC || keycode == KC_ESC) {
bool symbol_found = false;
for (i = qk_ucis_state.count; i > 0; i--) {
register_code (KC_BSPC);
unregister_code (KC_BSPC);
wait_ms(UNICODE_TYPE_DELAY);
}
if (keycode == KC_ESC) {
qk_ucis_state.in_progress = false;
return false;
}
unicode_input_start();
for (i = 0; ucis_symbol_table[i].symbol; i++) {
if (is_uni_seq (ucis_symbol_table[i].symbol)) {
symbol_found = true;
register_ucis(ucis_symbol_table[i].code + 2);
break;
}
}
if (!symbol_found) {
qk_ucis_symbol_fallback();
}
unicode_input_finish();
qk_ucis_state.in_progress = false;
return false;
}
return true;
}
#endif

View file

@ -2,166 +2,8 @@
#define PROCESS_UNICODE_H
#include "quantum.h"
#define UC_OSX 0 // Mac OS X
#define UC_LNX 1 // Linux
#define UC_WIN 2 // Windows 'HexNumpad'
#define UC_BSD 3 // BSD (not implemented)
#define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose
#ifndef UNICODE_TYPE_DELAY
#define UNICODE_TYPE_DELAY 10
#endif
void set_unicode_input_mode(uint8_t os_target);
uint8_t get_unicode_input_mode(void);
void unicode_input_start(void);
void unicode_input_finish(void);
void register_hex(uint16_t hex);
#include "process_unicode_common.h"
bool process_unicode(uint16_t keycode, keyrecord_t *record);
#ifdef UNICODEMAP_ENABLE
void unicode_map_input_error(void);
bool process_unicode_map(uint16_t keycode, keyrecord_t *record);
#endif
#ifdef UCIS_ENABLE
#ifndef UCIS_MAX_SYMBOL_LENGTH
#define UCIS_MAX_SYMBOL_LENGTH 32
#endif
typedef struct {
char *symbol;
char *code;
} qk_ucis_symbol_t;
typedef struct {
uint8_t count;
uint16_t codes[UCIS_MAX_SYMBOL_LENGTH];
bool in_progress:1;
} qk_ucis_state_t;
extern qk_ucis_state_t qk_ucis_state;
#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, NULL}}
#define UCIS_SYM(name, code) {name, #code}
extern const qk_ucis_symbol_t ucis_symbol_table[];
void qk_ucis_start(void);
void qk_ucis_start_user(void);
void qk_ucis_symbol_fallback (void);
void register_ucis(const char *hex);
bool process_ucis (uint16_t keycode, keyrecord_t *record);
#endif
#define UC_BSPC UC(0x0008)
#define UC_SPC UC(0x0020)
#define UC_EXLM UC(0x0021)
#define UC_DQUT UC(0x0022)
#define UC_HASH UC(0x0023)
#define UC_DLR UC(0x0024)
#define UC_PERC UC(0x0025)
#define UC_AMPR UC(0x0026)
#define UC_QUOT UC(0x0027)
#define UC_LPRN UC(0x0028)
#define UC_RPRN UC(0x0029)
#define UC_ASTR UC(0x002A)
#define UC_PLUS UC(0x002B)
#define UC_COMM UC(0x002C)
#define UC_DASH UC(0x002D)
#define UC_DOT UC(0x002E)
#define UC_SLSH UC(0x002F)
#define UC_0 UC(0x0030)
#define UC_1 UC(0x0031)
#define UC_2 UC(0x0032)
#define UC_3 UC(0x0033)
#define UC_4 UC(0x0034)
#define UC_5 UC(0x0035)
#define UC_6 UC(0x0036)
#define UC_7 UC(0x0037)
#define UC_8 UC(0x0038)
#define UC_9 UC(0x0039)
#define UC_COLN UC(0x003A)
#define UC_SCLN UC(0x003B)
#define UC_LT UC(0x003C)
#define UC_EQL UC(0x003D)
#define UC_GT UC(0x003E)
#define UC_QUES UC(0x003F)
#define UC_AT UC(0x0040)
#define UC_A UC(0x0041)
#define UC_B UC(0x0042)
#define UC_C UC(0x0043)
#define UC_D UC(0x0044)
#define UC_E UC(0x0045)
#define UC_F UC(0x0046)
#define UC_G UC(0x0047)
#define UC_H UC(0x0048)
#define UC_I UC(0x0049)
#define UC_J UC(0x004A)
#define UC_K UC(0x004B)
#define UC_L UC(0x004C)
#define UC_M UC(0x004D)
#define UC_N UC(0x004E)
#define UC_O UC(0x004F)
#define UC_P UC(0x0050)
#define UC_Q UC(0x0051)
#define UC_R UC(0x0052)
#define UC_S UC(0x0053)
#define UC_T UC(0x0054)
#define UC_U UC(0x0055)
#define UC_V UC(0x0056)
#define UC_W UC(0x0057)
#define UC_X UC(0x0058)
#define UC_Y UC(0x0059)
#define UC_Z UC(0x005A)
#define UC_LBRC UC(0x005B)
#define UC_BSLS UC(0x005C)
#define UC_RBRC UC(0x005D)
#define UC_CIRM UC(0x005E)
#define UC_UNDR UC(0x005F)
#define UC_GRV UC(0x0060)
#define UC_a UC(0x0061)
#define UC_b UC(0x0062)
#define UC_c UC(0x0063)
#define UC_d UC(0x0064)
#define UC_e UC(0x0065)
#define UC_f UC(0x0066)
#define UC_g UC(0x0067)
#define UC_h UC(0x0068)
#define UC_i UC(0x0069)
#define UC_j UC(0x006A)
#define UC_k UC(0x006B)
#define UC_l UC(0x006C)
#define UC_m UC(0x006D)
#define UC_n UC(0x006E)
#define UC_o UC(0x006F)
#define UC_p UC(0x0070)
#define UC_q UC(0x0071)
#define UC_r UC(0x0072)
#define UC_s UC(0x0073)
#define UC_t UC(0x0074)
#define UC_u UC(0x0075)
#define UC_v UC(0x0076)
#define UC_w UC(0x0077)
#define UC_x UC(0x0078)
#define UC_y UC(0x0079)
#define UC_z UC(0x007A)
#define UC_LCBR UC(0x007B)
#define UC_PIPE UC(0x007C)
#define UC_RCBR UC(0x007D)
#define UC_TILD UC(0x007E)
#define UC_DEL UC(0x007F)
#endif

View file

@ -0,0 +1,85 @@
#include "process_unicode_common.h"
uint8_t mods;
void set_unicode_input_mode(uint8_t os_target)
{
input_mode = os_target;
}
uint8_t get_unicode_input_mode(void) {
return input_mode;
}
__attribute__((weak))
void unicode_input_start (void) {
// save current mods
mods = keyboard_report->mods;
// unregister all mods to start from clean state
if (mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT);
if (mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT);
if (mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL);
if (mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL);
if (mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT);
if (mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT);
if (mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI);
if (mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI);
switch(input_mode) {
case UC_OSX:
register_code(KC_LALT);
break;
case UC_LNX:
register_code(KC_LCTL);
register_code(KC_LSFT);
register_code(KC_U);
unregister_code(KC_U);
unregister_code(KC_LSFT);
unregister_code(KC_LCTL);
break;
case UC_WIN:
register_code(KC_LALT);
register_code(KC_PPLS);
unregister_code(KC_PPLS);
break;
case UC_WINC:
register_code(KC_RALT);
unregister_code(KC_RALT);
register_code(KC_U);
unregister_code(KC_U);
}
wait_ms(UNICODE_TYPE_DELAY);
}
__attribute__((weak))
void unicode_input_finish (void) {
switch(input_mode) {
case UC_OSX:
case UC_WIN:
unregister_code(KC_LALT);
break;
case UC_LNX:
register_code(KC_SPC);
unregister_code(KC_SPC);
break;
}
// reregister previously set mods
if (mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT);
if (mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT);
if (mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL);
if (mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL);
if (mods & MOD_BIT(KC_LALT)) register_code(KC_LALT);
if (mods & MOD_BIT(KC_RALT)) register_code(KC_RALT);
if (mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI);
if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI);
}
void register_hex(uint16_t hex) {
for(int i = 3; i >= 0; i--) {
uint8_t digit = ((hex >> (i*4)) & 0xF);
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
}
}

View file

@ -0,0 +1,132 @@
#ifndef PROCESS_UNICODE_COMMON_H
#define PROCESS_UNICODE_COMMON_H
#include "quantum.h"
#ifndef UNICODE_TYPE_DELAY
#define UNICODE_TYPE_DELAY 10
#endif
__attribute__ ((unused))
static uint8_t input_mode;
void set_unicode_input_mode(uint8_t os_target);
uint8_t get_unicode_input_mode(void);
void unicode_input_start(void);
void unicode_input_finish(void);
void register_hex(uint16_t hex);
#define UC_OSX 0 // Mac OS X
#define UC_LNX 1 // Linux
#define UC_WIN 2 // Windows 'HexNumpad'
#define UC_BSD 3 // BSD (not implemented)
#define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose
#define UC_BSPC UC(0x0008)
#define UC_SPC UC(0x0020)
#define UC_EXLM UC(0x0021)
#define UC_DQUT UC(0x0022)
#define UC_HASH UC(0x0023)
#define UC_DLR UC(0x0024)
#define UC_PERC UC(0x0025)
#define UC_AMPR UC(0x0026)
#define UC_QUOT UC(0x0027)
#define UC_LPRN UC(0x0028)
#define UC_RPRN UC(0x0029)
#define UC_ASTR UC(0x002A)
#define UC_PLUS UC(0x002B)
#define UC_COMM UC(0x002C)
#define UC_DASH UC(0x002D)
#define UC_DOT UC(0x002E)
#define UC_SLSH UC(0x002F)
#define UC_0 UC(0x0030)
#define UC_1 UC(0x0031)
#define UC_2 UC(0x0032)
#define UC_3 UC(0x0033)
#define UC_4 UC(0x0034)
#define UC_5 UC(0x0035)
#define UC_6 UC(0x0036)
#define UC_7 UC(0x0037)
#define UC_8 UC(0x0038)
#define UC_9 UC(0x0039)
#define UC_COLN UC(0x003A)
#define UC_SCLN UC(0x003B)
#define UC_LT UC(0x003C)
#define UC_EQL UC(0x003D)
#define UC_GT UC(0x003E)
#define UC_QUES UC(0x003F)
#define UC_AT UC(0x0040)
#define UC_A UC(0x0041)
#define UC_B UC(0x0042)
#define UC_C UC(0x0043)
#define UC_D UC(0x0044)
#define UC_E UC(0x0045)
#define UC_F UC(0x0046)
#define UC_G UC(0x0047)
#define UC_H UC(0x0048)
#define UC_I UC(0x0049)
#define UC_J UC(0x004A)
#define UC_K UC(0x004B)
#define UC_L UC(0x004C)
#define UC_M UC(0x004D)
#define UC_N UC(0x004E)
#define UC_O UC(0x004F)
#define UC_P UC(0x0050)
#define UC_Q UC(0x0051)
#define UC_R UC(0x0052)
#define UC_S UC(0x0053)
#define UC_T UC(0x0054)
#define UC_U UC(0x0055)
#define UC_V UC(0x0056)
#define UC_W UC(0x0057)
#define UC_X UC(0x0058)
#define UC_Y UC(0x0059)
#define UC_Z UC(0x005A)
#define UC_LBRC UC(0x005B)
#define UC_BSLS UC(0x005C)
#define UC_RBRC UC(0x005D)
#define UC_CIRM UC(0x005E)
#define UC_UNDR UC(0x005F)
#define UC_GRV UC(0x0060)
#define UC_a UC(0x0061)
#define UC_b UC(0x0062)
#define UC_c UC(0x0063)
#define UC_d UC(0x0064)
#define UC_e UC(0x0065)
#define UC_f UC(0x0066)
#define UC_g UC(0x0067)
#define UC_h UC(0x0068)
#define UC_i UC(0x0069)
#define UC_j UC(0x006A)
#define UC_k UC(0x006B)
#define UC_l UC(0x006C)
#define UC_m UC(0x006D)
#define UC_n UC(0x006E)
#define UC_o UC(0x006F)
#define UC_p UC(0x0070)
#define UC_q UC(0x0071)
#define UC_r UC(0x0072)
#define UC_s UC(0x0073)
#define UC_t UC(0x0074)
#define UC_u UC(0x0075)
#define UC_v UC(0x0076)
#define UC_w UC(0x0077)
#define UC_x UC(0x0078)
#define UC_y UC(0x0079)
#define UC_z UC(0x007A)
#define UC_LCBR UC(0x007B)
#define UC_PIPE UC(0x007C)
#define UC_RCBR UC(0x007D)
#define UC_TILD UC(0x007E)
#define UC_DEL UC(0x007F)
#endif

View file

@ -0,0 +1,54 @@
#include "process_unicodemap.h"
__attribute__((weak))
const uint32_t PROGMEM unicode_map[] = {
};
void register_hex32(uint32_t hex) {
uint8_t onzerostart = 1;
for(int i = 7; i >= 0; i--) {
if (i <= 3) {
onzerostart = 0;
}
uint8_t digit = ((hex >> (i*4)) & 0xF);
if (digit == 0) {
if (onzerostart == 0) {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
}
} else {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
onzerostart = 0;
}
}
}
__attribute__((weak))
void unicode_map_input_error() {}
bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
const uint32_t* map = unicode_map;
uint16_t index = keycode - QK_UNICODE_MAP;
uint32_t code = pgm_read_dword_far(&map[index]);
if (code > 0xFFFF && code <= 0x10ffff && input_mode == UC_OSX) {
// Convert to UTF-16 surrogate pair
code -= 0x10000;
uint32_t lo = code & 0x3ff;
uint32_t hi = (code & 0xffc00) >> 10;
unicode_input_start();
register_hex32(hi + 0xd800);
register_hex32(lo + 0xdc00);
unicode_input_finish();
} else if ((code > 0x10ffff && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) {
// when character is out of range supported by the OS
unicode_map_input_error();
} else {
unicode_input_start();
register_hex32(code);
unicode_input_finish();
}
}
return true;
}

View file

@ -0,0 +1,9 @@
#ifndef PROCESS_UNICODEMAP_H
#define PROCESS_UNICODEMAP_H
#include "quantum.h"
#include "process_unicode_common.h"
void unicode_map_input_error(void);
bool process_unicode_map(uint16_t keycode, keyrecord_t *record);
#endif

View file

@ -7,6 +7,10 @@
#define TAPPING_TERM 200
#endif
#ifdef FAUXCLICKY_ENABLE
#include "fauxclicky.h"
#endif
static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
switch (code) {
case QK_MODS ... QK_MODS_MAX:
@ -196,6 +200,26 @@ bool process_record_quantum(keyrecord_t *record) {
}
return false;
break;
#ifdef FAUXCLICKY_ENABLE
case FC_TOG:
if (record->event.pressed) {
FAUXCLICKY_TOGGLE;
}
return false;
break;
case FC_ON:
if (record->event.pressed) {
FAUXCLICKY_ON;
}
return false;
break;
case FC_OFF:
if (record->event.pressed) {
FAUXCLICKY_OFF;
}
return false;
break;
#endif
#ifdef RGBLIGHT_ENABLE
case RGB_TOG:
if (record->event.pressed) {
@ -948,6 +972,19 @@ void send_nibble(uint8_t number) {
}
}
__attribute__((weak))
uint16_t hex_to_keycode(uint8_t hex)
{
if (hex == 0x0) {
return KC_0;
} else if (hex < 0xA) {
return KC_1 + (hex - 0x1);
} else {
return KC_A + (hex - 0xA);
}
}
void api_send_unicode(uint32_t unicode) {
#ifdef API_ENABLE
uint8_t chunk[4];

View file

@ -56,6 +56,14 @@ extern uint32_t default_layer_state;
#include "process_unicode.h"
#endif
#ifdef UCIS_ENABLE
#include "process_ucis.h"
#endif
#ifdef UNICODEMAP_ENABLE
#include "process_unicodemap.h"
#endif
#include "process_tap_dance.h"
#ifdef PRINTING_ENABLE
@ -117,7 +125,7 @@ void send_dword(uint32_t number);
void send_word(uint16_t number);
void send_byte(uint8_t number);
void send_nibble(uint8_t number);
uint16_t hex_to_keycode(uint8_t hex);
void led_set_user(uint8_t usb_led);
void led_set_kb(uint8_t usb_led);

View file

@ -41,16 +41,21 @@ enum quantum_keycodes {
#endif
QK_TAP_DANCE = 0x5700,
QK_TAP_DANCE_MAX = 0x57FF,
#ifdef UNICODEMAP_ENABLE
QK_UNICODE_MAP = 0x5800,
QK_UNICODE_MAP_MAX = 0x5BFF,
#endif
QK_LAYER_TAP_TOGGLE = 0x5800,
QK_LAYER_TAP_TOGGLE_MAX = 0x58FF,
QK_MOD_TAP = 0x6000,
QK_MOD_TAP_MAX = 0x7FFF,
#if defined(UNICODEMAP_ENABLE) && defined(UNICODE_ENABLE)
#error "Cannot enable both UNICODEMAP && UNICODE"
#endif
#ifdef UNICODE_ENABLE
QK_UNICODE = 0x8000,
QK_UNICODE_MAX = 0xFFFF,
#endif
#ifdef UNICODEMAP_ENABLE
QK_UNICODE_MAP = 0x8000,
QK_UNICODE_MAP_MAX = 0x83FF,
#endif
// Loose keycodes - to be used directly
@ -86,6 +91,13 @@ enum quantum_keycodes {
AU_OFF,
AU_TOG,
#ifdef FAUXCLICKY_ENABLE
// Faux clicky
FC_ON,
FC_OFF,
FC_TOG,
#endif
// Music mode on/off/toggle
MU_ON,
MU_OFF,
@ -297,6 +309,9 @@ enum quantum_keycodes {
// One-shot mod
#define OSM(mod) (mod | QK_ONE_SHOT_MOD)
// Layer tap-toggle
#define TT(layer) (layer | QK_LAYER_TAP_TOGGLE)
// M-od, T-ap - 256 keycode max
#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0x1F) << 8))

View file

@ -65,3 +65,4 @@ MIDI_ENABLE ?= no # MIDI controls
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6
FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches

View file

@ -33,6 +33,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nodebug.h"
#endif
#ifdef FAUXCLICKY_ENABLE
#include <fauxclicky.h>
#endif
void action_exec(keyevent_t event)
{
@ -41,6 +44,16 @@ void action_exec(keyevent_t event)
dprint("EVENT: "); debug_event(event); dprintln();
}
#ifdef FAUXCLICKY_ENABLE
if (IS_PRESSED(event)) {
FAUXCLICKY_ACTION_PRESS;
}
if (IS_RELEASED(event)) {
FAUXCLICKY_ACTION_RELEASE;
}
fauxclicky_check();
#endif
#ifdef ONEHAND_ENABLE
if (!IS_NOEVENT(event)) {
process_hand_swap(&event);

View file

@ -16,8 +16,14 @@
*/
uint32_t default_layer_state = 0;
__attribute__((weak))
uint32_t default_layer_state_set_kb(uint32_t state) {
return state;
}
static void default_layer_state_set(uint32_t state)
{
state = default_layer_state_set_kb(state);
debug("default_layer_state: ");
default_layer_debug(); debug(" to ");
default_layer_state = state;
@ -57,8 +63,14 @@ void default_layer_xor(uint32_t state)
*/
uint32_t layer_state = 0;
__attribute__((weak))
uint32_t layer_state_set_kb(uint32_t state) {
return state;
}
static void layer_state_set(uint32_t state)
{
state = layer_state_set_kb(state);
dprint("layer_state: ");
layer_debug(); dprint(" to ");
layer_state = state;

View file

@ -29,6 +29,9 @@ extern uint32_t default_layer_state;
void default_layer_debug(void);
void default_layer_set(uint32_t state);
__attribute__((weak))
uint32_t default_layer_state_set_kb(uint32_t state);
#ifndef NO_ACTION_LAYER
/* bitwise operation */
void default_layer_or(uint32_t state);
@ -69,6 +72,8 @@ void layer_xor(uint32_t state);
#define layer_xor(state)
#define layer_debug()
__attribute__((weak))
uint32_t layer_state_set_kb(uint32_t state);
#endif
/* pressed actions cache */

View file

@ -51,6 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef RGBLIGHT_ENABLE
# include "rgblight.h"
#endif
#ifdef FAUXCLICKY_ENABLE
# include "fauxclicky.h"
#endif
#ifdef SERIAL_LINK_ENABLE
# include "serial_link/system/serial_link.h"
#endif
@ -108,6 +111,9 @@ void keyboard_init(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_init();
#endif
#ifdef FAUXCLICKY_ENABLE
fauxclicky_init();
#endif
#if defined(NKRO_ENABLE) && defined(FORCE_NKRO)
keymap_config.nkro = 1;
#endif

View file

@ -7,7 +7,7 @@ rev=$(git rev-parse --short HEAD)
git config --global user.name "Travis CI"
git config --global user.email "jack.humb+travis.ci@gmail.com"
if [[ "$TRAVIS_BRANCH" == "master" ]] ; then
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
increment_version ()
{