explicit modifiers
parent
9c81274348
commit
f52da5065a
|
@ -30,16 +30,19 @@ class Key
|
||||||
Layers = [ :basic, :punc, :nav, :func ]
|
Layers = [ :basic, :punc, :nav, :func ]
|
||||||
|
|
||||||
Functions = {
|
Functions = {
|
||||||
# down up
|
# down up
|
||||||
"basic" => [ "&kbfun_press_release", ],
|
"basic" => [ "&kbfun_normal_press_release", ],
|
||||||
"media" => [ "&kbfun_mediakey_press_release", ],
|
"media" => [ "&kbfun_mediakey_press_release", ],
|
||||||
# down up
|
# down up
|
||||||
"layer" => [ "&kbfun_layer_enable", "&kbfun_layer_disable" ],
|
"mod" => [ "&kbfun_modifier_press_release", ],
|
||||||
"latch" => [ "&kbfun_layer_sticky", ],
|
"sticky_mod" => [ "&kbfun_modifier_sticky", ],
|
||||||
# down up
|
# down up
|
||||||
"shifted" => [ "&kbfun_shift_press_release", ],
|
"layer" => [ "&kbfun_layer_enable", "&kbfun_layer_disable" ],
|
||||||
"ctrled" => [ "&kbfun_control_press_release", ],
|
"sticky" => [ "&kbfun_layer_sticky", ],
|
||||||
"capslock" => [ "&kbfun_2_keys_capslock_press_release", ],
|
# down up
|
||||||
|
"shifted" => [ "&kbfun_shift_press_release", ],
|
||||||
|
"ctrled" => [ "&kbfun_control_press_release", ],
|
||||||
|
"capslock" => [ "&kbfun_capslock_press_release", ],
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys = {
|
Keys = {
|
||||||
|
@ -157,15 +160,15 @@ class Key
|
||||||
"insert" => "KEY_Insert",
|
"insert" => "KEY_Insert",
|
||||||
"menu" => "KEY_Application",
|
"menu" => "KEY_Application",
|
||||||
#
|
#
|
||||||
"alt" => "KEY_LeftAlt",
|
"alt" => "MOD_KEY_LeftAlt",
|
||||||
"alt_gr" => "KEY_RightAlt",
|
"alt_gr" => "MOD_KEY_RightAlt",
|
||||||
"umlaut" => "KEY_RightAlt",
|
"umlaut" => "MOD_KEY_RightAlt",
|
||||||
"control" => "KEY_LeftControl",
|
"control" => "MOD_KEY_LeftControl",
|
||||||
"control_l" => "KEY_LeftControl",
|
"control_l" => "MOD_KEY_LeftControl",
|
||||||
"control_r" => "KEY_RightControl",
|
"control_r" => "MOD_KEY_RightControl",
|
||||||
"win" => "KEY_LeftGUI",
|
"win" => "MOD_KEY_LeftGUI",
|
||||||
"shift_l" => "KEY_LeftShift",
|
"shift_l" => "MOD_KEY_LeftShift",
|
||||||
"shift_r" => "KEY_RightShift",
|
"shift_r" => "MOD_KEY_RightShift",
|
||||||
"scroll_lock" => "KEY_ScrollLock",
|
"scroll_lock" => "KEY_ScrollLock",
|
||||||
#
|
#
|
||||||
"NULL" => "KEY_NULL",
|
"NULL" => "KEY_NULL",
|
||||||
|
@ -206,13 +209,32 @@ class Key
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# FIXME better defaults
|
||||||
|
type ||= "basic"
|
||||||
|
|
||||||
keycode = Keys[key]
|
keycode = Keys[key]
|
||||||
up, down = Functions[type] || Functions["basic"]
|
up, down = Functions[type]
|
||||||
down ||= up
|
down ||= up
|
||||||
|
|
||||||
raise "key not found: #{key}" if keycode.nil?
|
raise "key not found: #{key}" if keycode.nil?
|
||||||
raise "type not found: #{type}" if up.nil? or down.nil?
|
raise "type not found: #{type}" if up.nil? or down.nil?
|
||||||
|
|
||||||
|
case type
|
||||||
|
when "layer", "stitcky"
|
||||||
|
raise "invalid layer: #{key}" unless key.to_i < Key::Layers.size
|
||||||
|
when "mod", "sticky_mod"
|
||||||
|
raise "invalid modifier: #{key}" unless keycode.start_with? "MOD_KEY"
|
||||||
|
end
|
||||||
|
|
||||||
|
case keycode
|
||||||
|
when /^MOD_KEY/
|
||||||
|
case type
|
||||||
|
when "mod", "sticky_mod", "capslock"; # pass
|
||||||
|
else
|
||||||
|
raise "invalid modifier keyfunc: #{key}, #{type}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@layers[i] = Layer.new(keycode, down, up)
|
@layers[i] = Layer.new(keycode, down, up)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -281,7 +303,7 @@ keys = [
|
||||||
%w{ tab }, %w{ }, %w{ }, %w{ }, # 1.5
|
%w{ tab }, %w{ }, %w{ }, %w{ }, # 1.5
|
||||||
# home
|
# home
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ umlaut }, %w{ }, %w{ }, %w{ }, # 1.5
|
%w{ umlaut mod }, %w{ }, %w{ }, %w{ }, # 1.5
|
||||||
%w{ u }, %w{ , }, %w{ left }, %w{ audio_mute media },
|
%w{ u }, %w{ , }, %w{ left }, %w{ audio_mute media },
|
||||||
%w{ i }, %w{ \{ shifted }, %w{ up }, %w{ audio_vol_up media },
|
%w{ i }, %w{ \{ shifted }, %w{ up }, %w{ audio_vol_up media },
|
||||||
%w{ a }, %w{ ? shifted }, %w{ down }, %w{ audio_vol_down media },
|
%w{ a }, %w{ ? shifted }, %w{ down }, %w{ audio_vol_down media },
|
||||||
|
@ -302,7 +324,7 @@ keys = [
|
||||||
%w{ up }, %w{ }, %w{ }, %w{ },
|
%w{ up }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ down }, %w{ }, %w{ }, %w{ },
|
%w{ down }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ right }, %w{ }, %w{ }, %w{ },
|
%w{ right }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ win }, %w{ }, %w{ }, %w{ },
|
%w{ win mod }, %w{ }, %w{ }, %w{ },
|
||||||
# thumb-top
|
# thumb-top
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ scroll_lock }, %w{ }, %w{ }, %w{ },
|
%w{ scroll_lock }, %w{ }, %w{ }, %w{ },
|
||||||
|
@ -310,13 +332,13 @@ keys = [
|
||||||
# thumb-double
|
# thumb-double
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ space }, %w{ }, %w{ }, %w{ },
|
%w{ space }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ control }, %w{ }, %w{ }, %w{ },
|
%w{ control mod }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ alt }, %w{ }, %w{ }, %w{ },
|
%w{ alt mod }, %w{ }, %w{ }, %w{ },
|
||||||
# thumb-home
|
# thumb-home
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ space }, %w{ }, %w{ }, %w{ },
|
%w{ space }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ control }, %w{ }, %w{ }, %w{ },
|
%w{ control mod }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ alt }, %w{ }, %w{ }, %w{ },
|
%w{ alt mod }, %w{ }, %w{ }, %w{ },
|
||||||
#
|
#
|
||||||
# right hand
|
# right hand
|
||||||
#
|
#
|
||||||
|
@ -345,7 +367,7 @@ keys = [
|
||||||
%w{ r }, %w{ / }, %w{ 2 }, %w{ f2 },
|
%w{ r }, %w{ / }, %w{ 2 }, %w{ f2 },
|
||||||
%w{ t }, %w{ \} shifted }, %w{ 3 }, %w{ f3 },
|
%w{ t }, %w{ \} shifted }, %w{ 3 }, %w{ f3 },
|
||||||
%w{ d }, %w{ . }, %w{ 4 }, %w{ f4 },
|
%w{ d }, %w{ . }, %w{ 4 }, %w{ f4 },
|
||||||
%w{ umlaut }, %w{ }, %w{ }, %w{ }, # 1.5
|
%w{ umlaut mod }, %w{ }, %w{ }, %w{ }, # 1.5
|
||||||
# bottom
|
# bottom
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ enter }, %w{ }, %w{ }, %w{ }, # 1.5
|
%w{ enter }, %w{ }, %w{ }, %w{ }, # 1.5
|
||||||
|
@ -370,12 +392,12 @@ keys = [
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ menu }, %w{ }, %w{ }, %w{ },
|
%w{ menu }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ func layer }, %w{ }, %w{ }, %w{ },
|
%w{ func layer }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ punc latch }, %w{ punc layer }, %w{ NULL }, %w{ NULL },
|
%w{ punc sticky }, %w{ punc layer }, %w{ NULL }, %w{ NULL },
|
||||||
# thumb-home
|
# thumb-home
|
||||||
# letter type punc type nav type func type
|
# letter type punc type nav type func type
|
||||||
%w{ menu }, %w{ }, %w{ }, %w{ },
|
%w{ menu }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ func layer }, %w{ }, %w{ }, %w{ },
|
%w{ func layer }, %w{ }, %w{ }, %w{ },
|
||||||
%w{ punc latch }, %w{ punc layer }, %w{ NULL }, %w{ NULL },
|
%w{ punc sticky }, %w{ punc layer }, %w{ NULL }, %w{ NULL },
|
||||||
|
|
||||||
].each_slice(Key::Layers.size).map do |layers|
|
].each_slice(Key::Layers.size).map do |layers|
|
||||||
Key.new layers
|
Key.new layers
|
||||||
|
|
|
@ -352,3 +352,27 @@ static const uint16_t PROGMEM _media_code_lookup_table[] = {
|
||||||
AC_REFRESH, // MEDIAKEY_BROWSER_REFRESH
|
AC_REFRESH, // MEDIAKEY_BROWSER_REFRESH
|
||||||
AC_BOOKMARKS, // MEDIAKEY_BROWSER_BOOKMARKS
|
AC_BOOKMARKS, // MEDIAKEY_BROWSER_BOOKMARKS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// modifiers
|
||||||
|
|
||||||
|
#define MOD_KEY_LeftControl 0
|
||||||
|
#define MOD_KEY_LeftShift 1
|
||||||
|
#define MOD_KEY_LeftAlt 2
|
||||||
|
#define MOD_KEY_LeftGUI 3
|
||||||
|
#define MOD_KEY_RightControl 4
|
||||||
|
#define MOD_KEY_RightShift 5
|
||||||
|
#define MOD_KEY_RightAlt 6
|
||||||
|
#define MOD_KEY_RightGUI 7
|
||||||
|
|
||||||
|
static const uint8_t PROGMEM _modifier_lookup_table[] = {
|
||||||
|
KEY_LeftControl,
|
||||||
|
KEY_LeftShift,
|
||||||
|
KEY_LeftAlt,
|
||||||
|
KEY_LeftGUI,
|
||||||
|
KEY_RightControl,
|
||||||
|
KEY_RightShift,
|
||||||
|
KEY_RightAlt,
|
||||||
|
KEY_RightGUI,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MODIFIERS sizeof(_modifier_lookup_table)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
162
src/main.c
162
src/main.c
|
@ -254,75 +254,47 @@ keyfunc kb_keyfunc_release (layer l, u8 row, u8 col) { return (keyfunc) pgm_read
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// basic keypresses
|
// basic keypresses
|
||||||
void _kbfun_press_release(bool press, keycode key) {
|
void _kbfun_normal_press_release(bool press, keycode key) {
|
||||||
// no-op
|
if (key == 0) { return; } // noop
|
||||||
if (key == 0) { return; }
|
|
||||||
|
|
||||||
if (press) {
|
if (press) {
|
||||||
_kbfun_press(key);
|
for (u8 i=0; i < sizeof(keyboard_keys); i++) {
|
||||||
|
if (keyboard_keys[i] == 0) {
|
||||||
|
keyboard_keys[i] = key;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_kbfun_release(key);
|
for (u8 i=0; i < sizeof(keyboard_keys); i++) {
|
||||||
}
|
if (keyboard_keys[i] == key) {
|
||||||
}
|
keyboard_keys[i] = 0;
|
||||||
|
return;
|
||||||
void _kbfun_press(keycode key) {
|
}
|
||||||
// modifier keys
|
|
||||||
switch (key) {
|
|
||||||
case KEY_LeftControl: keyboard_modifier_keys |= (1<<0); return;
|
|
||||||
case KEY_LeftShift: keyboard_modifier_keys |= (1<<1); return;
|
|
||||||
case KEY_LeftAlt: keyboard_modifier_keys |= (1<<2); return;
|
|
||||||
case KEY_LeftGUI: keyboard_modifier_keys |= (1<<3); return;
|
|
||||||
case KEY_RightControl: keyboard_modifier_keys |= (1<<4); return;
|
|
||||||
case KEY_RightShift: keyboard_modifier_keys |= (1<<5); return;
|
|
||||||
case KEY_RightAlt: keyboard_modifier_keys |= (1<<6); return;
|
|
||||||
case KEY_RightGUI: keyboard_modifier_keys |= (1<<7); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// all others
|
|
||||||
for (u8 i=0; i < sizeof(keyboard_keys); i++) {
|
|
||||||
if (keyboard_keys[i] == 0) {
|
|
||||||
keyboard_keys[i] = key;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _kbfun_release(keycode key) {
|
void _kbfun_mediakey_press_release(bool press, keycode key) {
|
||||||
// modifier keys
|
media_keycode media_key = _media_code_lookup_table[key];
|
||||||
switch (key) {
|
if (press) {
|
||||||
case KEY_LeftControl: keyboard_modifier_keys &= ~(1<<0); return;
|
consumer_key = media_key;
|
||||||
case KEY_LeftShift: keyboard_modifier_keys &= ~(1<<1); return;
|
} else {
|
||||||
case KEY_LeftAlt: keyboard_modifier_keys &= ~(1<<2); return;
|
// only one media key can be pressed at a time, so only clear most recent one
|
||||||
case KEY_LeftGUI: keyboard_modifier_keys &= ~(1<<3); return;
|
if (media_key == consumer_key) {
|
||||||
case KEY_RightControl: keyboard_modifier_keys &= ~(1<<4); return;
|
consumer_key = 0;
|
||||||
case KEY_RightShift: keyboard_modifier_keys &= ~(1<<5); return;
|
|
||||||
case KEY_RightAlt: keyboard_modifier_keys &= ~(1<<6); return;
|
|
||||||
case KEY_RightGUI: keyboard_modifier_keys &= ~(1<<7); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// all others
|
|
||||||
for (u8 i=0; i < sizeof(keyboard_keys); i++) {
|
|
||||||
if (keyboard_keys[i] == key) {
|
|
||||||
keyboard_keys[i] = 0;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _kbfun_is_pressed(keycode key) {
|
void _kbfun_modifier_press_release(bool press, keycode key) {
|
||||||
// modifier keys
|
if (press) {
|
||||||
switch (key) {
|
keyboard_modifier_keys |= (1<<key);
|
||||||
case KEY_LeftControl: return (keyboard_modifier_keys & (1<<0));
|
} else {
|
||||||
case KEY_LeftShift: return (keyboard_modifier_keys & (1<<1));
|
keyboard_modifier_keys &= ~(1<<key);
|
||||||
case KEY_LeftAlt: return (keyboard_modifier_keys & (1<<2));
|
|
||||||
case KEY_LeftGUI: return (keyboard_modifier_keys & (1<<3));
|
|
||||||
case KEY_RightControl: return (keyboard_modifier_keys & (1<<4));
|
|
||||||
case KEY_RightShift: return (keyboard_modifier_keys & (1<<5));
|
|
||||||
case KEY_RightAlt: return (keyboard_modifier_keys & (1<<6));
|
|
||||||
case KEY_RightGUI: return (keyboard_modifier_keys & (1<<7));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// all others
|
bool _kbfun_normal_is_pressed(keycode key) {
|
||||||
for (u8 i=0; i < sizeof(keyboard_keys); i++) {
|
for (u8 i=0; i < sizeof(keyboard_keys); i++) {
|
||||||
if (keyboard_keys[i] == key) {
|
if (keyboard_keys[i] == key) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -332,16 +304,12 @@ bool _kbfun_is_pressed(keycode key) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _kbfun_mediakey_press_release(bool press, keycode key) {
|
bool _kbfun_mediakey_is_pressed(keycode key) {
|
||||||
media_keycode media_key = _media_code_lookup_table[key];
|
return (consumer_key != 0);
|
||||||
if (press) {
|
}
|
||||||
consumer_key = media_key;
|
|
||||||
} else {
|
bool _kbfun_modifier_is_pressed(keycode key) {
|
||||||
// only one media key can be pressed at a time, so only clear most recent one
|
return (keyboard_modifier_keys & (1<<key));
|
||||||
if (media_key == consumer_key) {
|
|
||||||
consumer_key = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -365,33 +333,21 @@ void exec_key() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool key_is_modifier(keycode key) {
|
|
||||||
switch (key) {
|
|
||||||
case KEY_LeftControl: return true;
|
|
||||||
case KEY_LeftShift: return true;
|
|
||||||
case KEY_LeftAlt: return true;
|
|
||||||
case KEY_LeftGUI: return true;
|
|
||||||
case KEY_RightControl: return true;
|
|
||||||
case KEY_RightShift: return true;
|
|
||||||
case KEY_RightAlt: return true;
|
|
||||||
case KEY_RightGUI: return true;
|
|
||||||
default: return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// normal key
|
// normal key
|
||||||
void kbfun_press_release() {
|
void kbfun_normal_press_release() {
|
||||||
if (!key_is_modifier(current_keycode)) {
|
sticky_done = true;
|
||||||
sticky_done = true;
|
_kbfun_normal_press_release(current_is_pressed, current_keycode);
|
||||||
}
|
|
||||||
_kbfun_press_release(current_is_pressed, current_keycode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// media key
|
// media key
|
||||||
void kbfun_mediakey_press_release() {
|
void kbfun_mediakey_press_release() {
|
||||||
sticky_done = true;
|
sticky_done = true;
|
||||||
keycode key = current_keycode;
|
_kbfun_mediakey_press_release(current_is_pressed, current_keycode);
|
||||||
_kbfun_mediakey_press_release(current_is_pressed, key);
|
}
|
||||||
|
|
||||||
|
// modifier
|
||||||
|
void kbfun_modifier_press_release() {
|
||||||
|
_kbfun_modifier_press_release(current_is_pressed, current_keycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable layer
|
// enable layer
|
||||||
|
@ -449,17 +405,17 @@ void kbfun_layer_sticky() {
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void _kbfun_combo_press_release(keycode combo_key) {
|
void _kbfun_combo_press_release(keycode combo_key) {
|
||||||
_kbfun_press_release(current_is_pressed, combo_key);
|
_kbfun_modifier_press_release(current_is_pressed, combo_key);
|
||||||
kbfun_press_release();
|
kbfun_normal_press_release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void kbfun_shift_press_release() { _kbfun_combo_press_release(KEY_LeftShift); } // +shift
|
void kbfun_shift_press_release() { _kbfun_combo_press_release(MOD_KEY_LeftShift); } // +shift
|
||||||
void kbfun_control_press_release() { _kbfun_combo_press_release(KEY_LeftControl); } // +control
|
void kbfun_control_press_release() { _kbfun_combo_press_release(MOD_KEY_LeftControl); } // +control
|
||||||
void kbfun_alt_press_release() { _kbfun_combo_press_release(KEY_LeftAlt); } // +alt
|
void kbfun_alt_press_release() { _kbfun_combo_press_release(MOD_KEY_LeftAlt); } // +alt
|
||||||
void kbfun_win_press_release() { _kbfun_combo_press_release(KEY_LeftGUI); } // +win
|
void kbfun_win_press_release() { _kbfun_combo_press_release(MOD_KEY_LeftGUI); } // +win
|
||||||
|
|
||||||
// capslock
|
// capslock
|
||||||
void kbfun_2_keys_capslock_press_release() {
|
void kbfun_capslock_press_release() {
|
||||||
static u8 keys_pressed;
|
static u8 keys_pressed;
|
||||||
static bool lshift_pressed;
|
static bool lshift_pressed;
|
||||||
static bool rshift_pressed;
|
static bool rshift_pressed;
|
||||||
|
@ -469,24 +425,24 @@ void kbfun_2_keys_capslock_press_release() {
|
||||||
if (!current_is_pressed) { keys_pressed--; }
|
if (!current_is_pressed) { keys_pressed--; }
|
||||||
|
|
||||||
// take care of the key that was actually pressed
|
// take care of the key that was actually pressed
|
||||||
_kbfun_press_release(current_is_pressed, key);
|
_kbfun_modifier_press_release(current_is_pressed, key);
|
||||||
|
|
||||||
// take care of capslock (only on the press of the 2nd key)
|
// take care of capslock (only on the press of the 2nd key)
|
||||||
if (keys_pressed == 1 && current_is_pressed) {
|
if (keys_pressed == 1 && current_is_pressed) {
|
||||||
// save the state of left and right shift
|
// save the state of left and right shift
|
||||||
lshift_pressed = _kbfun_is_pressed(KEY_LeftShift);
|
lshift_pressed = _kbfun_modifier_is_pressed(MOD_KEY_LeftShift);
|
||||||
rshift_pressed = _kbfun_is_pressed(KEY_RightShift);
|
rshift_pressed = _kbfun_modifier_is_pressed(MOD_KEY_RightShift);
|
||||||
// disable both
|
// disable both
|
||||||
_kbfun_press_release(false, KEY_LeftShift);
|
_kbfun_modifier_press_release(false, MOD_KEY_LeftShift);
|
||||||
_kbfun_press_release(false, KEY_RightShift);
|
_kbfun_modifier_press_release(false, MOD_KEY_RightShift);
|
||||||
|
|
||||||
// press capslock, then release it
|
// press capslock, then release it
|
||||||
_kbfun_press_release(true, KEY_CapsLock); usb_keyboard_send();
|
_kbfun_normal_press_release(true, KEY_CapsLock); usb_keyboard_send();
|
||||||
_kbfun_press_release(false, KEY_CapsLock); usb_keyboard_send();
|
_kbfun_normal_press_release(false, KEY_CapsLock); usb_keyboard_send();
|
||||||
|
|
||||||
// restore the state of left and right shift
|
// restore the state of left and right shift
|
||||||
if (lshift_pressed) { _kbfun_press_release(true, KEY_LeftShift); }
|
if (lshift_pressed) { _kbfun_modifier_press_release(true, MOD_KEY_LeftShift); }
|
||||||
if (rshift_pressed) { _kbfun_press_release(true, KEY_RightShift); }
|
if (rshift_pressed) { _kbfun_modifier_press_release(true, MOD_KEY_RightShift); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_is_pressed) { keys_pressed++; }
|
if (current_is_pressed) { keys_pressed++; }
|
||||||
|
|
15
src/main.h
15
src/main.h
|
@ -1,18 +1,19 @@
|
||||||
/* This file was automatically generated. Do not edit! */
|
/* This file was automatically generated. Do not edit! */
|
||||||
void kbfun_2_keys_capslock_press_release();
|
void kbfun_capslock_press_release();
|
||||||
void kbfun_win_press_release();
|
void kbfun_win_press_release();
|
||||||
void kbfun_alt_press_release();
|
void kbfun_alt_press_release();
|
||||||
void kbfun_control_press_release();
|
void kbfun_control_press_release();
|
||||||
void kbfun_shift_press_release();
|
void kbfun_shift_press_release();
|
||||||
void _kbfun_combo_press_release(keycode combo_key);
|
void _kbfun_combo_press_release(keycode combo_key);
|
||||||
|
void kbfun_modifier_press_release();
|
||||||
void kbfun_mediakey_press_release();
|
void kbfun_mediakey_press_release();
|
||||||
void kbfun_press_release();
|
void kbfun_normal_press_release();
|
||||||
bool key_is_modifier(keycode key);
|
bool _kbfun_modifier_is_pressed(keycode key);
|
||||||
|
bool _kbfun_mediakey_is_pressed(keycode key);
|
||||||
|
bool _kbfun_normal_is_pressed(keycode key);
|
||||||
|
void _kbfun_modifier_press_release(bool press,keycode key);
|
||||||
void _kbfun_mediakey_press_release(bool press,keycode key);
|
void _kbfun_mediakey_press_release(bool press,keycode key);
|
||||||
bool _kbfun_is_pressed(keycode key);
|
void _kbfun_normal_press_release(bool press,keycode key);
|
||||||
void _kbfun_release(keycode key);
|
|
||||||
void _kbfun_press(keycode key);
|
|
||||||
void _kbfun_press_release(bool press,keycode key);
|
|
||||||
keyfunc kb_keyfunc_release(layer l,u8 row,u8 col);
|
keyfunc kb_keyfunc_release(layer l,u8 row,u8 col);
|
||||||
keyfunc kb_keyfunc_press(layer l,u8 row,u8 col);
|
keyfunc kb_keyfunc_press(layer l,u8 row,u8 col);
|
||||||
void layer_enable_upto(layer max_layer);
|
void layer_enable_upto(layer max_layer);
|
||||||
|
|
Loading…
Reference in New Issue