separated kbfun_layer_inc_exec() and ...dec_exec()
also added another layer to _kb_layout_release[][][], mostly NULL, but including at least one of each available kbfun*(). this way, all the functions appear to be used, and none of them get optimised out by the compilerpartial-rewrite
parent
d1fa583bb3
commit
06bfe3c037
|
@ -25,8 +25,9 @@
|
|||
#define f_l_set &kbfun_layer_set
|
||||
#define f_l_inc &kbfun_layer_inc
|
||||
#define f_l_dec &kbfun_layer_dec
|
||||
#define f_l_iex &kbfun_layer_inc_exec
|
||||
#define f_l_dex &kbfun_layer_dec_exec
|
||||
#define f_2kcap &kbfun_2_keys_capslock_press_release
|
||||
#define f_lidpr &kbfun_layer_inc_dec_press_release
|
||||
|
||||
|
||||
uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS] = {
|
||||
|
@ -171,7 +172,24 @@ f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,
|
|||
f_prrel,f_prrel,f_prrel,f_prrel,f_prrel,
|
||||
f_prrel,
|
||||
f_prrel, f_prrel,
|
||||
f_prrel,f_prrel,f_prrel )
|
||||
f_prrel,f_prrel,f_prrel ),
|
||||
// ----------------------------------------------------------------------------
|
||||
LAYER( // layer 2: nothing (just making sure unused functions don't
|
||||
// get compiled out)
|
||||
// unused
|
||||
NULL,
|
||||
// other
|
||||
f_prrel, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
f_toggl, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
f_l_set, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
f_l_inc, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
f_l_dec, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
f_l_iex, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
f_l_dex, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
f_2kcap, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL )
|
||||
// ----------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
|
|
|
@ -245,6 +245,56 @@ void kbfun_layer_dec( KBFUN_FUNCTION_ARGS ) {
|
|||
current_layers_ );
|
||||
}
|
||||
|
||||
/*
|
||||
* Increase layer, Execute key
|
||||
* - Increment the current layer by the value specified in the keymap (for all
|
||||
* non-masked keys), and execute (usually press|release) the key in the same
|
||||
* position on that new layer
|
||||
*
|
||||
* Note
|
||||
* - Meant to be paired with `kbfun_layer_dec_exec()`
|
||||
*/
|
||||
void kbfun_layer_inc_exec( KBFUN_FUNCTION_ARGS ) {
|
||||
// switch layers
|
||||
_layer_set_current(
|
||||
(*current_layer_) + keycode_,
|
||||
current_layer_,
|
||||
current_layers_ );
|
||||
|
||||
// exececute second key (in the same position)
|
||||
// - `layer_+keycode_` will be constant (under normal circumstances)
|
||||
// between the press and release
|
||||
_kbfun_exec_key(
|
||||
pressed_, 0, layer_+keycode_,
|
||||
row_, col_, current_layer_,
|
||||
current_layers_, pressed_layers_ );
|
||||
}
|
||||
|
||||
/*
|
||||
* Decrease layer, Execute key
|
||||
* - Decrement the current layer by the value specified in the keymap (for all
|
||||
* non-masked keys), and execute (usually press|release) the key in the same
|
||||
* position on that new layer
|
||||
*
|
||||
* Note
|
||||
* - Meant to be paired with `kbfun_layer_inc_exec()`
|
||||
*/
|
||||
void kbfun_layer_dec_exec( KBFUN_FUNCTION_ARGS ) {
|
||||
// switch layers
|
||||
_layer_set_current(
|
||||
(*current_layer_) - keycode_,
|
||||
current_layer_,
|
||||
current_layers_ );
|
||||
|
||||
// exececute second key (in the same position)
|
||||
// - `layer_+keycode_` will be constant (under normal circumstances)
|
||||
// between the press and release
|
||||
_kbfun_exec_key(
|
||||
pressed_, 0, layer_+keycode_,
|
||||
row_, col_, current_layer_,
|
||||
current_layers_, pressed_layers_ );
|
||||
}
|
||||
|
||||
/*
|
||||
* Two keys => capslock
|
||||
* - When assigned to two keys (e.g. the physical left and right shift keys)
|
||||
|
@ -292,25 +342,3 @@ void kbfun_2_keys_capslock_press_release( KBFUN_FUNCTION_ARGS ) {
|
|||
if (pressed_) keys_pressed++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Layer (inc|dec), key (press|release)
|
||||
* - Increment (for press) or decrement (for release) the current layer by the
|
||||
* value specified in the keymap (for all non-masked keys), and press or
|
||||
* release the key in the same position on that new layer
|
||||
*/
|
||||
void kbfun_layer_inc_dec_press_release( KBFUN_FUNCTION_ARGS ) {
|
||||
// switch layers
|
||||
_layer_set_current(
|
||||
( (pressed_)
|
||||
? (*current_layer_) + keycode_
|
||||
: (*current_layer_) - keycode_ ),
|
||||
current_layer_,
|
||||
current_layers_ );
|
||||
|
||||
// exececute second key (in the same position)
|
||||
_kbfun_exec_key(
|
||||
pressed_, 0, layer_+keycode_,
|
||||
row_, col_, current_layer_,
|
||||
current_layers_, pressed_layers_ );
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@
|
|||
void kbfun_layer_set (KBFUN_FUNCTION_ARGS);
|
||||
void kbfun_layer_inc (KBFUN_FUNCTION_ARGS);
|
||||
void kbfun_layer_dec (KBFUN_FUNCTION_ARGS);
|
||||
void kbfun_layer_inc_exec (KBFUN_FUNCTION_ARGS);
|
||||
void kbfun_layer_dec_exec (KBFUN_FUNCTION_ARGS);
|
||||
void kbfun_2_keys_capslock_press_release (KBFUN_FUNCTION_ARGS);
|
||||
void kbfun_layer_inc_dec_press_release (KBFUN_FUNCTION_ARGS);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue