diff options
author | skullydazed <skullydazed@users.noreply.github.com> | 2018-03-21 23:50:38 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-03-22 02:50:38 -0400 |
commit | 7c9d5ace143d3cc6d767a354acde814926d566fd (patch) | |
tree | 1f2b581b6c9f6278a9e180bfcc8dd86b0a7fd2ef /tmk_core/common/action_layer.c | |
parent | f0932a8716dc946322c5ebae7f75eaa275c6220c (diff) | |
download | qmk_firmware-7c9d5ace143d3cc6d767a354acde814926d566fd.tar.gz |
Generate API docs from source code comments (#2491)
* Generate api docs from source code
* Add a bunch of doxygen comments
* more doxygen comments
* Add the in-progress api docs
* script to generate docs from travis
* Add doc generation to the travis job
* make travis_docs.sh commit the work it does
* make sure the docs script exits cleanly
Diffstat (limited to 'tmk_core/common/action_layer.c')
-rw-r--r-- | tmk_core/common/action_layer.c | 101 |
1 files changed, 96 insertions, 5 deletions
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 22331376a..f3cd381ab 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -11,16 +11,23 @@ #endif -/* - * Default Layer State +/** \brief Default Layer State */ uint32_t default_layer_state = 0; +/** \brief Default Layer State Set At Keyboard Level + * + * FIXME: Needs docs + */ __attribute__((weak)) uint32_t default_layer_state_set_kb(uint32_t state) { return state; } +/** \brief Default Layer State Set + * + * FIXME: Needs docs + */ static void default_layer_state_set(uint32_t state) { state = default_layer_state_set_kb(state); @@ -31,25 +38,45 @@ static void default_layer_state_set(uint32_t state) clear_keyboard_but_mods(); // To avoid stuck keys } +/** \brief Default Layer Print + * + * FIXME: Needs docs + */ void default_layer_debug(void) { dprintf("%08lX(%u)", default_layer_state, biton32(default_layer_state)); } +/** \brief Default Layer Set + * + * FIXME: Needs docs + */ void default_layer_set(uint32_t state) { default_layer_state_set(state); } #ifndef NO_ACTION_LAYER +/** \brief Default Layer Or + * + * FIXME: Needs docs + */ void default_layer_or(uint32_t state) { default_layer_state_set(default_layer_state | state); } +/** \brief Default Layer And + * + * FIXME: Needs docs + */ void default_layer_and(uint32_t state) { default_layer_state_set(default_layer_state & state); } +/** \brief Default Layer Xor + * + * FIXME: Needs docs + */ void default_layer_xor(uint32_t state) { default_layer_state_set(default_layer_state ^ state); @@ -58,21 +85,32 @@ void default_layer_xor(uint32_t state) #ifndef NO_ACTION_LAYER -/* - * Keymap Layer State +/** \brief Keymap Layer State */ uint32_t layer_state = 0; +/** \brief Layer state set user + * + * FIXME: Needs docs + */ __attribute__((weak)) uint32_t layer_state_set_user(uint32_t state) { return state; } +/** \brief Layer state set keyboard + * + * FIXME: Needs docs + */ __attribute__((weak)) uint32_t layer_state_set_kb(uint32_t state) { return layer_state_set_user(state); } +/** \brief Layer state set + * + * FIXME: Needs docs + */ void layer_state_set(uint32_t state) { state = layer_state_set_kb(state); @@ -83,54 +121,98 @@ void layer_state_set(uint32_t state) clear_keyboard_but_mods(); // To avoid stuck keys } +/** \brief Layer clear + * + * FIXME: Needs docs + */ void layer_clear(void) { layer_state_set(0); } +/** \brief Layer state is + * + * FIXME: Needs docs + */ bool layer_state_is(uint8_t layer) { return layer_state_cmp(layer_state, layer); } +/** \brief Layer state compare + * + * FIXME: Needs docs + */ bool layer_state_cmp(uint32_t cmp_layer_state, uint8_t layer) { if (!cmp_layer_state) { return layer == 0; } return (cmp_layer_state & (1UL<<layer)) != 0; } +/** \brief Layer move + * + * FIXME: Needs docs + */ void layer_move(uint8_t layer) { layer_state_set(1UL<<layer); } +/** \brief Layer on + * + * FIXME: Needs docs + */ void layer_on(uint8_t layer) { layer_state_set(layer_state | (1UL<<layer)); } +/** \brief Layer off + * + * FIXME: Needs docs + */ void layer_off(uint8_t layer) { layer_state_set(layer_state & ~(1UL<<layer)); } +/** \brief Layer invert + * + * FIXME: Needs docs + */ void layer_invert(uint8_t layer) { layer_state_set(layer_state ^ (1UL<<layer)); } +/** \brief Layer or + * + * FIXME: Needs docs + */ void layer_or(uint32_t state) { layer_state_set(layer_state | state); } +/** \brief Layer and + * + * FIXME: Needs docs + */ void layer_and(uint32_t state) { layer_state_set(layer_state & state); } +/** \brief Layer xor + * + * FIXME: Needs docs + */ void layer_xor(uint32_t state) { layer_state_set(layer_state ^ state); } +/** \brief Layer debug printing + * + * FIXME: Needs docs + */ void layer_debug(void) { dprintf("%08lX(%u)", layer_state, biton32(layer_state)); @@ -172,7 +254,8 @@ uint8_t read_source_layers_cache(keypos_t key) } #endif -/* +/** \brief Store or get action (FIXME: Needs better summary) + * * Make sure the action triggered when the key is released is the same * one as the one triggered on press. It's important for the mod keys * when the layer is switched after the down event but before the up @@ -201,6 +284,10 @@ action_t store_or_get_action(bool pressed, keypos_t key) } +/** \brief Layer switch get layer + * + * FIXME: Needs docs + */ int8_t layer_switch_get_layer(keypos_t key) { #ifndef NO_ACTION_LAYER @@ -224,6 +311,10 @@ int8_t layer_switch_get_layer(keypos_t key) #endif } +/** \brief Layer switch get layer + * + * FIXME: Needs docs + */ action_t layer_switch_get_action(keypos_t key) { return action_for_key(layer_switch_get_layer(key), key); |