aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r--tmk_core/common/action.c63
1 files changed, 58 insertions, 5 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 33d920554..fff834791 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -44,6 +44,10 @@ int retro_tapping_counter = 0;
44#include <fauxclicky.h> 44#include <fauxclicky.h>
45#endif 45#endif
46 46
47/** \brief Called to execute an action.
48 *
49 * FIXME: Needs documentation.
50 */
47void action_exec(keyevent_t event) 51void action_exec(keyevent_t event)
48{ 52{
49 if (!IS_NOEVENT(event)) { 53 if (!IS_NOEVENT(event)) {
@@ -95,6 +99,10 @@ void action_exec(keyevent_t event)
95bool swap_hands = false; 99bool swap_hands = false;
96bool swap_held = false; 100bool swap_held = false;
97 101
102/** \brief Process Hand Swap
103 *
104 * FIXME: Needs documentation.
105 */
98void process_hand_swap(keyevent_t *event) { 106void process_hand_swap(keyevent_t *event) {
99 static swap_state_row_t swap_state[MATRIX_ROWS]; 107 static swap_state_row_t swap_state[MATRIX_ROWS];
100 108
@@ -134,7 +142,10 @@ bool process_record_quantum(keyrecord_t *record) {
134} 142}
135 143
136#ifndef NO_ACTION_TAPPING 144#ifndef NO_ACTION_TAPPING
137// Allows for handling tap-hold actions immediately instead of waiting for TAPPING_TERM or another keypress. 145/** \brief Allows for handling tap-hold actions immediately instead of waiting for TAPPING_TERM or another keypress.
146 *
147 * FIXME: Needs documentation.
148 */
138void process_record_tap_hint(keyrecord_t *record) 149void process_record_tap_hint(keyrecord_t *record)
139{ 150{
140 action_t action = layer_switch_get_action(record->event.key); 151 action_t action = layer_switch_get_action(record->event.key);
@@ -154,6 +165,10 @@ void process_record_tap_hint(keyrecord_t *record)
154} 165}
155#endif 166#endif
156 167
168/** \brief Take a key event (key press or key release) and processes it.
169 *
170 * FIXME: Needs documentation.
171 */
157void process_record(keyrecord_t *record) 172void process_record(keyrecord_t *record)
158{ 173{
159 if (IS_NOEVENT(record->event)) { return; } 174 if (IS_NOEVENT(record->event)) { return; }
@@ -172,6 +187,10 @@ void process_record(keyrecord_t *record)
172 process_action(record, action); 187 process_action(record, action);
173} 188}
174 189
190/** \brief Take an action and processes it.
191 *
192 * FIXME: Needs documentation.
193 */
175void process_action(keyrecord_t *record, action_t action) 194void process_action(keyrecord_t *record, action_t action)
176{ 195{
177 keyevent_t event = record->event; 196 keyevent_t event = record->event;
@@ -674,8 +693,9 @@ void process_action(keyrecord_t *record, action_t action)
674 693
675 694
676 695
677/* 696/** \brief Utilities for actions. (FIXME: Needs better description)
678 * Utilities for actions. 697 *
698 * FIXME: Needs documentation.
679 */ 699 */
680void register_code(uint8_t code) 700void register_code(uint8_t code)
681{ 701{
@@ -755,6 +775,10 @@ void register_code(uint8_t code)
755 } 775 }
756} 776}
757 777
778/** \brief Utilities for actions. (FIXME: Needs better description)
779 *
780 * FIXME: Needs documentation.
781 */
758void unregister_code(uint8_t code) 782void unregister_code(uint8_t code)
759{ 783{
760 if (code == KC_NO) { 784 if (code == KC_NO) {
@@ -810,6 +834,10 @@ void unregister_code(uint8_t code)
810 } 834 }
811} 835}
812 836
837/** \brief Utilities for actions. (FIXME: Needs better description)
838 *
839 * FIXME: Needs documentation.
840 */
813void register_mods(uint8_t mods) 841void register_mods(uint8_t mods)
814{ 842{
815 if (mods) { 843 if (mods) {
@@ -818,6 +846,10 @@ void register_mods(uint8_t mods)
818 } 846 }
819} 847}
820 848
849/** \brief Utilities for actions. (FIXME: Needs better description)
850 *
851 * FIXME: Needs documentation.
852 */
821void unregister_mods(uint8_t mods) 853void unregister_mods(uint8_t mods)
822{ 854{
823 if (mods) { 855 if (mods) {
@@ -826,12 +858,20 @@ void unregister_mods(uint8_t mods)
826 } 858 }
827} 859}
828 860
861/** \brief Utilities for actions. (FIXME: Needs better description)
862 *
863 * FIXME: Needs documentation.
864 */
829void clear_keyboard(void) 865void clear_keyboard(void)
830{ 866{
831 clear_mods(); 867 clear_mods();
832 clear_keyboard_but_mods(); 868 clear_keyboard_but_mods();
833} 869}
834 870
871/** \brief Utilities for actions. (FIXME: Needs better description)
872 *
873 * FIXME: Needs documentation.
874 */
835void clear_keyboard_but_mods(void) 875void clear_keyboard_but_mods(void)
836{ 876{
837 clear_weak_mods(); 877 clear_weak_mods();
@@ -848,6 +888,10 @@ void clear_keyboard_but_mods(void)
848#endif 888#endif
849} 889}
850 890
891/** \brief Utilities for actions. (FIXME: Needs better description)
892 *
893 * FIXME: Needs documentation.
894 */
851bool is_tap_key(keypos_t key) 895bool is_tap_key(keypos_t key)
852{ 896{
853 action_t action = layer_switch_get_action(key); 897 action_t action = layer_switch_get_action(key);
@@ -880,14 +924,19 @@ bool is_tap_key(keypos_t key)
880} 924}
881 925
882 926
883/* 927/** \brief Debug print (FIXME: Needs better description)
884 * debug print 928 *
929 * FIXME: Needs documentation.
885 */ 930 */
886void debug_event(keyevent_t event) 931void debug_event(keyevent_t event)
887{ 932{
888 dprintf("%04X%c(%u)", (event.key.row<<8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time); 933 dprintf("%04X%c(%u)", (event.key.row<<8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time);
889} 934}
890 935
936/** \brief Debug print (FIXME: Needs better description)
937 *
938 * FIXME: Needs documentation.
939 */
891void debug_record(keyrecord_t record) 940void debug_record(keyrecord_t record)
892{ 941{
893 debug_event(record.event); 942 debug_event(record.event);
@@ -896,6 +945,10 @@ void debug_record(keyrecord_t record)
896#endif 945#endif
897} 946}
898 947
948/** \brief Debug print (FIXME: Needs better description)
949 *
950 * FIXME: Needs documentation.
951 */
899void debug_action(action_t action) 952void debug_action(action_t action)
900{ 953{
901 switch (action.kind.id) { 954 switch (action.kind.id) {