ergodox-firmware/src/lib/key-functions/public.h

68 lines
2.2 KiB
C
Raw Normal View History

/* ----------------------------------------------------------------------------
* key functions : public exports
* ----------------------------------------------------------------------------
* Copyright (c) 2012 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (MIT) (see "license.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
#ifndef LIB__KEY_FUNCTIONS__COMMON_h
#define LIB__KEY_FUNCTIONS__COMMON_h
#include <stdbool.h>
#include <stdint.h>
// --------------------------------------------------------------------
// basic
void kbfun_press_release (void);
void kbfun_press_release_preserve_sticky (void);
void kbfun_toggle (void);
void kbfun_transparent (void);
// --- layer push/pop functions
void kbfun_layer_push_1 (void);
void kbfun_layer_push_2 (void);
void kbfun_layer_push_3 (void);
void kbfun_layer_push_4 (void);
void kbfun_layer_push_5 (void);
void kbfun_layer_push_6 (void);
void kbfun_layer_push_7 (void);
void kbfun_layer_push_8 (void);
void kbfun_layer_push_9 (void);
void kbfun_layer_push_10 (void);
adding sticky key functionality This function gives similar behavior to sticky keys for modifiers available on most operating systems. It is considered an accessibility feature because it alleviates the user from having to hold down modifiers while pressing a key to produce the modified key function. It is useful for fast touch typing because you can avoid chording motions which both strain your hands and take your hands out of home-row position while pressing normal alpha keys. This function emulates the 3-state behavior which is default on OS X and optional in Windows where the modifier cycles between Off->Once->Locked states. This is particularly handy for symbol layers where you typically only type one symbol before you want to return to unmodified typing (layer 0), e.g. 'if (condition) { a = "b" + "c"; }'. If you assign a symbol layer to a thumb key as a layer sticky cycle, you can type the entire line of code without taking your hands out of home row position and you do not need to toggle off the layer after each symbol is pressed, only immediately before keying the symbol. The exact behavior of the layer sticky cycle function is defined as follows for each state: 1) One time down (set on key press) - The layer was not active and the key has been pressed but not yet released. The layer is pushed in the one time down state. 2) One time up (set on key release) - The layer was active when the layer sticky key was released. If a key on this layer (not set to transparent) was pressed before the key was released, the layer will be popped. If a non-transparent key was not pressed, the layer is popped and pushed again in the one time up state. 3) Locked (set on key press) - The layer was active and in the one time up state when the layer sticky key was pressed again. The layer will be popped if the function is invoked on a subsequent keypress.
2013-04-08 09:49:35 +02:00
void kbfun_layer_sticky_1 (void);
void kbfun_layer_sticky_2 (void);
void kbfun_layer_sticky_3 (void);
void kbfun_layer_sticky_4 (void);
void kbfun_layer_sticky_5 (void);
void kbfun_layer_sticky_6 (void);
void kbfun_layer_sticky_7 (void);
void kbfun_layer_sticky_8 (void);
void kbfun_layer_sticky_9 (void);
void kbfun_layer_sticky_10 (void);
void kbfun_layer_pop_1 (void);
void kbfun_layer_pop_2 (void);
void kbfun_layer_pop_3 (void);
void kbfun_layer_pop_4 (void);
void kbfun_layer_pop_5 (void);
void kbfun_layer_pop_6 (void);
void kbfun_layer_pop_7 (void);
void kbfun_layer_pop_8 (void);
void kbfun_layer_pop_9 (void);
void kbfun_layer_pop_10 (void);
// ---
// device
void kbfun_jump_to_bootloader (void);
// special
void kbfun_shift_press_release (void);
void kbfun_2_keys_capslock_press_release (void);
void kbfun_layer_push_numpad (void);
void kbfun_layer_pop_numpad (void);
void kbfun_mediakey_press_release (void);
#endif