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 | |
| parent | f0932a8716dc946322c5ebae7f75eaa275c6220c (diff) | |
| download | qmk_firmware-7c9d5ace143d3cc6d767a354acde814926d566fd.tar.gz qmk_firmware-7c9d5ace143d3cc6d767a354acde814926d566fd.zip | |
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')
25 files changed, 732 insertions, 70 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 | */ | ||
| 47 | void action_exec(keyevent_t event) | 51 | void 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) | |||
| 95 | bool swap_hands = false; | 99 | bool swap_hands = false; |
| 96 | bool swap_held = false; | 100 | bool swap_held = false; |
| 97 | 101 | ||
| 102 | /** \brief Process Hand Swap | ||
| 103 | * | ||
| 104 | * FIXME: Needs documentation. | ||
| 105 | */ | ||
| 98 | void process_hand_swap(keyevent_t *event) { | 106 | void 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 | */ | ||
| 138 | void process_record_tap_hint(keyrecord_t *record) | 149 | void 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 | */ | ||
| 157 | void process_record(keyrecord_t *record) | 172 | void 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 | */ | ||
| 175 | void process_action(keyrecord_t *record, action_t action) | 194 | void 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 | */ |
| 680 | void register_code(uint8_t code) | 700 | void 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 | */ | ||
| 758 | void unregister_code(uint8_t code) | 782 | void 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 | */ | ||
| 813 | void register_mods(uint8_t mods) | 841 | void 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 | */ | ||
| 821 | void unregister_mods(uint8_t mods) | 853 | void 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 | */ | ||
| 829 | void clear_keyboard(void) | 865 | void 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 | */ | ||
| 835 | void clear_keyboard_but_mods(void) | 875 | void 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 | */ | ||
| 851 | bool is_tap_key(keypos_t key) | 895 | bool 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 | */ |
| 886 | void debug_event(keyevent_t event) | 931 | void 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 | */ | ||
| 891 | void debug_record(keyrecord_t record) | 940 | void 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 | */ | ||
| 899 | void debug_action(action_t action) | 952 | void debug_action(action_t action) |
| 900 | { | 953 | { |
| 901 | switch (action.kind.id) { | 954 | switch (action.kind.id) { |
diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index fe2735b97..d836b7a8a 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h | |||
| @@ -17,10 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 17 | #ifndef ACTION_CODE_H | 17 | #ifndef ACTION_CODE_H |
| 18 | #define ACTION_CODE_H | 18 | #define ACTION_CODE_H |
| 19 | 19 | ||
| 20 | /* Action codes | 20 | /** \brief Action codes |
| 21 | * ============ | ||
| 22 | * 16bit code: action_kind(4bit) + action_parameter(12bit) | ||
| 23 | * | 21 | * |
| 22 | * 16bit code: action_kind(4bit) + action_parameter(12bit) | ||
| 24 | * | 23 | * |
| 25 | * Key Actions(00xx) | 24 | * Key Actions(00xx) |
| 26 | * ----------------- | 25 | * ----------------- |
| @@ -38,7 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 38 | * 001r|mods|0000 00xx (reserved) | 37 | * 001r|mods|0000 00xx (reserved) |
| 39 | * 001r|mods| keycode Modifiers with Tap Key(Dual role) | 38 | * 001r|mods| keycode Modifiers with Tap Key(Dual role) |
| 40 | * | 39 | * |
| 41 | * | ||
| 42 | * Other Keys(01xx) | 40 | * Other Keys(01xx) |
| 43 | * ---------------- | 41 | * ---------------- |
| 44 | * ACT_USAGE(0100): TODO: Not needed? | 42 | * ACT_USAGE(0100): TODO: Not needed? |
| @@ -47,17 +45,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 47 | * 0100|10| usage(10) (reserved) | 45 | * 0100|10| usage(10) (reserved) |
| 48 | * 0100|11| usage(10) (reserved) | 46 | * 0100|11| usage(10) (reserved) |
| 49 | * | 47 | * |
| 50 | * | ||
| 51 | * ACT_MOUSEKEY(0101): TODO: Merge these two actions to conserve space? | 48 | * ACT_MOUSEKEY(0101): TODO: Merge these two actions to conserve space? |
| 52 | * 0101|xxxx| keycode Mouse key | 49 | * 0101|xxxx| keycode Mouse key |
| 53 | * | 50 | * |
| 54 | * ACT_SWAP_HANDS(0110): | 51 | * ACT_SWAP_HANDS(0110): |
| 55 | * 0110|xxxx| keycode Swap hands (keycode on tap, or options) | 52 | * 0110|xxxx| keycode Swap hands (keycode on tap, or options) |
| 56 | * | 53 | * |
| 57 | * | ||
| 58 | * 0111|xxxx xxxx xxxx (reserved) | 54 | * 0111|xxxx xxxx xxxx (reserved) |
| 59 | * | 55 | * |
| 60 | * | ||
| 61 | * Layer Actions(10xx) | 56 | * Layer Actions(10xx) |
| 62 | * ------------------- | 57 | * ------------------- |
| 63 | * ACT_LAYER(1000): | 58 | * ACT_LAYER(1000): |
| @@ -84,7 +79,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 84 | * 101E|LLLL|1111 xxxx Reserved (0xF5-FF) | 79 | * 101E|LLLL|1111 xxxx Reserved (0xF5-FF) |
| 85 | * ELLLL: layer 0-31(E: extra bit for layer 16-31) | 80 | * ELLLL: layer 0-31(E: extra bit for layer 16-31) |
| 86 | * | 81 | * |
| 87 | * | ||
| 88 | * Extensions(11xx) | 82 | * Extensions(11xx) |
| 89 | * ---------------- | 83 | * ---------------- |
| 90 | * ACT_MACRO(1100): | 84 | * ACT_MACRO(1100): |
| @@ -126,7 +120,7 @@ enum action_kind_id { | |||
| 126 | }; | 120 | }; |
| 127 | 121 | ||
| 128 | 122 | ||
| 129 | /* Action Code Struct | 123 | /** \brief Action Code Struct |
| 130 | * | 124 | * |
| 131 | * NOTE: | 125 | * NOTE: |
| 132 | * In avr-gcc bit field seems to be assigned from LSB(bit0) to MSB(bit15). | 126 | * In avr-gcc bit field seems to be assigned from LSB(bit0) to MSB(bit15). |
| @@ -198,10 +192,9 @@ typedef union { | |||
| 198 | #define ACTION(kind, param) ((kind)<<12 | (param)) | 192 | #define ACTION(kind, param) ((kind)<<12 | (param)) |
| 199 | 193 | ||
| 200 | 194 | ||
| 201 | /* | 195 | /** \brief Key Actions |
| 202 | * Key Actions | 196 | * |
| 203 | */ | 197 | * Mod bits: 43210 |
| 204 | /* Mod bits: 43210 | ||
| 205 | * bit 0 ||||+- Control | 198 | * bit 0 ||||+- Control |
| 206 | * bit 1 |||+-- Shift | 199 | * bit 1 |||+-- Shift |
| 207 | * bit 2 ||+--- Alt | 200 | * bit 2 ||+--- Alt |
| @@ -230,8 +223,7 @@ enum mods_codes { | |||
| 230 | #define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE) | 223 | #define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE) |
| 231 | 224 | ||
| 232 | 225 | ||
| 233 | /* | 226 | /** \brief Other Keys |
| 234 | * Other Keys | ||
| 235 | */ | 227 | */ |
| 236 | enum usage_pages { | 228 | enum usage_pages { |
| 237 | PAGE_SYSTEM, | 229 | PAGE_SYSTEM, |
| @@ -243,20 +235,25 @@ enum usage_pages { | |||
| 243 | 235 | ||
| 244 | 236 | ||
| 245 | 237 | ||
| 246 | /* | 238 | /** \brief Layer Actions |
| 247 | * Layer Actions | ||
| 248 | */ | 239 | */ |
| 249 | enum layer_param_on { | 240 | enum layer_param_on { |
| 250 | ON_PRESS = 1, | 241 | ON_PRESS = 1, |
| 251 | ON_RELEASE = 2, | 242 | ON_RELEASE = 2, |
| 252 | ON_BOTH = 3, | 243 | ON_BOTH = 3, |
| 253 | }; | 244 | }; |
| 245 | |||
| 246 | /** \brief Layer Actions | ||
| 247 | */ | ||
| 254 | enum layer_param_bit_op { | 248 | enum layer_param_bit_op { |
| 255 | OP_BIT_AND = 0, | 249 | OP_BIT_AND = 0, |
| 256 | OP_BIT_OR = 1, | 250 | OP_BIT_OR = 1, |
| 257 | OP_BIT_XOR = 2, | 251 | OP_BIT_XOR = 2, |
| 258 | OP_BIT_SET = 3, | 252 | OP_BIT_SET = 3, |
| 259 | }; | 253 | }; |
| 254 | |||
| 255 | /** \brief Layer Actions | ||
| 256 | */ | ||
| 260 | enum layer_param_tap_op { | 257 | enum layer_param_tap_op { |
| 261 | OP_TAP_TOGGLE = 0xF0, | 258 | OP_TAP_TOGGLE = 0xF0, |
| 262 | OP_ON_OFF, | 259 | OP_ON_OFF, |
| @@ -296,8 +293,7 @@ enum layer_param_tap_op { | |||
| 296 | #define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0) | 293 | #define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0) |
| 297 | 294 | ||
| 298 | 295 | ||
| 299 | /* | 296 | /** \brief Extensions |
| 300 | * Extensions | ||
| 301 | */ | 297 | */ |
| 302 | enum backlight_opt { | 298 | enum backlight_opt { |
| 303 | BACKLIGHT_INCREASE = 0, | 299 | BACKLIGHT_INCREASE = 0, |
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 @@ | |||
| 11 | #endif | 11 | #endif |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | /* | 14 | /** \brief Default Layer State |
| 15 | * Default Layer State | ||
| 16 | */ | 15 | */ |
| 17 | uint32_t default_layer_state = 0; | 16 | uint32_t default_layer_state = 0; |
| 18 | 17 | ||
| 18 | /** \brief Default Layer State Set At Keyboard Level | ||
| 19 | * | ||
| 20 | * FIXME: Needs docs | ||
| 21 | */ | ||
| 19 | __attribute__((weak)) | 22 | __attribute__((weak)) |
| 20 | uint32_t default_layer_state_set_kb(uint32_t state) { | 23 | uint32_t default_layer_state_set_kb(uint32_t state) { |
| 21 | return state; | 24 | return state; |
| 22 | } | 25 | } |
| 23 | 26 | ||
| 27 | /** \brief Default Layer State Set | ||
| 28 | * | ||
| 29 | * FIXME: Needs docs | ||
| 30 | */ | ||
| 24 | static void default_layer_state_set(uint32_t state) | 31 | static void default_layer_state_set(uint32_t state) |
| 25 | { | 32 | { |
| 26 | state = default_layer_state_set_kb(state); | 33 | state = default_layer_state_set_kb(state); |
| @@ -31,25 +38,45 @@ static void default_layer_state_set(uint32_t state) | |||
| 31 | clear_keyboard_but_mods(); // To avoid stuck keys | 38 | clear_keyboard_but_mods(); // To avoid stuck keys |
| 32 | } | 39 | } |
| 33 | 40 | ||
| 41 | /** \brief Default Layer Print | ||
| 42 | * | ||
| 43 | * FIXME: Needs docs | ||
| 44 | */ | ||
| 34 | void default_layer_debug(void) | 45 | void default_layer_debug(void) |
| 35 | { | 46 | { |
| 36 | dprintf("%08lX(%u)", default_layer_state, biton32(default_layer_state)); | 47 | dprintf("%08lX(%u)", default_layer_state, biton32(default_layer_state)); |
| 37 | } | 48 | } |
| 38 | 49 | ||
| 50 | /** \brief Default Layer Set | ||
| 51 | * | ||
| 52 | * FIXME: Needs docs | ||
| 53 | */ | ||
| 39 | void default_layer_set(uint32_t state) | 54 | void default_layer_set(uint32_t state) |
| 40 | { | 55 | { |
| 41 | default_layer_state_set(state); | 56 | default_layer_state_set(state); |
| 42 | } | 57 | } |
| 43 | 58 | ||
| 44 | #ifndef NO_ACTION_LAYER | 59 | #ifndef NO_ACTION_LAYER |
| 60 | /** \brief Default Layer Or | ||
| 61 | * | ||
| 62 | * FIXME: Needs docs | ||
| 63 | */ | ||
| 45 | void default_layer_or(uint32_t state) | 64 | void default_layer_or(uint32_t state) |
| 46 | { | 65 | { |
| 47 | default_layer_state_set(default_layer_state | state); | 66 | default_layer_state_set(default_layer_state | state); |
| 48 | } | 67 | } |
| 68 | /** \brief Default Layer And | ||
| 69 | * | ||
| 70 | * FIXME: Needs docs | ||
| 71 | */ | ||
| 49 | void default_layer_and(uint32_t state) | 72 | void default_layer_and(uint32_t state) |
| 50 | { | 73 | { |
| 51 | default_layer_state_set(default_layer_state & state); | 74 | default_layer_state_set(default_layer_state & state); |
| 52 | } | 75 | } |
| 76 | /** \brief Default Layer Xor | ||
| 77 | * | ||
| 78 | * FIXME: Needs docs | ||
| 79 | */ | ||
| 53 | void default_layer_xor(uint32_t state) | 80 | void default_layer_xor(uint32_t state) |
| 54 | { | 81 | { |
| 55 | default_layer_state_set(default_layer_state ^ state); | 82 | default_layer_state_set(default_layer_state ^ state); |
| @@ -58,21 +85,32 @@ void default_layer_xor(uint32_t state) | |||
| 58 | 85 | ||
| 59 | 86 | ||
| 60 | #ifndef NO_ACTION_LAYER | 87 | #ifndef NO_ACTION_LAYER |
| 61 | /* | 88 | /** \brief Keymap Layer State |
| 62 | * Keymap Layer State | ||
| 63 | */ | 89 | */ |
| 64 | uint32_t layer_state = 0; | 90 | uint32_t layer_state = 0; |
| 65 | 91 | ||
| 92 | /** \brief Layer state set user | ||
| 93 | * | ||
| 94 | * FIXME: Needs docs | ||
| 95 | */ | ||
| 66 | __attribute__((weak)) | 96 | __attribute__((weak)) |
| 67 | uint32_t layer_state_set_user(uint32_t state) { | 97 | uint32_t layer_state_set_user(uint32_t state) { |
| 68 | return state; | 98 | return state; |
| 69 | } | 99 | } |
| 70 | 100 | ||
| 101 | /** \brief Layer state set keyboard | ||
| 102 | * | ||
| 103 | * FIXME: Needs docs | ||
| 104 | */ | ||
| 71 | __attribute__((weak)) | 105 | __attribute__((weak)) |
| 72 | uint32_t layer_state_set_kb(uint32_t state) { | 106 | uint32_t layer_state_set_kb(uint32_t state) { |
| 73 | return layer_state_set_user(state); | 107 | return layer_state_set_user(state); |
| 74 | } | 108 | } |
| 75 | 109 | ||
| 110 | /** \brief Layer state set | ||
| 111 | * | ||
| 112 | * FIXME: Needs docs | ||
| 113 | */ | ||
| 76 | void layer_state_set(uint32_t state) | 114 | void layer_state_set(uint32_t state) |
| 77 | { | 115 | { |
| 78 | state = layer_state_set_kb(state); | 116 | state = layer_state_set_kb(state); |
| @@ -83,54 +121,98 @@ void layer_state_set(uint32_t state) | |||
| 83 | clear_keyboard_but_mods(); // To avoid stuck keys | 121 | clear_keyboard_but_mods(); // To avoid stuck keys |
| 84 | } | 122 | } |
| 85 | 123 | ||
| 124 | /** \brief Layer clear | ||
| 125 | * | ||
| 126 | * FIXME: Needs docs | ||
| 127 | */ | ||
| 86 | void layer_clear(void) | 128 | void layer_clear(void) |
| 87 | { | 129 | { |
| 88 | layer_state_set(0); | 130 | layer_state_set(0); |
| 89 | } | 131 | } |
| 90 | 132 | ||
| 133 | /** \brief Layer state is | ||
| 134 | * | ||
| 135 | * FIXME: Needs docs | ||
| 136 | */ | ||
| 91 | bool layer_state_is(uint8_t layer) | 137 | bool layer_state_is(uint8_t layer) |
| 92 | { | 138 | { |
| 93 | return layer_state_cmp(layer_state, layer); | 139 | return layer_state_cmp(layer_state, layer); |
| 94 | } | 140 | } |
| 95 | 141 | ||
| 142 | /** \brief Layer state compare | ||
| 143 | * | ||
| 144 | * FIXME: Needs docs | ||
| 145 | */ | ||
| 96 | bool layer_state_cmp(uint32_t cmp_layer_state, uint8_t layer) { | 146 | bool layer_state_cmp(uint32_t cmp_layer_state, uint8_t layer) { |
| 97 | if (!cmp_layer_state) { return layer == 0; } | 147 | if (!cmp_layer_state) { return layer == 0; } |
| 98 | return (cmp_layer_state & (1UL<<layer)) != 0; | 148 | return (cmp_layer_state & (1UL<<layer)) != 0; |
| 99 | } | 149 | } |
| 100 | 150 | ||
| 151 | /** \brief Layer move | ||
| 152 | * | ||
| 153 | * FIXME: Needs docs | ||
| 154 | */ | ||
| 101 | void layer_move(uint8_t layer) | 155 | void layer_move(uint8_t layer) |
| 102 | { | 156 | { |
| 103 | layer_state_set(1UL<<layer); | 157 | layer_state_set(1UL<<layer); |
| 104 | } | 158 | } |
| 105 | 159 | ||
| 160 | /** \brief Layer on | ||
| 161 | * | ||
| 162 | * FIXME: Needs docs | ||
| 163 | */ | ||
| 106 | void layer_on(uint8_t layer) | 164 | void layer_on(uint8_t layer) |
| 107 | { | 165 | { |
| 108 | layer_state_set(layer_state | (1UL<<layer)); | 166 | layer_state_set(layer_state | (1UL<<layer)); |
| 109 | } | 167 | } |
| 110 | 168 | ||
| 169 | /** \brief Layer off | ||
| 170 | * | ||
| 171 | * FIXME: Needs docs | ||
| 172 | */ | ||
| 111 | void layer_off(uint8_t layer) | 173 | void layer_off(uint8_t layer) |
| 112 | { | 174 | { |
| 113 | layer_state_set(layer_state & ~(1UL<<layer)); | 175 | layer_state_set(layer_state & ~(1UL<<layer)); |
| 114 | } | 176 | } |
| 115 | 177 | ||
| 178 | /** \brief Layer invert | ||
| 179 | * | ||
| 180 | * FIXME: Needs docs | ||
| 181 | */ | ||
| 116 | void layer_invert(uint8_t layer) | 182 | void layer_invert(uint8_t layer) |
| 117 | { | 183 | { |
| 118 | layer_state_set(layer_state ^ (1UL<<layer)); | 184 | layer_state_set(layer_state ^ (1UL<<layer)); |
| 119 | } | 185 | } |
| 120 | 186 | ||
| 187 | /** \brief Layer or | ||
| 188 | * | ||
| 189 | * FIXME: Needs docs | ||
| 190 | */ | ||
| 121 | void layer_or(uint32_t state) | 191 | void layer_or(uint32_t state) |
| 122 | { | 192 | { |
| 123 | layer_state_set(layer_state | state); | 193 | layer_state_set(layer_state | state); |
| 124 | } | 194 | } |
| 195 | /** \brief Layer and | ||
| 196 | * | ||
| 197 | * FIXME: Needs docs | ||
| 198 | */ | ||
| 125 | void layer_and(uint32_t state) | 199 | void layer_and(uint32_t state) |
| 126 | { | 200 | { |
| 127 | layer_state_set(layer_state & state); | 201 | layer_state_set(layer_state & state); |
| 128 | } | 202 | } |
| 203 | /** \brief Layer xor | ||
| 204 | * | ||
| 205 | * FIXME: Needs docs | ||
| 206 | */ | ||
| 129 | void layer_xor(uint32_t state) | 207 | void layer_xor(uint32_t state) |
| 130 | { | 208 | { |
| 131 | layer_state_set(layer_state ^ state); | 209 | layer_state_set(layer_state ^ state); |
| 132 | } | 210 | } |
| 133 | 211 | ||
| 212 | /** \brief Layer debug printing | ||
| 213 | * | ||
| 214 | * FIXME: Needs docs | ||
| 215 | */ | ||
| 134 | void layer_debug(void) | 216 | void layer_debug(void) |
| 135 | { | 217 | { |
| 136 | dprintf("%08lX(%u)", layer_state, biton32(layer_state)); | 218 | dprintf("%08lX(%u)", layer_state, biton32(layer_state)); |
| @@ -172,7 +254,8 @@ uint8_t read_source_layers_cache(keypos_t key) | |||
| 172 | } | 254 | } |
| 173 | #endif | 255 | #endif |
| 174 | 256 | ||
| 175 | /* | 257 | /** \brief Store or get action (FIXME: Needs better summary) |
| 258 | * | ||
| 176 | * Make sure the action triggered when the key is released is the same | 259 | * Make sure the action triggered when the key is released is the same |
| 177 | * one as the one triggered on press. It's important for the mod keys | 260 | * one as the one triggered on press. It's important for the mod keys |
| 178 | * when the layer is switched after the down event but before the up | 261 | * 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) | |||
| 201 | } | 284 | } |
| 202 | 285 | ||
| 203 | 286 | ||
| 287 | /** \brief Layer switch get layer | ||
| 288 | * | ||
| 289 | * FIXME: Needs docs | ||
| 290 | */ | ||
| 204 | int8_t layer_switch_get_layer(keypos_t key) | 291 | int8_t layer_switch_get_layer(keypos_t key) |
| 205 | { | 292 | { |
| 206 | #ifndef NO_ACTION_LAYER | 293 | #ifndef NO_ACTION_LAYER |
| @@ -224,6 +311,10 @@ int8_t layer_switch_get_layer(keypos_t key) | |||
| 224 | #endif | 311 | #endif |
| 225 | } | 312 | } |
| 226 | 313 | ||
| 314 | /** \brief Layer switch get layer | ||
| 315 | * | ||
| 316 | * FIXME: Needs docs | ||
| 317 | */ | ||
| 227 | action_t layer_switch_get_action(keypos_t key) | 318 | action_t layer_switch_get_action(keypos_t key) |
| 228 | { | 319 | { |
| 229 | return action_for_key(layer_switch_get_layer(key), key); | 320 | return action_for_key(layer_switch_get_layer(key), key); |
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c index 7726b1190..12bef2958 100644 --- a/tmk_core/common/action_macro.c +++ b/tmk_core/common/action_macro.c | |||
| @@ -29,6 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 29 | #ifndef NO_ACTION_MACRO | 29 | #ifndef NO_ACTION_MACRO |
| 30 | 30 | ||
| 31 | #define MACRO_READ() (macro = MACRO_GET(macro_p++)) | 31 | #define MACRO_READ() (macro = MACRO_GET(macro_p++)) |
| 32 | /** \brief Action Macro Play | ||
| 33 | * | ||
| 34 | * FIXME: Needs doc | ||
| 35 | */ | ||
| 32 | void action_macro_play(const macro_t *macro_p) | 36 | void action_macro_play(const macro_t *macro_p) |
| 33 | { | 37 | { |
| 34 | macro_t macro = END; | 38 | macro_t macro = END; |
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index 6280c6c36..8adf013e1 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c | |||
| @@ -36,6 +36,10 @@ static void debug_tapping_key(void); | |||
| 36 | static void debug_waiting_buffer(void); | 36 | static void debug_waiting_buffer(void); |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | /** \brief Action Tapping Process | ||
| 40 | * | ||
| 41 | * FIXME: Needs doc | ||
| 42 | */ | ||
| 39 | void action_tapping_process(keyrecord_t record) | 43 | void action_tapping_process(keyrecord_t record) |
| 40 | { | 44 | { |
| 41 | if (process_tapping(&record)) { | 45 | if (process_tapping(&record)) { |
| @@ -70,7 +74,7 @@ void action_tapping_process(keyrecord_t record) | |||
| 70 | } | 74 | } |
| 71 | 75 | ||
| 72 | 76 | ||
| 73 | /* Tapping | 77 | /** \brief Tapping |
| 74 | * | 78 | * |
| 75 | * Rule: Tap key is typed(pressed and released) within TAPPING_TERM. | 79 | * Rule: Tap key is typed(pressed and released) within TAPPING_TERM. |
| 76 | * (without interfering by typing other key) | 80 | * (without interfering by typing other key) |
| @@ -289,8 +293,9 @@ bool process_tapping(keyrecord_t *keyp) | |||
| 289 | } | 293 | } |
| 290 | 294 | ||
| 291 | 295 | ||
| 292 | /* | 296 | /** \brief Waiting buffer enq |
| 293 | * Waiting buffer | 297 | * |
| 298 | * FIXME: Needs docs | ||
| 294 | */ | 299 | */ |
| 295 | bool waiting_buffer_enq(keyrecord_t record) | 300 | bool waiting_buffer_enq(keyrecord_t record) |
| 296 | { | 301 | { |
| @@ -310,12 +315,20 @@ bool waiting_buffer_enq(keyrecord_t record) | |||
| 310 | return true; | 315 | return true; |
| 311 | } | 316 | } |
| 312 | 317 | ||
| 318 | /** \brief Waiting buffer clear | ||
| 319 | * | ||
| 320 | * FIXME: Needs docs | ||
| 321 | */ | ||
| 313 | void waiting_buffer_clear(void) | 322 | void waiting_buffer_clear(void) |
| 314 | { | 323 | { |
| 315 | waiting_buffer_head = 0; | 324 | waiting_buffer_head = 0; |
| 316 | waiting_buffer_tail = 0; | 325 | waiting_buffer_tail = 0; |
| 317 | } | 326 | } |
| 318 | 327 | ||
| 328 | /** \brief Waiting buffer typed | ||
| 329 | * | ||
| 330 | * FIXME: Needs docs | ||
| 331 | */ | ||
| 319 | bool waiting_buffer_typed(keyevent_t event) | 332 | bool waiting_buffer_typed(keyevent_t event) |
| 320 | { | 333 | { |
| 321 | for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { | 334 | for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { |
| @@ -326,6 +339,10 @@ bool waiting_buffer_typed(keyevent_t event) | |||
| 326 | return false; | 339 | return false; |
| 327 | } | 340 | } |
| 328 | 341 | ||
| 342 | /** \brief Waiting buffer has anykey pressed | ||
| 343 | * | ||
| 344 | * FIXME: Needs docs | ||
| 345 | */ | ||
| 329 | __attribute__((unused)) | 346 | __attribute__((unused)) |
| 330 | bool waiting_buffer_has_anykey_pressed(void) | 347 | bool waiting_buffer_has_anykey_pressed(void) |
| 331 | { | 348 | { |
| @@ -335,7 +352,10 @@ bool waiting_buffer_has_anykey_pressed(void) | |||
| 335 | return false; | 352 | return false; |
| 336 | } | 353 | } |
| 337 | 354 | ||
| 338 | /* scan buffer for tapping */ | 355 | /** \brief Scan buffer for tapping |
| 356 | * | ||
| 357 | * FIXME: Needs docs | ||
| 358 | */ | ||
| 339 | void waiting_buffer_scan_tap(void) | 359 | void waiting_buffer_scan_tap(void) |
| 340 | { | 360 | { |
| 341 | // tapping already is settled | 361 | // tapping already is settled |
| @@ -359,14 +379,19 @@ void waiting_buffer_scan_tap(void) | |||
| 359 | } | 379 | } |
| 360 | 380 | ||
| 361 | 381 | ||
| 362 | /* | 382 | /** \brief Tapping key debug print |
| 363 | * debug print | 383 | * |
| 384 | * FIXME: Needs docs | ||
| 364 | */ | 385 | */ |
| 365 | static void debug_tapping_key(void) | 386 | static void debug_tapping_key(void) |
| 366 | { | 387 | { |
| 367 | debug("TAPPING_KEY="); debug_record(tapping_key); debug("\n"); | 388 | debug("TAPPING_KEY="); debug_record(tapping_key); debug("\n"); |
| 368 | } | 389 | } |
| 369 | 390 | ||
| 391 | /** \brief Waiting buffer debug print | ||
| 392 | * | ||
| 393 | * FIXME: Needs docs | ||
| 394 | */ | ||
| 370 | static void debug_waiting_buffer(void) | 395 | static void debug_waiting_buffer(void) |
| 371 | { | 396 | { |
| 372 | debug("{ "); | 397 | debug("{ "); |
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index 148162a51..afd4ae8b2 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c | |||
| @@ -67,12 +67,12 @@ bool has_oneshot_mods_timed_out(void) { | |||
| 67 | 67 | ||
| 68 | /* oneshot layer */ | 68 | /* oneshot layer */ |
| 69 | #ifndef NO_ACTION_ONESHOT | 69 | #ifndef NO_ACTION_ONESHOT |
| 70 | /* oneshot_layer_data bits | 70 | /** \brief oneshot_layer_data bits |
| 71 | * LLLL LSSS | 71 | * LLLL LSSS |
| 72 | * where: | 72 | * where: |
| 73 | * L => are layer bits | 73 | * L => are layer bits |
| 74 | * S => oneshot state bits | 74 | * S => oneshot state bits |
| 75 | */ | 75 | */ |
| 76 | static int8_t oneshot_layer_data = 0; | 76 | static int8_t oneshot_layer_data = 0; |
| 77 | 77 | ||
| 78 | inline uint8_t get_oneshot_layer(void) { return oneshot_layer_data >> 3; } | 78 | inline uint8_t get_oneshot_layer(void) { return oneshot_layer_data >> 3; } |
| @@ -86,7 +86,10 @@ inline bool has_oneshot_layer_timed_out() { | |||
| 86 | } | 86 | } |
| 87 | #endif | 87 | #endif |
| 88 | 88 | ||
| 89 | /* Oneshot layer */ | 89 | /** \brief Set oneshot layer |
| 90 | * | ||
| 91 | * FIXME: needs doc | ||
| 92 | */ | ||
| 90 | void set_oneshot_layer(uint8_t layer, uint8_t state) | 93 | void set_oneshot_layer(uint8_t layer, uint8_t state) |
| 91 | { | 94 | { |
| 92 | oneshot_layer_data = layer << 3 | state; | 95 | oneshot_layer_data = layer << 3 | state; |
| @@ -95,12 +98,20 @@ void set_oneshot_layer(uint8_t layer, uint8_t state) | |||
| 95 | oneshot_layer_time = timer_read(); | 98 | oneshot_layer_time = timer_read(); |
| 96 | #endif | 99 | #endif |
| 97 | } | 100 | } |
| 101 | /** \brief Reset oneshot layer | ||
| 102 | * | ||
| 103 | * FIXME: needs doc | ||
| 104 | */ | ||
| 98 | void reset_oneshot_layer(void) { | 105 | void reset_oneshot_layer(void) { |
| 99 | oneshot_layer_data = 0; | 106 | oneshot_layer_data = 0; |
| 100 | #if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) | 107 | #if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) |
| 101 | oneshot_layer_time = 0; | 108 | oneshot_layer_time = 0; |
| 102 | #endif | 109 | #endif |
| 103 | } | 110 | } |
| 111 | /** \brief Clear oneshot layer | ||
| 112 | * | ||
| 113 | * FIXME: needs doc | ||
| 114 | */ | ||
| 104 | void clear_oneshot_layer_state(oneshot_fullfillment_t state) | 115 | void clear_oneshot_layer_state(oneshot_fullfillment_t state) |
| 105 | { | 116 | { |
| 106 | uint8_t start_state = oneshot_layer_data; | 117 | uint8_t start_state = oneshot_layer_data; |
| @@ -112,12 +123,20 @@ void clear_oneshot_layer_state(oneshot_fullfillment_t state) | |||
| 112 | #endif | 123 | #endif |
| 113 | } | 124 | } |
| 114 | } | 125 | } |
| 126 | /** \brief Is oneshot layer active | ||
| 127 | * | ||
| 128 | * FIXME: needs doc | ||
| 129 | */ | ||
| 115 | bool is_oneshot_layer_active(void) | 130 | bool is_oneshot_layer_active(void) |
| 116 | { | 131 | { |
| 117 | return get_oneshot_layer_state(); | 132 | return get_oneshot_layer_state(); |
| 118 | } | 133 | } |
| 119 | #endif | 134 | #endif |
| 120 | 135 | ||
| 136 | /** \brief Send keyboard report | ||
| 137 | * | ||
| 138 | * FIXME: needs doc | ||
| 139 | */ | ||
| 121 | void send_keyboard_report(void) { | 140 | void send_keyboard_report(void) { |
| 122 | keyboard_report->mods = real_mods; | 141 | keyboard_report->mods = real_mods; |
| 123 | keyboard_report->mods |= weak_mods; | 142 | keyboard_report->mods |= weak_mods; |
| @@ -140,29 +159,90 @@ void send_keyboard_report(void) { | |||
| 140 | host_keyboard_send(keyboard_report); | 159 | host_keyboard_send(keyboard_report); |
| 141 | } | 160 | } |
| 142 | 161 | ||
| 143 | /* modifier */ | 162 | /** \brief Get mods |
| 163 | * | ||
| 164 | * FIXME: needs doc | ||
| 165 | */ | ||
| 144 | uint8_t get_mods(void) { return real_mods; } | 166 | uint8_t get_mods(void) { return real_mods; } |
| 167 | /** \brief add mods | ||
| 168 | * | ||
| 169 | * FIXME: needs doc | ||
| 170 | */ | ||
| 145 | void add_mods(uint8_t mods) { real_mods |= mods; } | 171 | void add_mods(uint8_t mods) { real_mods |= mods; } |
| 172 | /** \brief del mods | ||
| 173 | * | ||
| 174 | * FIXME: needs doc | ||
| 175 | */ | ||
| 146 | void del_mods(uint8_t mods) { real_mods &= ~mods; } | 176 | void del_mods(uint8_t mods) { real_mods &= ~mods; } |
| 177 | /** \brief set mods | ||
| 178 | * | ||
| 179 | * FIXME: needs doc | ||
| 180 | */ | ||
| 147 | void set_mods(uint8_t mods) { real_mods = mods; } | 181 | void set_mods(uint8_t mods) { real_mods = mods; } |
| 182 | /** \brief clear mods | ||
| 183 | * | ||
| 184 | * FIXME: needs doc | ||
| 185 | */ | ||
| 148 | void clear_mods(void) { real_mods = 0; } | 186 | void clear_mods(void) { real_mods = 0; } |
| 149 | 187 | ||
| 150 | /* weak modifier */ | 188 | /** \brief get weak mods |
| 189 | * | ||
| 190 | * FIXME: needs doc | ||
| 191 | */ | ||
| 151 | uint8_t get_weak_mods(void) { return weak_mods; } | 192 | uint8_t get_weak_mods(void) { return weak_mods; } |
| 193 | /** \brief add weak mods | ||
| 194 | * | ||
| 195 | * FIXME: needs doc | ||
| 196 | */ | ||
| 152 | void add_weak_mods(uint8_t mods) { weak_mods |= mods; } | 197 | void add_weak_mods(uint8_t mods) { weak_mods |= mods; } |
| 198 | /** \brief del weak mods | ||
| 199 | * | ||
| 200 | * FIXME: needs doc | ||
| 201 | */ | ||
| 153 | void del_weak_mods(uint8_t mods) { weak_mods &= ~mods; } | 202 | void del_weak_mods(uint8_t mods) { weak_mods &= ~mods; } |
| 203 | /** \brief set weak mods | ||
| 204 | * | ||
| 205 | * FIXME: needs doc | ||
| 206 | */ | ||
| 154 | void set_weak_mods(uint8_t mods) { weak_mods = mods; } | 207 | void set_weak_mods(uint8_t mods) { weak_mods = mods; } |
| 208 | /** \brief clear weak mods | ||
| 209 | * | ||
| 210 | * FIXME: needs doc | ||
| 211 | */ | ||
| 155 | void clear_weak_mods(void) { weak_mods = 0; } | 212 | void clear_weak_mods(void) { weak_mods = 0; } |
| 156 | 213 | ||
| 157 | /* macro modifier */ | 214 | /* macro modifier */ |
| 215 | /** \brief get macro mods | ||
| 216 | * | ||
| 217 | * FIXME: needs doc | ||
| 218 | */ | ||
| 158 | uint8_t get_macro_mods(void) { return macro_mods; } | 219 | uint8_t get_macro_mods(void) { return macro_mods; } |
| 220 | /** \brief add macro mods | ||
| 221 | * | ||
| 222 | * FIXME: needs doc | ||
| 223 | */ | ||
| 159 | void add_macro_mods(uint8_t mods) { macro_mods |= mods; } | 224 | void add_macro_mods(uint8_t mods) { macro_mods |= mods; } |
| 225 | /** \brief del macro mods | ||
| 226 | * | ||
| 227 | * FIXME: needs doc | ||
| 228 | */ | ||
| 160 | void del_macro_mods(uint8_t mods) { macro_mods &= ~mods; } | 229 | void del_macro_mods(uint8_t mods) { macro_mods &= ~mods; } |
| 230 | /** \brief set macro mods | ||
| 231 | * | ||
| 232 | * FIXME: needs doc | ||
| 233 | */ | ||
| 161 | void set_macro_mods(uint8_t mods) { macro_mods = mods; } | 234 | void set_macro_mods(uint8_t mods) { macro_mods = mods; } |
| 235 | /** \brief clear macro mods | ||
| 236 | * | ||
| 237 | * FIXME: needs doc | ||
| 238 | */ | ||
| 162 | void clear_macro_mods(void) { macro_mods = 0; } | 239 | void clear_macro_mods(void) { macro_mods = 0; } |
| 163 | 240 | ||
| 164 | /* Oneshot modifier */ | ||
| 165 | #ifndef NO_ACTION_ONESHOT | 241 | #ifndef NO_ACTION_ONESHOT |
| 242 | /** \brief set oneshot mods | ||
| 243 | * | ||
| 244 | * FIXME: needs doc | ||
| 245 | */ | ||
| 166 | void set_oneshot_mods(uint8_t mods) | 246 | void set_oneshot_mods(uint8_t mods) |
| 167 | { | 247 | { |
| 168 | oneshot_mods = mods; | 248 | oneshot_mods = mods; |
| @@ -170,6 +250,10 @@ void set_oneshot_mods(uint8_t mods) | |||
| 170 | oneshot_time = timer_read(); | 250 | oneshot_time = timer_read(); |
| 171 | #endif | 251 | #endif |
| 172 | } | 252 | } |
| 253 | /** \brief clear oneshot mods | ||
| 254 | * | ||
| 255 | * FIXME: needs doc | ||
| 256 | */ | ||
| 173 | void clear_oneshot_mods(void) | 257 | void clear_oneshot_mods(void) |
| 174 | { | 258 | { |
| 175 | oneshot_mods = 0; | 259 | oneshot_mods = 0; |
| @@ -177,14 +261,19 @@ void clear_oneshot_mods(void) | |||
| 177 | oneshot_time = 0; | 261 | oneshot_time = 0; |
| 178 | #endif | 262 | #endif |
| 179 | } | 263 | } |
| 264 | /** \brief get oneshot mods | ||
| 265 | * | ||
| 266 | * FIXME: needs doc | ||
| 267 | */ | ||
| 180 | uint8_t get_oneshot_mods(void) | 268 | uint8_t get_oneshot_mods(void) |
| 181 | { | 269 | { |
| 182 | return oneshot_mods; | 270 | return oneshot_mods; |
| 183 | } | 271 | } |
| 184 | #endif | 272 | #endif |
| 185 | 273 | ||
| 186 | /* | 274 | /** \brief inspect keyboard state |
| 187 | * inspect keyboard state | 275 | * |
| 276 | * FIXME: needs doc | ||
| 188 | */ | 277 | */ |
| 189 | uint8_t has_anymod(void) | 278 | uint8_t has_anymod(void) |
| 190 | { | 279 | { |
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c index ee150817c..d89c8d768 100644 --- a/tmk_core/common/avr/bootloader.c +++ b/tmk_core/common/avr/bootloader.c | |||
| @@ -13,12 +13,11 @@ | |||
| 13 | #endif | 13 | #endif |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | /* Bootloader Size in *bytes* | 16 | /** \brief Bootloader Size in *bytes* |
| 17 | * | 17 | * |
| 18 | * AVR Boot section size are defined by setting BOOTSZ fuse in fact. Consult with your MCU datasheet. | 18 | * AVR Boot section size are defined by setting BOOTSZ fuse in fact. Consult with your MCU datasheet. |
| 19 | * Note that 'Word'(2 bytes) size and address are used in datasheet while TMK uses 'Byte'. | 19 | * Note that 'Word'(2 bytes) size and address are used in datasheet while TMK uses 'Byte'. |
| 20 | * | 20 | * |
| 21 | * | ||
| 22 | * Size of Bootloaders in bytes: | 21 | * Size of Bootloaders in bytes: |
| 23 | * Atmel DFU loader(ATmega32U4) 4096 | 22 | * Atmel DFU loader(ATmega32U4) 4096 |
| 24 | * Atmel DFU loader(AT90USB128) 8192 | 23 | * Atmel DFU loader(AT90USB128) 8192 |
| @@ -28,10 +27,8 @@ | |||
| 28 | * Teensy halfKay(ATmega32U4) 512 | 27 | * Teensy halfKay(ATmega32U4) 512 |
| 29 | * Teensy++ halfKay(AT90USB128) 1024 | 28 | * Teensy++ halfKay(AT90USB128) 1024 |
| 30 | * | 29 | * |
| 31 | * | ||
| 32 | * AVR Boot section is located at the end of Flash memory like the followings. | 30 | * AVR Boot section is located at the end of Flash memory like the followings. |
| 33 | * | 31 | * |
| 34 | * | ||
| 35 | * byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB128) | 32 | * byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB128) |
| 36 | * 0x0000 +---------------+ 0x00000 +---------------+ | 33 | * 0x0000 +---------------+ 0x00000 +---------------+ |
| 37 | * | | | | | 34 | * | | | | |
| @@ -57,7 +54,6 @@ | |||
| 57 | * | Bootloader | 512B | Bootloader | 1KB | 54 | * | Bootloader | 512B | Bootloader | 1KB |
| 58 | * 0x7FFF +---------------+ 0x1FFFF +---------------+ | 55 | * 0x7FFF +---------------+ 0x1FFFF +---------------+ |
| 59 | */ | 56 | */ |
| 60 | |||
| 61 | #define FLASH_SIZE (FLASHEND + 1L) | 57 | #define FLASH_SIZE (FLASHEND + 1L) |
| 62 | 58 | ||
| 63 | #if !defined(BOOTLOADER_SIZE) | 59 | #if !defined(BOOTLOADER_SIZE) |
| @@ -69,14 +65,17 @@ | |||
| 69 | #define BOOT_SIZE_1024 0b010 | 65 | #define BOOT_SIZE_1024 0b010 |
| 70 | #define BOOT_SIZE_2048 0b000 | 66 | #define BOOT_SIZE_2048 0b000 |
| 71 | 67 | ||
| 72 | /* | 68 | /** \brief Entering the Bootloader via Software |
| 73 | * Entering the Bootloader via Software | 69 | * |
| 74 | * http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__software_bootloader_start.html | 70 | * http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__software_bootloader_start.html |
| 75 | */ | 71 | */ |
| 76 | #define BOOTLOADER_RESET_KEY 0xB007B007 | 72 | #define BOOTLOADER_RESET_KEY 0xB007B007 |
| 77 | uint32_t reset_key __attribute__ ((section (".noinit"))); | 73 | uint32_t reset_key __attribute__ ((section (".noinit"))); |
| 78 | 74 | ||
| 79 | /* initialize MCU status by watchdog reset */ | 75 | /** \brief initialize MCU status by watchdog reset |
| 76 | * | ||
| 77 | * FIXME: needs doc | ||
| 78 | */ | ||
| 80 | void bootloader_jump(void) { | 79 | void bootloader_jump(void) { |
| 81 | 80 | ||
| 82 | #if !defined(BOOTLOADER_SIZE) | 81 | #if !defined(BOOTLOADER_SIZE) |
diff --git a/tmk_core/common/avr/sleep_led.c b/tmk_core/common/avr/sleep_led.c index dab3eb0f3..0cb774c81 100644 --- a/tmk_core/common/avr/sleep_led.c +++ b/tmk_core/common/avr/sleep_led.c | |||
| @@ -18,6 +18,10 @@ | |||
| 18 | */ | 18 | */ |
| 19 | #define SLEEP_LED_TIMER_TOP F_CPU/(256*64) | 19 | #define SLEEP_LED_TIMER_TOP F_CPU/(256*64) |
| 20 | 20 | ||
| 21 | /** \brief Sleep LED initialization | ||
| 22 | * | ||
| 23 | * FIXME: needs doc | ||
| 24 | */ | ||
| 21 | void sleep_led_init(void) | 25 | void sleep_led_init(void) |
| 22 | { | 26 | { |
| 23 | /* Timer1 setup */ | 27 | /* Timer1 setup */ |
| @@ -33,18 +37,30 @@ void sleep_led_init(void) | |||
| 33 | SREG = sreg; | 37 | SREG = sreg; |
| 34 | } | 38 | } |
| 35 | 39 | ||
| 40 | /** \brief Sleep LED enable | ||
| 41 | * | ||
| 42 | * FIXME: needs doc | ||
| 43 | */ | ||
| 36 | void sleep_led_enable(void) | 44 | void sleep_led_enable(void) |
| 37 | { | 45 | { |
| 38 | /* Enable Compare Match Interrupt */ | 46 | /* Enable Compare Match Interrupt */ |
| 39 | TIMSK1 |= _BV(OCIE1A); | 47 | TIMSK1 |= _BV(OCIE1A); |
| 40 | } | 48 | } |
| 41 | 49 | ||
| 50 | /** \brief Sleep LED disable | ||
| 51 | * | ||
| 52 | * FIXME: needs doc | ||
| 53 | */ | ||
| 42 | void sleep_led_disable(void) | 54 | void sleep_led_disable(void) |
| 43 | { | 55 | { |
| 44 | /* Disable Compare Match Interrupt */ | 56 | /* Disable Compare Match Interrupt */ |
| 45 | TIMSK1 &= ~_BV(OCIE1A); | 57 | TIMSK1 &= ~_BV(OCIE1A); |
| 46 | } | 58 | } |
| 47 | 59 | ||
| 60 | /** \brief Sleep LED toggle | ||
| 61 | * | ||
| 62 | * FIXME: needs doc | ||
| 63 | */ | ||
| 48 | void sleep_led_toggle(void) | 64 | void sleep_led_toggle(void) |
| 49 | { | 65 | { |
| 50 | /* Disable Compare Match Interrupt */ | 66 | /* Disable Compare Match Interrupt */ |
| @@ -52,7 +68,8 @@ void sleep_led_toggle(void) | |||
| 52 | } | 68 | } |
| 53 | 69 | ||
| 54 | 70 | ||
| 55 | /* Breathing Sleep LED brighness(PWM On period) table | 71 | /** \brief Breathing Sleep LED brighness(PWM On period) table |
| 72 | * | ||
| 56 | * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle | 73 | * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle |
| 57 | * | 74 | * |
| 58 | * http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63 | 75 | * http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63 |
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 213f03f6f..4cdd6a420 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c | |||
| @@ -41,6 +41,10 @@ __asm__ __volatile__ ( \ | |||
| 41 | ) | 41 | ) |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | /** \brief Suspend idle | ||
| 45 | * | ||
| 46 | * FIXME: needs doc | ||
| 47 | */ | ||
| 44 | void suspend_idle(uint8_t time) | 48 | void suspend_idle(uint8_t time) |
| 45 | { | 49 | { |
| 46 | cli(); | 50 | cli(); |
| @@ -52,7 +56,8 @@ void suspend_idle(uint8_t time) | |||
| 52 | } | 56 | } |
| 53 | 57 | ||
| 54 | #ifndef NO_SUSPEND_POWER_DOWN | 58 | #ifndef NO_SUSPEND_POWER_DOWN |
| 55 | /* Power down MCU with watchdog timer | 59 | /** \brief Power down MCU with watchdog timer |
| 60 | * | ||
| 56 | * wdto: watchdog timer timeout defined in <avr/wdt.h> | 61 | * wdto: watchdog timer timeout defined in <avr/wdt.h> |
| 57 | * WDTO_15MS | 62 | * WDTO_15MS |
| 58 | * WDTO_30MS | 63 | * WDTO_30MS |
| @@ -67,6 +72,10 @@ void suspend_idle(uint8_t time) | |||
| 67 | */ | 72 | */ |
| 68 | static uint8_t wdt_timeout = 0; | 73 | static uint8_t wdt_timeout = 0; |
| 69 | 74 | ||
| 75 | /** \brief Power down | ||
| 76 | * | ||
| 77 | * FIXME: needs doc | ||
| 78 | */ | ||
| 70 | static void power_down(uint8_t wdto) | 79 | static void power_down(uint8_t wdto) |
| 71 | { | 80 | { |
| 72 | #ifdef PROTOCOL_LUFA | 81 | #ifdef PROTOCOL_LUFA |
| @@ -111,6 +120,10 @@ static void power_down(uint8_t wdto) | |||
| 111 | } | 120 | } |
| 112 | #endif | 121 | #endif |
| 113 | 122 | ||
| 123 | /** \brief Suspend power down | ||
| 124 | * | ||
| 125 | * FIXME: needs doc | ||
| 126 | */ | ||
| 114 | void suspend_power_down(void) | 127 | void suspend_power_down(void) |
| 115 | { | 128 | { |
| 116 | #ifndef NO_SUSPEND_POWER_DOWN | 129 | #ifndef NO_SUSPEND_POWER_DOWN |
| @@ -131,7 +144,10 @@ bool suspend_wakeup_condition(void) | |||
| 131 | return false; | 144 | return false; |
| 132 | } | 145 | } |
| 133 | 146 | ||
| 134 | // run immediately after wakeup | 147 | /** \brief run immediately after wakeup |
| 148 | * | ||
| 149 | * FIXME: needs doc | ||
| 150 | */ | ||
| 135 | void suspend_wakeup_init(void) | 151 | void suspend_wakeup_init(void) |
| 136 | { | 152 | { |
| 137 | // clear keyboard state | 153 | // clear keyboard state |
diff --git a/tmk_core/common/avr/timer.c b/tmk_core/common/avr/timer.c index 369015200..b7d4f060e 100644 --- a/tmk_core/common/avr/timer.c +++ b/tmk_core/common/avr/timer.c | |||
| @@ -27,6 +27,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 27 | // NOTE: union { uint32_t timer32; struct { uint16_t dummy; uint16_t timer16; }} | 27 | // NOTE: union { uint32_t timer32; struct { uint16_t dummy; uint16_t timer16; }} |
| 28 | volatile uint32_t timer_count; | 28 | volatile uint32_t timer_count; |
| 29 | 29 | ||
| 30 | /** \brief timer initialization | ||
| 31 | * | ||
| 32 | * FIXME: needs doc | ||
| 33 | */ | ||
| 30 | void timer_init(void) | 34 | void timer_init(void) |
| 31 | { | 35 | { |
| 32 | #if TIMER_PRESCALER == 1 | 36 | #if TIMER_PRESCALER == 1 |
| @@ -60,6 +64,10 @@ void timer_init(void) | |||
| 60 | #endif | 64 | #endif |
| 61 | } | 65 | } |
| 62 | 66 | ||
| 67 | /** \brief timer clear | ||
| 68 | * | ||
| 69 | * FIXME: needs doc | ||
| 70 | */ | ||
| 63 | inline | 71 | inline |
| 64 | void timer_clear(void) | 72 | void timer_clear(void) |
| 65 | { | 73 | { |
| @@ -68,6 +76,10 @@ void timer_clear(void) | |||
| 68 | } | 76 | } |
| 69 | } | 77 | } |
| 70 | 78 | ||
| 79 | /** \brief timer read | ||
| 80 | * | ||
| 81 | * FIXME: needs doc | ||
| 82 | */ | ||
| 71 | inline | 83 | inline |
| 72 | uint16_t timer_read(void) | 84 | uint16_t timer_read(void) |
| 73 | { | 85 | { |
| @@ -80,6 +92,10 @@ uint16_t timer_read(void) | |||
| 80 | return (t & 0xFFFF); | 92 | return (t & 0xFFFF); |
| 81 | } | 93 | } |
| 82 | 94 | ||
| 95 | /** \brief timer read32 | ||
| 96 | * | ||
| 97 | * FIXME: needs doc | ||
| 98 | */ | ||
| 83 | inline | 99 | inline |
| 84 | uint32_t timer_read32(void) | 100 | uint32_t timer_read32(void) |
| 85 | { | 101 | { |
| @@ -92,6 +108,10 @@ uint32_t timer_read32(void) | |||
| 92 | return t; | 108 | return t; |
| 93 | } | 109 | } |
| 94 | 110 | ||
| 111 | /** \brief timer elapsed | ||
| 112 | * | ||
| 113 | * FIXME: needs doc | ||
| 114 | */ | ||
| 95 | inline | 115 | inline |
| 96 | uint16_t timer_elapsed(uint16_t last) | 116 | uint16_t timer_elapsed(uint16_t last) |
| 97 | { | 117 | { |
| @@ -104,6 +124,10 @@ uint16_t timer_elapsed(uint16_t last) | |||
| 104 | return TIMER_DIFF_16((t & 0xFFFF), last); | 124 | return TIMER_DIFF_16((t & 0xFFFF), last); |
| 105 | } | 125 | } |
| 106 | 126 | ||
| 127 | /** \brief timer elapsed32 | ||
| 128 | * | ||
| 129 | * FIXME: needs doc | ||
| 130 | */ | ||
| 107 | inline | 131 | inline |
| 108 | uint32_t timer_elapsed32(uint32_t last) | 132 | uint32_t timer_elapsed32(uint32_t last) |
| 109 | { | 133 | { |
diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c index 12f75b38a..3e29aacc4 100644 --- a/tmk_core/common/backlight.c +++ b/tmk_core/common/backlight.c | |||
| @@ -21,6 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 21 | 21 | ||
| 22 | backlight_config_t backlight_config; | 22 | backlight_config_t backlight_config; |
| 23 | 23 | ||
| 24 | /** \brief Backlight initialization | ||
| 25 | * | ||
| 26 | * FIXME: needs doc | ||
| 27 | */ | ||
| 24 | void backlight_init(void) | 28 | void backlight_init(void) |
| 25 | { | 29 | { |
| 26 | /* check signature */ | 30 | /* check signature */ |
| @@ -34,6 +38,10 @@ void backlight_init(void) | |||
| 34 | backlight_set(backlight_config.enable ? backlight_config.level : 0); | 38 | backlight_set(backlight_config.enable ? backlight_config.level : 0); |
| 35 | } | 39 | } |
| 36 | 40 | ||
| 41 | /** \brief Backlight increase | ||
| 42 | * | ||
| 43 | * FIXME: needs doc | ||
| 44 | */ | ||
| 37 | void backlight_increase(void) | 45 | void backlight_increase(void) |
| 38 | { | 46 | { |
| 39 | if(backlight_config.level < BACKLIGHT_LEVELS) | 47 | if(backlight_config.level < BACKLIGHT_LEVELS) |
| @@ -46,6 +54,10 @@ void backlight_increase(void) | |||
| 46 | backlight_set(backlight_config.level); | 54 | backlight_set(backlight_config.level); |
| 47 | } | 55 | } |
| 48 | 56 | ||
| 57 | /** \brief Backlight decrease | ||
| 58 | * | ||
| 59 | * FIXME: needs doc | ||
| 60 | */ | ||
| 49 | void backlight_decrease(void) | 61 | void backlight_decrease(void) |
| 50 | { | 62 | { |
| 51 | if(backlight_config.level > 0) | 63 | if(backlight_config.level > 0) |
| @@ -58,6 +70,10 @@ void backlight_decrease(void) | |||
| 58 | backlight_set(backlight_config.level); | 70 | backlight_set(backlight_config.level); |
| 59 | } | 71 | } |
| 60 | 72 | ||
| 73 | /** \brief Backlight toggle | ||
| 74 | * | ||
| 75 | * FIXME: needs doc | ||
| 76 | */ | ||
| 61 | void backlight_toggle(void) | 77 | void backlight_toggle(void) |
| 62 | { | 78 | { |
| 63 | backlight_config.enable ^= 1; | 79 | backlight_config.enable ^= 1; |
| @@ -68,6 +84,10 @@ void backlight_toggle(void) | |||
| 68 | backlight_set(backlight_config.enable ? backlight_config.level : 0); | 84 | backlight_set(backlight_config.enable ? backlight_config.level : 0); |
| 69 | } | 85 | } |
| 70 | 86 | ||
| 87 | /** \brief Backlight step through levels | ||
| 88 | * | ||
| 89 | * FIXME: needs doc | ||
| 90 | */ | ||
| 71 | void backlight_step(void) | 91 | void backlight_step(void) |
| 72 | { | 92 | { |
| 73 | backlight_config.level++; | 93 | backlight_config.level++; |
| @@ -81,6 +101,10 @@ void backlight_step(void) | |||
| 81 | backlight_set(backlight_config.level); | 101 | backlight_set(backlight_config.level); |
| 82 | } | 102 | } |
| 83 | 103 | ||
| 104 | /** \brief Backlight set level | ||
| 105 | * | ||
| 106 | * FIXME: needs doc | ||
| 107 | */ | ||
| 84 | void backlight_level(uint8_t level) | 108 | void backlight_level(uint8_t level) |
| 85 | { | 109 | { |
| 86 | if (level > BACKLIGHT_LEVELS) | 110 | if (level > BACKLIGHT_LEVELS) |
| @@ -91,6 +115,10 @@ void backlight_level(uint8_t level) | |||
| 91 | backlight_set(backlight_config.level); | 115 | backlight_set(backlight_config.level); |
| 92 | } | 116 | } |
| 93 | 117 | ||
| 118 | /** \brief Get backlight level | ||
| 119 | * | ||
| 120 | * FIXME: needs doc | ||
| 121 | */ | ||
| 94 | uint8_t get_backlight_level(void) | 122 | uint8_t get_backlight_level(void) |
| 95 | { | 123 | { |
| 96 | return backlight_config.level; | 124 | return backlight_config.level; |
diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index 2c6bcbae5..9f79fb8ee 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c | |||
| @@ -12,6 +12,10 @@ | |||
| 12 | 12 | ||
| 13 | keymap_config_t keymap_config; | 13 | keymap_config_t keymap_config; |
| 14 | 14 | ||
| 15 | /** \brief Bootmagic | ||
| 16 | * | ||
| 17 | * FIXME: needs doc | ||
| 18 | */ | ||
| 15 | void bootmagic(void) | 19 | void bootmagic(void) |
| 16 | { | 20 | { |
| 17 | /* check signature */ | 21 | /* check signature */ |
| @@ -102,6 +106,10 @@ void bootmagic(void) | |||
| 102 | } | 106 | } |
| 103 | } | 107 | } |
| 104 | 108 | ||
| 109 | /** \brief Scan Keycode | ||
| 110 | * | ||
| 111 | * FIXME: needs doc | ||
| 112 | */ | ||
| 105 | static bool scan_keycode(uint8_t keycode) | 113 | static bool scan_keycode(uint8_t keycode) |
| 106 | { | 114 | { |
| 107 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { | 115 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { |
| @@ -117,9 +125,13 @@ static bool scan_keycode(uint8_t keycode) | |||
| 117 | return false; | 125 | return false; |
| 118 | } | 126 | } |
| 119 | 127 | ||
| 128 | /** \brief Bootmagic Scan Keycode | ||
| 129 | * | ||
| 130 | * FIXME: needs doc | ||
| 131 | */ | ||
| 120 | bool bootmagic_scan_keycode(uint8_t keycode) | 132 | bool bootmagic_scan_keycode(uint8_t keycode) |
| 121 | { | 133 | { |
| 122 | if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; | 134 | if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; |
| 123 | 135 | ||
| 124 | return scan_keycode(keycode); | 136 | return scan_keycode(keycode); |
| 125 | } \ No newline at end of file | 137 | } |
diff --git a/tmk_core/common/bootmagic.h b/tmk_core/common/bootmagic.h index 8f6618f4b..f3ea6a24d 100644 --- a/tmk_core/common/bootmagic.h +++ b/tmk_core/common/bootmagic.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #define BOOTMAGIC_H | 2 | #define BOOTMAGIC_H |
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | /* FIXME: Add special doxygen comments for defines here. */ | ||
| 6 | |||
| 5 | /* bootmagic salt key */ | 7 | /* bootmagic salt key */ |
| 6 | #ifndef BOOTMAGIC_KEY_SALT | 8 | #ifndef BOOTMAGIC_KEY_SALT |
| 7 | #define BOOTMAGIC_KEY_SALT KC_SPACE | 9 | #define BOOTMAGIC_KEY_SALT KC_SPACE |
diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index 2dd3ade34..f9895237b 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c | |||
| @@ -13,11 +13,19 @@ extern uint32_t __ram0_end__; | |||
| 13 | #define MAGIC_ADDR (unsigned long*)(SYMVAL(__ram0_end__) - 4) | 13 | #define MAGIC_ADDR (unsigned long*)(SYMVAL(__ram0_end__) - 4) |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | /** \brief Jump to the bootloader | ||
| 17 | * | ||
| 18 | * FIXME: needs doc | ||
| 19 | */ | ||
| 16 | void bootloader_jump(void) { | 20 | void bootloader_jump(void) { |
| 17 | *MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader | 21 | *MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader |
| 18 | NVIC_SystemReset(); | 22 | NVIC_SystemReset(); |
| 19 | } | 23 | } |
| 20 | 24 | ||
| 25 | /** \brief Enter bootloader mode if requested | ||
| 26 | * | ||
| 27 | * FIXME: needs doc | ||
| 28 | */ | ||
| 21 | void enter_bootloader_mode_if_requested(void) { | 29 | void enter_bootloader_mode_if_requested(void) { |
| 22 | unsigned long* check = MAGIC_ADDR; | 30 | unsigned long* check = MAGIC_ADDR; |
| 23 | if(*check == BOOTLOADER_MAGIC) { | 31 | if(*check == BOOTLOADER_MAGIC) { |
diff --git a/tmk_core/common/chibios/eeprom.c b/tmk_core/common/chibios/eeprom.c index 5ff8ee86f..9061b790c 100644 --- a/tmk_core/common/chibios/eeprom.c +++ b/tmk_core/common/chibios/eeprom.c | |||
| @@ -79,6 +79,10 @@ | |||
| 79 | #define EEESIZE 0x39 | 79 | #define EEESIZE 0x39 |
| 80 | #endif | 80 | #endif |
| 81 | 81 | ||
| 82 | /** \brief eeprom initialization | ||
| 83 | * | ||
| 84 | * FIXME: needs doc | ||
| 85 | */ | ||
| 82 | void eeprom_initialize(void) | 86 | void eeprom_initialize(void) |
| 83 | { | 87 | { |
| 84 | uint32_t count=0; | 88 | uint32_t count=0; |
| @@ -111,6 +115,10 @@ void eeprom_initialize(void) | |||
| 111 | 115 | ||
| 112 | #define FlexRAM ((uint8_t *)0x14000000) | 116 | #define FlexRAM ((uint8_t *)0x14000000) |
| 113 | 117 | ||
| 118 | /** \brief eeprom read byte | ||
| 119 | * | ||
| 120 | * FIXME: needs doc | ||
| 121 | */ | ||
| 114 | uint8_t eeprom_read_byte(const uint8_t *addr) | 122 | uint8_t eeprom_read_byte(const uint8_t *addr) |
| 115 | { | 123 | { |
| 116 | uint32_t offset = (uint32_t)addr; | 124 | uint32_t offset = (uint32_t)addr; |
| @@ -119,6 +127,10 @@ uint8_t eeprom_read_byte(const uint8_t *addr) | |||
| 119 | return FlexRAM[offset]; | 127 | return FlexRAM[offset]; |
| 120 | } | 128 | } |
| 121 | 129 | ||
| 130 | /** \brief eeprom read word | ||
| 131 | * | ||
| 132 | * FIXME: needs doc | ||
| 133 | */ | ||
| 122 | uint16_t eeprom_read_word(const uint16_t *addr) | 134 | uint16_t eeprom_read_word(const uint16_t *addr) |
| 123 | { | 135 | { |
| 124 | uint32_t offset = (uint32_t)addr; | 136 | uint32_t offset = (uint32_t)addr; |
| @@ -127,6 +139,10 @@ uint16_t eeprom_read_word(const uint16_t *addr) | |||
| 127 | return *(uint16_t *)(&FlexRAM[offset]); | 139 | return *(uint16_t *)(&FlexRAM[offset]); |
| 128 | } | 140 | } |
| 129 | 141 | ||
| 142 | /** \brief eeprom read dword | ||
| 143 | * | ||
| 144 | * FIXME: needs doc | ||
| 145 | */ | ||
| 130 | uint32_t eeprom_read_dword(const uint32_t *addr) | 146 | uint32_t eeprom_read_dword(const uint32_t *addr) |
| 131 | { | 147 | { |
| 132 | uint32_t offset = (uint32_t)addr; | 148 | uint32_t offset = (uint32_t)addr; |
| @@ -135,6 +151,10 @@ uint32_t eeprom_read_dword(const uint32_t *addr) | |||
| 135 | return *(uint32_t *)(&FlexRAM[offset]); | 151 | return *(uint32_t *)(&FlexRAM[offset]); |
| 136 | } | 152 | } |
| 137 | 153 | ||
| 154 | /** \brief eeprom read block | ||
| 155 | * | ||
| 156 | * FIXME: needs doc | ||
| 157 | */ | ||
| 138 | void eeprom_read_block(void *buf, const void *addr, uint32_t len) | 158 | void eeprom_read_block(void *buf, const void *addr, uint32_t len) |
| 139 | { | 159 | { |
| 140 | uint32_t offset = (uint32_t)addr; | 160 | uint32_t offset = (uint32_t)addr; |
| @@ -148,11 +168,19 @@ void eeprom_read_block(void *buf, const void *addr, uint32_t len) | |||
| 148 | } | 168 | } |
| 149 | } | 169 | } |
| 150 | 170 | ||
| 171 | /** \brief eeprom is ready | ||
| 172 | * | ||
| 173 | * FIXME: needs doc | ||
| 174 | */ | ||
| 151 | int eeprom_is_ready(void) | 175 | int eeprom_is_ready(void) |
| 152 | { | 176 | { |
| 153 | return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0; | 177 | return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0; |
| 154 | } | 178 | } |
| 155 | 179 | ||
| 180 | /** \brief flexram wait | ||
| 181 | * | ||
| 182 | * FIXME: needs doc | ||
| 183 | */ | ||
| 156 | static void flexram_wait(void) | 184 | static void flexram_wait(void) |
| 157 | { | 185 | { |
| 158 | while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { | 186 | while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { |
| @@ -160,6 +188,10 @@ static void flexram_wait(void) | |||
| 160 | } | 188 | } |
| 161 | } | 189 | } |
| 162 | 190 | ||
| 191 | /** \brief eeprom_write_byte | ||
| 192 | * | ||
| 193 | * FIXME: needs doc | ||
| 194 | */ | ||
| 163 | void eeprom_write_byte(uint8_t *addr, uint8_t value) | 195 | void eeprom_write_byte(uint8_t *addr, uint8_t value) |
| 164 | { | 196 | { |
| 165 | uint32_t offset = (uint32_t)addr; | 197 | uint32_t offset = (uint32_t)addr; |
| @@ -172,6 +204,10 @@ void eeprom_write_byte(uint8_t *addr, uint8_t value) | |||
| 172 | } | 204 | } |
| 173 | } | 205 | } |
| 174 | 206 | ||
| 207 | /** \brief eeprom write word | ||
| 208 | * | ||
| 209 | * FIXME: needs doc | ||
| 210 | */ | ||
| 175 | void eeprom_write_word(uint16_t *addr, uint16_t value) | 211 | void eeprom_write_word(uint16_t *addr, uint16_t value) |
| 176 | { | 212 | { |
| 177 | uint32_t offset = (uint32_t)addr; | 213 | uint32_t offset = (uint32_t)addr; |
| @@ -199,6 +235,10 @@ void eeprom_write_word(uint16_t *addr, uint16_t value) | |||
| 199 | #endif | 235 | #endif |
| 200 | } | 236 | } |
| 201 | 237 | ||
| 238 | /** \brief eeprom write dword | ||
| 239 | * | ||
| 240 | * FIXME: needs doc | ||
| 241 | */ | ||
| 202 | void eeprom_write_dword(uint32_t *addr, uint32_t value) | 242 | void eeprom_write_dword(uint32_t *addr, uint32_t value) |
| 203 | { | 243 | { |
| 204 | uint32_t offset = (uint32_t)addr; | 244 | uint32_t offset = (uint32_t)addr; |
| @@ -242,6 +282,10 @@ void eeprom_write_dword(uint32_t *addr, uint32_t value) | |||
| 242 | #endif | 282 | #endif |
| 243 | } | 283 | } |
| 244 | 284 | ||
| 285 | /** \brief eeprom write block | ||
| 286 | * | ||
| 287 | * FIXME: needs doc | ||
| 288 | */ | ||
| 245 | void eeprom_write_block(const void *buf, void *addr, uint32_t len) | 289 | void eeprom_write_block(const void *buf, void *addr, uint32_t len) |
| 246 | { | 290 | { |
| 247 | uint32_t offset = (uint32_t)addr; | 291 | uint32_t offset = (uint32_t)addr; |
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 7c3c75387..32ef773e2 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c | |||
| @@ -12,11 +12,19 @@ | |||
| 12 | #include "suspend.h" | 12 | #include "suspend.h" |
| 13 | #include "wait.h" | 13 | #include "wait.h" |
| 14 | 14 | ||
| 15 | /** \brief suspend idle | ||
| 16 | * | ||
| 17 | * FIXME: needs doc | ||
| 18 | */ | ||
| 15 | void suspend_idle(uint8_t time) { | 19 | void suspend_idle(uint8_t time) { |
| 16 | // TODO: this is not used anywhere - what units is 'time' in? | 20 | // TODO: this is not used anywhere - what units is 'time' in? |
| 17 | wait_ms(time); | 21 | wait_ms(time); |
| 18 | } | 22 | } |
| 19 | 23 | ||
| 24 | /** \brief suspend power down | ||
| 25 | * | ||
| 26 | * FIXME: needs doc | ||
| 27 | */ | ||
| 20 | void suspend_power_down(void) { | 28 | void suspend_power_down(void) { |
| 21 | // TODO: figure out what to power down and how | 29 | // TODO: figure out what to power down and how |
| 22 | // shouldn't power down TPM/FTM if we want a breathing LED | 30 | // shouldn't power down TPM/FTM if we want a breathing LED |
| @@ -28,6 +36,10 @@ void suspend_power_down(void) { | |||
| 28 | wait_ms(17); | 36 | wait_ms(17); |
| 29 | } | 37 | } |
| 30 | 38 | ||
| 39 | /** \brief suspend wakeup condition | ||
| 40 | * | ||
| 41 | * FIXME: needs doc | ||
| 42 | */ | ||
| 31 | __attribute__ ((weak)) void matrix_power_up(void) {} | 43 | __attribute__ ((weak)) void matrix_power_up(void) {} |
| 32 | __attribute__ ((weak)) void matrix_power_down(void) {} | 44 | __attribute__ ((weak)) void matrix_power_down(void) {} |
| 33 | bool suspend_wakeup_condition(void) | 45 | bool suspend_wakeup_condition(void) |
| @@ -41,7 +53,11 @@ bool suspend_wakeup_condition(void) | |||
| 41 | return false; | 53 | return false; |
| 42 | } | 54 | } |
| 43 | 55 | ||
| 44 | // run immediately after wakeup | 56 | /** \brief suspend wakeup condition |
| 57 | * | ||
| 58 | * run immediately after wakeup | ||
| 59 | * FIXME: needs doc | ||
| 60 | */ | ||
| 45 | void suspend_wakeup_init(void) | 61 | void suspend_wakeup_init(void) |
| 46 | { | 62 | { |
| 47 | // clear keyboard state | 63 | // clear keyboard state |
diff --git a/tmk_core/common/command.h b/tmk_core/common/command.h index a729e4b1e..d9d89ba0f 100644 --- a/tmk_core/common/command.h +++ b/tmk_core/common/command.h | |||
| @@ -18,6 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 18 | #ifndef COMMAND_H | 18 | #ifndef COMMAND_H |
| 19 | #define COMMAND | 19 | #define COMMAND |
| 20 | 20 | ||
| 21 | /* FIXME: Add doxygen comments for the behavioral defines in here. */ | ||
| 22 | |||
| 21 | /* TODO: Refactoring */ | 23 | /* TODO: Refactoring */ |
| 22 | typedef enum { ONESHOT, CONSOLE, MOUSEKEY } command_state_t; | 24 | typedef enum { ONESHOT, CONSOLE, MOUSEKEY } command_state_t; |
| 23 | extern command_state_t command_state; | 25 | extern command_state_t command_state; |
| @@ -154,4 +156,4 @@ bool command_proc(uint8_t code); | |||
| 154 | #define XMAGIC_KC(key) KC_##key | 156 | #define XMAGIC_KC(key) KC_##key |
| 155 | #define MAGIC_KC(key) XMAGIC_KC(key) | 157 | #define MAGIC_KC(key) XMAGIC_KC(key) |
| 156 | 158 | ||
| 157 | #endif \ No newline at end of file | 159 | #endif |
diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index e2eb4a38e..91c18e2e6 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c | |||
| @@ -3,6 +3,10 @@ | |||
| 3 | #include "eeprom.h" | 3 | #include "eeprom.h" |
| 4 | #include "eeconfig.h" | 4 | #include "eeconfig.h" |
| 5 | 5 | ||
| 6 | /** \brief eeconfig initialization | ||
| 7 | * | ||
| 8 | * FIXME: needs doc | ||
| 9 | */ | ||
| 6 | void eeconfig_init(void) | 10 | void eeconfig_init(void) |
| 7 | { | 11 | { |
| 8 | eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); | 12 | eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); |
| @@ -24,36 +28,88 @@ void eeconfig_init(void) | |||
| 24 | #endif | 28 | #endif |
| 25 | } | 29 | } |
| 26 | 30 | ||
| 31 | /** \brief eeconfig enable | ||
| 32 | * | ||
| 33 | * FIXME: needs doc | ||
| 34 | */ | ||
| 27 | void eeconfig_enable(void) | 35 | void eeconfig_enable(void) |
| 28 | { | 36 | { |
| 29 | eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); | 37 | eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); |
| 30 | } | 38 | } |
| 31 | 39 | ||
| 40 | /** \brief eeconfig disable | ||
| 41 | * | ||
| 42 | * FIXME: needs doc | ||
| 43 | */ | ||
| 32 | void eeconfig_disable(void) | 44 | void eeconfig_disable(void) |
| 33 | { | 45 | { |
| 34 | eeprom_update_word(EECONFIG_MAGIC, 0xFFFF); | 46 | eeprom_update_word(EECONFIG_MAGIC, 0xFFFF); |
| 35 | } | 47 | } |
| 36 | 48 | ||
| 49 | /** \brief eeconfig is enabled | ||
| 50 | * | ||
| 51 | * FIXME: needs doc | ||
| 52 | */ | ||
| 37 | bool eeconfig_is_enabled(void) | 53 | bool eeconfig_is_enabled(void) |
| 38 | { | 54 | { |
| 39 | return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER); | 55 | return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER); |
| 40 | } | 56 | } |
| 41 | 57 | ||
| 58 | /** \brief eeconfig read debug | ||
| 59 | * | ||
| 60 | * FIXME: needs doc | ||
| 61 | */ | ||
| 42 | uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } | 62 | uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } |
| 63 | /** \brief eeconfig update debug | ||
| 64 | * | ||
| 65 | * FIXME: needs doc | ||
| 66 | */ | ||
| 43 | void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); } | 67 | void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); } |
| 44 | 68 | ||
| 69 | /** \brief eeconfig read default layer | ||
| 70 | * | ||
| 71 | * FIXME: needs doc | ||
| 72 | */ | ||
| 45 | uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } | 73 | uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } |
| 74 | /** \brief eeconfig update default layer | ||
| 75 | * | ||
| 76 | * FIXME: needs doc | ||
| 77 | */ | ||
| 46 | void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); } | 78 | void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); } |
| 47 | 79 | ||
| 80 | /** \brief eeconfig read keymap | ||
| 81 | * | ||
| 82 | * FIXME: needs doc | ||
| 83 | */ | ||
| 48 | uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); } | 84 | uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); } |
| 85 | /** \brief eeconfig update keymap | ||
| 86 | * | ||
| 87 | * FIXME: needs doc | ||
| 88 | */ | ||
| 49 | void eeconfig_update_keymap(uint8_t val) { eeprom_update_byte(EECONFIG_KEYMAP, val); } | 89 | void eeconfig_update_keymap(uint8_t val) { eeprom_update_byte(EECONFIG_KEYMAP, val); } |
| 50 | 90 | ||
| 51 | #ifdef BACKLIGHT_ENABLE | 91 | #ifdef BACKLIGHT_ENABLE |
| 92 | /** \brief eeconfig read backlight | ||
| 93 | * | ||
| 94 | * FIXME: needs doc | ||
| 95 | */ | ||
| 52 | uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); } | 96 | uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); } |
| 97 | /** \brief eeconfig update backlight | ||
| 98 | * | ||
| 99 | * FIXME: needs doc | ||
| 100 | */ | ||
| 53 | void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); } | 101 | void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); } |
| 54 | #endif | 102 | #endif |
| 55 | 103 | ||
| 56 | #ifdef AUDIO_ENABLE | 104 | #ifdef AUDIO_ENABLE |
| 105 | /** \brief eeconfig read audio | ||
| 106 | * | ||
| 107 | * FIXME: needs doc | ||
| 108 | */ | ||
| 57 | uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); } | 109 | uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); } |
| 110 | /** \brief eeconfig update audio | ||
| 111 | * | ||
| 112 | * FIXME: needs doc | ||
| 113 | */ | ||
| 58 | void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); } | 114 | void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); } |
| 59 | #endif | 115 | #endif |
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 001fb00ce..4eff764e2 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -117,19 +117,35 @@ static inline bool has_ghost_in_row(uint8_t row, matrix_row_t rowdata) | |||
| 117 | 117 | ||
| 118 | #endif | 118 | #endif |
| 119 | 119 | ||
| 120 | /** \brief matrix_setup | ||
| 121 | * | ||
| 122 | * FIXME: needs doc | ||
| 123 | */ | ||
| 120 | __attribute__ ((weak)) | 124 | __attribute__ ((weak)) |
| 121 | void matrix_setup(void) { | 125 | void matrix_setup(void) { |
| 122 | } | 126 | } |
| 123 | 127 | ||
| 128 | /** \brief keyboard_setup | ||
| 129 | * | ||
| 130 | * FIXME: needs doc | ||
| 131 | */ | ||
| 124 | void keyboard_setup(void) { | 132 | void keyboard_setup(void) { |
| 125 | matrix_setup(); | 133 | matrix_setup(); |
| 126 | } | 134 | } |
| 127 | 135 | ||
| 136 | /** \brief is_keyboard_master | ||
| 137 | * | ||
| 138 | * FIXME: needs doc | ||
| 139 | */ | ||
| 128 | __attribute__((weak)) | 140 | __attribute__((weak)) |
| 129 | bool is_keyboard_master(void) { | 141 | bool is_keyboard_master(void) { |
| 130 | return true; | 142 | return true; |
| 131 | } | 143 | } |
| 132 | 144 | ||
| 145 | /** \brief keyboard_init | ||
| 146 | * | ||
| 147 | * FIXME: needs doc | ||
| 148 | */ | ||
| 133 | void keyboard_init(void) { | 149 | void keyboard_init(void) { |
| 134 | timer_init(); | 150 | timer_init(); |
| 135 | matrix_init(); | 151 | matrix_init(); |
| @@ -167,8 +183,16 @@ void keyboard_init(void) { | |||
| 167 | #endif | 183 | #endif |
| 168 | } | 184 | } |
| 169 | 185 | ||
| 170 | /* | 186 | /** \brief Keyboard task: Do keyboard routine jobs |
| 171 | * Do keyboard routine jobs: scan matrix, light LEDs, ... | 187 | * |
| 188 | * Do routine keyboard jobs: | ||
| 189 | * | ||
| 190 | * * scan matrix | ||
| 191 | * * handle mouse movements | ||
| 192 | * * run visualizer code | ||
| 193 | * * handle midi commands | ||
| 194 | * * light LEDs | ||
| 195 | * | ||
| 172 | * This is repeatedly called as fast as possible. | 196 | * This is repeatedly called as fast as possible. |
| 173 | */ | 197 | */ |
| 174 | void keyboard_task(void) | 198 | void keyboard_task(void) |
| @@ -274,6 +298,10 @@ MATRIX_LOOP_END: | |||
| 274 | } | 298 | } |
| 275 | } | 299 | } |
| 276 | 300 | ||
| 301 | /** \brief keyboard set leds | ||
| 302 | * | ||
| 303 | * FIXME: needs doc | ||
| 304 | */ | ||
| 277 | void keyboard_set_leds(uint8_t leds) | 305 | void keyboard_set_leds(uint8_t leds) |
| 278 | { | 306 | { |
| 279 | if (debug_keyboard) { debug("keyboard_set_led: "); debug_hex8(leds); debug("\n"); } | 307 | if (debug_keyboard) { debug("keyboard_set_led: "); debug_hex8(leds); debug("\n"); } |
diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index e7e09e098..734c9fbff 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h | |||
| @@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 22 | #ifndef KEYCODE_H | 22 | #ifndef KEYCODE_H |
| 23 | #define KEYCODE_H | 23 | #define KEYCODE_H |
| 24 | 24 | ||
| 25 | /* FIXME: Add doxygen comments here */ | ||
| 25 | 26 | ||
| 26 | #define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED) | 27 | #define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED) |
| 27 | #define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF) | 28 | #define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF) |
diff --git a/tmk_core/common/led.h b/tmk_core/common/led.h index 61c971c10..c16305129 100644 --- a/tmk_core/common/led.h +++ b/tmk_core/common/led.h | |||
| @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 19 | #define LED_H | 19 | #define LED_H |
| 20 | #include "stdint.h" | 20 | #include "stdint.h" |
| 21 | 21 | ||
| 22 | /* FIXME: Add doxygen comments here. */ | ||
| 22 | 23 | ||
| 23 | /* keyboard LEDs */ | 24 | /* keyboard LEDs */ |
| 24 | #define USB_LED_NUM_LOCK 0 | 25 | #define USB_LED_NUM_LOCK 0 |
| @@ -40,4 +41,4 @@ void led_init_ports(void); | |||
| 40 | } | 41 | } |
| 41 | #endif | 42 | #endif |
| 42 | 43 | ||
| 43 | #endif \ No newline at end of file | 44 | #endif |
diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c index 49617a3d1..714acc0f5 100644 --- a/tmk_core/common/magic.c +++ b/tmk_core/common/magic.c | |||
| @@ -14,6 +14,10 @@ | |||
| 14 | 14 | ||
| 15 | keymap_config_t keymap_config; | 15 | keymap_config_t keymap_config; |
| 16 | 16 | ||
| 17 | /** \brief Magic | ||
| 18 | * | ||
| 19 | * FIXME: Needs doc | ||
| 20 | */ | ||
| 17 | void magic(void) | 21 | void magic(void) |
| 18 | { | 22 | { |
| 19 | /* check signature */ | 23 | /* check signature */ |
diff --git a/tmk_core/common/report.c b/tmk_core/common/report.c index 4b25f4428..eb3b44312 100644 --- a/tmk_core/common/report.c +++ b/tmk_core/common/report.c | |||
| @@ -20,6 +20,10 @@ | |||
| 20 | #include "debug.h" | 20 | #include "debug.h" |
| 21 | #include "util.h" | 21 | #include "util.h" |
| 22 | 22 | ||
| 23 | /** \brief has_anykey | ||
| 24 | * | ||
| 25 | * FIXME: Needs doc | ||
| 26 | */ | ||
| 23 | uint8_t has_anykey(report_keyboard_t* keyboard_report) | 27 | uint8_t has_anykey(report_keyboard_t* keyboard_report) |
| 24 | { | 28 | { |
| 25 | uint8_t cnt = 0; | 29 | uint8_t cnt = 0; |
| @@ -30,6 +34,10 @@ uint8_t has_anykey(report_keyboard_t* keyboard_report) | |||
| 30 | return cnt; | 34 | return cnt; |
| 31 | } | 35 | } |
| 32 | 36 | ||
| 37 | /** \brief get_first_key | ||
| 38 | * | ||
| 39 | * FIXME: Needs doc | ||
| 40 | */ | ||
| 33 | uint8_t get_first_key(report_keyboard_t* keyboard_report) | 41 | uint8_t get_first_key(report_keyboard_t* keyboard_report) |
| 34 | { | 42 | { |
| 35 | #ifdef NKRO_ENABLE | 43 | #ifdef NKRO_ENABLE |
| @@ -54,6 +62,10 @@ uint8_t get_first_key(report_keyboard_t* keyboard_report) | |||
| 54 | #endif | 62 | #endif |
| 55 | } | 63 | } |
| 56 | 64 | ||
| 65 | /** \brief add key byte | ||
| 66 | * | ||
| 67 | * FIXME: Needs doc | ||
| 68 | */ | ||
| 57 | void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) | 69 | void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) |
| 58 | { | 70 | { |
| 59 | #ifdef USB_6KRO_ENABLE | 71 | #ifdef USB_6KRO_ENABLE |
| @@ -120,6 +132,10 @@ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) | |||
| 120 | #endif | 132 | #endif |
| 121 | } | 133 | } |
| 122 | 134 | ||
| 135 | /** \brief del key byte | ||
| 136 | * | ||
| 137 | * FIXME: Needs doc | ||
| 138 | */ | ||
| 123 | void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) | 139 | void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) |
| 124 | { | 140 | { |
| 125 | #ifdef USB_6KRO_ENABLE | 141 | #ifdef USB_6KRO_ENABLE |
| @@ -157,6 +173,10 @@ void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) | |||
| 157 | } | 173 | } |
| 158 | 174 | ||
| 159 | #ifdef NKRO_ENABLE | 175 | #ifdef NKRO_ENABLE |
| 176 | /** \brief add key bit | ||
| 177 | * | ||
| 178 | * FIXME: Needs doc | ||
| 179 | */ | ||
| 160 | void add_key_bit(report_keyboard_t* keyboard_report, uint8_t code) | 180 | void add_key_bit(report_keyboard_t* keyboard_report, uint8_t code) |
| 161 | { | 181 | { |
| 162 | if ((code>>3) < KEYBOARD_REPORT_BITS) { | 182 | if ((code>>3) < KEYBOARD_REPORT_BITS) { |
| @@ -166,6 +186,10 @@ void add_key_bit(report_keyboard_t* keyboard_report, uint8_t code) | |||
| 166 | } | 186 | } |
| 167 | } | 187 | } |
| 168 | 188 | ||
| 189 | /** \brief del key bit | ||
| 190 | * | ||
| 191 | * FIXME: Needs doc | ||
| 192 | */ | ||
| 169 | void del_key_bit(report_keyboard_t* keyboard_report, uint8_t code) | 193 | void del_key_bit(report_keyboard_t* keyboard_report, uint8_t code) |
| 170 | { | 194 | { |
| 171 | if ((code>>3) < KEYBOARD_REPORT_BITS) { | 195 | if ((code>>3) < KEYBOARD_REPORT_BITS) { |
| @@ -176,6 +200,10 @@ void del_key_bit(report_keyboard_t* keyboard_report, uint8_t code) | |||
| 176 | } | 200 | } |
| 177 | #endif | 201 | #endif |
| 178 | 202 | ||
| 203 | /** \brief add key to report | ||
| 204 | * | ||
| 205 | * FIXME: Needs doc | ||
| 206 | */ | ||
| 179 | void add_key_to_report(report_keyboard_t* keyboard_report, uint8_t key) | 207 | void add_key_to_report(report_keyboard_t* keyboard_report, uint8_t key) |
| 180 | { | 208 | { |
| 181 | #ifdef NKRO_ENABLE | 209 | #ifdef NKRO_ENABLE |
| @@ -187,6 +215,10 @@ void add_key_to_report(report_keyboard_t* keyboard_report, uint8_t key) | |||
| 187 | add_key_byte(keyboard_report, key); | 215 | add_key_byte(keyboard_report, key); |
| 188 | } | 216 | } |
| 189 | 217 | ||
| 218 | /** \brief del key from report | ||
| 219 | * | ||
| 220 | * FIXME: Needs doc | ||
| 221 | */ | ||
| 190 | void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key) | 222 | void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key) |
| 191 | { | 223 | { |
| 192 | #ifdef NKRO_ENABLE | 224 | #ifdef NKRO_ENABLE |
| @@ -198,6 +230,10 @@ void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key) | |||
| 198 | del_key_byte(keyboard_report, key); | 230 | del_key_byte(keyboard_report, key); |
| 199 | } | 231 | } |
| 200 | 232 | ||
| 233 | /** \brief clear key from report | ||
| 234 | * | ||
| 235 | * FIXME: Needs doc | ||
| 236 | */ | ||
| 201 | void clear_keys_from_report(report_keyboard_t* keyboard_report) | 237 | void clear_keys_from_report(report_keyboard_t* keyboard_report) |
| 202 | { | 238 | { |
| 203 | // not clear mods | 239 | // not clear mods |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index a1cab98a6..cb918d3dc 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
| @@ -141,6 +141,10 @@ USB_ClassInfo_CDC_Device_t cdc_device = | |||
| 141 | 141 | ||
| 142 | #ifdef RAW_ENABLE | 142 | #ifdef RAW_ENABLE |
| 143 | 143 | ||
| 144 | /** \brief Raw HID Send | ||
| 145 | * | ||
| 146 | * FIXME: Needs doc | ||
| 147 | */ | ||
| 144 | void raw_hid_send( uint8_t *data, uint8_t length ) | 148 | void raw_hid_send( uint8_t *data, uint8_t length ) |
| 145 | { | 149 | { |
| 146 | // TODO: implement variable size packet | 150 | // TODO: implement variable size packet |
| @@ -172,6 +176,10 @@ void raw_hid_send( uint8_t *data, uint8_t length ) | |||
| 172 | Endpoint_SelectEndpoint(ep); | 176 | Endpoint_SelectEndpoint(ep); |
| 173 | } | 177 | } |
| 174 | 178 | ||
| 179 | /** \brief Raw HID Receive | ||
| 180 | * | ||
| 181 | * FIXME: Needs doc | ||
| 182 | */ | ||
| 175 | __attribute__ ((weak)) | 183 | __attribute__ ((weak)) |
| 176 | void raw_hid_receive( uint8_t *data, uint8_t length ) | 184 | void raw_hid_receive( uint8_t *data, uint8_t length ) |
| 177 | { | 185 | { |
| @@ -180,6 +188,10 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) | |||
| 180 | // so users can opt to not handle data coming in. | 188 | // so users can opt to not handle data coming in. |
| 181 | } | 189 | } |
| 182 | 190 | ||
| 191 | /** \brief Raw HID Task | ||
| 192 | * | ||
| 193 | * FIXME: Needs doc | ||
| 194 | */ | ||
| 183 | static void raw_hid_task(void) | 195 | static void raw_hid_task(void) |
| 184 | { | 196 | { |
| 185 | // Create a temporary buffer to hold the read in data from the host | 197 | // Create a temporary buffer to hold the read in data from the host |
| @@ -218,6 +230,10 @@ static void raw_hid_task(void) | |||
| 218 | * Console | 230 | * Console |
| 219 | ******************************************************************************/ | 231 | ******************************************************************************/ |
| 220 | #ifdef CONSOLE_ENABLE | 232 | #ifdef CONSOLE_ENABLE |
| 233 | /** \brief Console Task | ||
| 234 | * | ||
| 235 | * FIXME: Needs doc | ||
| 236 | */ | ||
| 221 | static void Console_Task(void) | 237 | static void Console_Task(void) |
| 222 | { | 238 | { |
| 223 | /* Device must be connected and configured for the task to run */ | 239 | /* Device must be connected and configured for the task to run */ |
| @@ -282,6 +298,10 @@ static void Console_Task(void) | |||
| 282 | * 2) EVENT_USB_Device_Reset | 298 | * 2) EVENT_USB_Device_Reset |
| 283 | * 3) EVENT_USB_Device_Wake | 299 | * 3) EVENT_USB_Device_Wake |
| 284 | */ | 300 | */ |
| 301 | /** \brief Event USB Device Connect | ||
| 302 | * | ||
| 303 | * FIXME: Needs doc | ||
| 304 | */ | ||
| 285 | void EVENT_USB_Device_Connect(void) | 305 | void EVENT_USB_Device_Connect(void) |
| 286 | { | 306 | { |
| 287 | print("[C]"); | 307 | print("[C]"); |
| @@ -293,6 +313,10 @@ void EVENT_USB_Device_Connect(void) | |||
| 293 | } | 313 | } |
| 294 | } | 314 | } |
| 295 | 315 | ||
| 316 | /** \brief Event USB Device Connect | ||
| 317 | * | ||
| 318 | * FIXME: Needs doc | ||
| 319 | */ | ||
| 296 | void EVENT_USB_Device_Disconnect(void) | 320 | void EVENT_USB_Device_Disconnect(void) |
| 297 | { | 321 | { |
| 298 | print("[D]"); | 322 | print("[D]"); |
| @@ -307,11 +331,19 @@ void EVENT_USB_Device_Disconnect(void) | |||
| 307 | */ | 331 | */ |
| 308 | } | 332 | } |
| 309 | 333 | ||
| 334 | /** \brief Event USB Device Connect | ||
| 335 | * | ||
| 336 | * FIXME: Needs doc | ||
| 337 | */ | ||
| 310 | void EVENT_USB_Device_Reset(void) | 338 | void EVENT_USB_Device_Reset(void) |
| 311 | { | 339 | { |
| 312 | print("[R]"); | 340 | print("[R]"); |
| 313 | } | 341 | } |
| 314 | 342 | ||
| 343 | /** \brief Event USB Device Connect | ||
| 344 | * | ||
| 345 | * FIXME: Needs doc | ||
| 346 | */ | ||
| 315 | void EVENT_USB_Device_Suspend() | 347 | void EVENT_USB_Device_Suspend() |
| 316 | { | 348 | { |
| 317 | print("[S]"); | 349 | print("[S]"); |
| @@ -320,6 +352,10 @@ void EVENT_USB_Device_Suspend() | |||
| 320 | #endif | 352 | #endif |
| 321 | } | 353 | } |
| 322 | 354 | ||
| 355 | /** \brief Event USB Device Connect | ||
| 356 | * | ||
| 357 | * FIXME: Needs doc | ||
| 358 | */ | ||
| 323 | void EVENT_USB_Device_WakeUp() | 359 | void EVENT_USB_Device_WakeUp() |
| 324 | { | 360 | { |
| 325 | print("[W]"); | 361 | print("[W]"); |
| @@ -342,7 +378,11 @@ static bool console_flush = false; | |||
| 342 | } \ | 378 | } \ |
| 343 | } while (0) | 379 | } while (0) |
| 344 | 380 | ||
| 345 | // called every 1ms | 381 | /** \brief Event USB Device Start Of Frame |
| 382 | * | ||
| 383 | * FIXME: Needs doc | ||
| 384 | * called every 1ms | ||
| 385 | */ | ||
| 346 | void EVENT_USB_Device_StartOfFrame(void) | 386 | void EVENT_USB_Device_StartOfFrame(void) |
| 347 | { | 387 | { |
| 348 | static uint8_t count; | 388 | static uint8_t count; |
| @@ -356,11 +396,12 @@ void EVENT_USB_Device_StartOfFrame(void) | |||
| 356 | 396 | ||
| 357 | #endif | 397 | #endif |
| 358 | 398 | ||
| 359 | /** Event handler for the USB_ConfigurationChanged event. | 399 | /** \brief Event handler for the USB_ConfigurationChanged event. |
| 400 | * | ||
| 360 | * This is fired when the host sets the current configuration of the USB device after enumeration. | 401 | * This is fired when the host sets the current configuration of the USB device after enumeration. |
| 361 | * | 402 | * |
| 362 | * ATMega32u2 supports dual bank(ping-pong mode) only on endpoint 3 and 4, | 403 | * ATMega32u2 supports dual bank(ping-pong mode) only on endpoint 3 and 4, |
| 363 | * it is safe to use singl bank for all endpoints. | 404 | * it is safe to use single bank for all endpoints. |
| 364 | */ | 405 | */ |
| 365 | void EVENT_USB_Device_ConfigurationChanged(void) | 406 | void EVENT_USB_Device_ConfigurationChanged(void) |
| 366 | { | 407 | { |
| @@ -418,7 +459,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) | |||
| 418 | #endif | 459 | #endif |
| 419 | } | 460 | } |
| 420 | 461 | ||
| 421 | /* | 462 | /* FIXME: Expose this table in the docs somehow |
| 422 | Appendix G: HID Request Support Requirements | 463 | Appendix G: HID Request Support Requirements |
| 423 | 464 | ||
| 424 | The following table enumerates the requests that need to be supported by various types of HID class devices. | 465 | The following table enumerates the requests that need to be supported by various types of HID class devices. |
| @@ -431,7 +472,8 @@ Boot Keyboard Required Optional Required Required Required Requ | |||
| 431 | Non-Boot Keybrd Required Optional Required Required Optional Optional | 472 | Non-Boot Keybrd Required Optional Required Required Optional Optional |
| 432 | Other Device Required Optional Optional Optional Optional Optional | 473 | Other Device Required Optional Optional Optional Optional Optional |
| 433 | */ | 474 | */ |
| 434 | /** Event handler for the USB_ControlRequest event. | 475 | /** \brief Event handler for the USB_ControlRequest event. |
| 476 | * | ||
| 435 | * This is fired before passing along unhandled control requests to the library for processing internally. | 477 | * This is fired before passing along unhandled control requests to the library for processing internally. |
| 436 | */ | 478 | */ |
| 437 | void EVENT_USB_Device_ControlRequest(void) | 479 | void EVENT_USB_Device_ControlRequest(void) |
| @@ -546,11 +588,19 @@ void EVENT_USB_Device_ControlRequest(void) | |||
| 546 | /******************************************************************************* | 588 | /******************************************************************************* |
| 547 | * Host driver | 589 | * Host driver |
| 548 | ******************************************************************************/ | 590 | ******************************************************************************/ |
| 591 | /** \brief Keyboard LEDs | ||
| 592 | * | ||
| 593 | * FIXME: Needs doc | ||
| 594 | */ | ||
| 549 | static uint8_t keyboard_leds(void) | 595 | static uint8_t keyboard_leds(void) |
| 550 | { | 596 | { |
| 551 | return keyboard_led_stats; | 597 | return keyboard_led_stats; |
| 552 | } | 598 | } |
| 553 | 599 | ||
| 600 | /** \brief Send Keyboard | ||
| 601 | * | ||
| 602 | * FIXME: Needs doc | ||
| 603 | */ | ||
| 554 | static void send_keyboard(report_keyboard_t *report) | 604 | static void send_keyboard(report_keyboard_t *report) |
| 555 | { | 605 | { |
| 556 | uint8_t timeout = 255; | 606 | uint8_t timeout = 255; |
| @@ -612,7 +662,11 @@ static void send_keyboard(report_keyboard_t *report) | |||
| 612 | 662 | ||
| 613 | keyboard_report_sent = *report; | 663 | keyboard_report_sent = *report; |
| 614 | } | 664 | } |
| 615 | 665 | ||
| 666 | /** \brief Send Mouse | ||
| 667 | * | ||
| 668 | * FIXME: Needs doc | ||
| 669 | */ | ||
| 616 | static void send_mouse(report_mouse_t *report) | 670 | static void send_mouse(report_mouse_t *report) |
| 617 | { | 671 | { |
| 618 | #ifdef MOUSE_ENABLE | 672 | #ifdef MOUSE_ENABLE |
| @@ -657,6 +711,10 @@ static void send_mouse(report_mouse_t *report) | |||
| 657 | #endif | 711 | #endif |
| 658 | } | 712 | } |
| 659 | 713 | ||
| 714 | /** \brief Send System | ||
| 715 | * | ||
| 716 | * FIXME: Needs doc | ||
| 717 | */ | ||
| 660 | static void send_system(uint16_t data) | 718 | static void send_system(uint16_t data) |
| 661 | { | 719 | { |
| 662 | uint8_t timeout = 255; | 720 | uint8_t timeout = 255; |
| @@ -678,6 +736,10 @@ static void send_system(uint16_t data) | |||
| 678 | Endpoint_ClearIN(); | 736 | Endpoint_ClearIN(); |
| 679 | } | 737 | } |
| 680 | 738 | ||
| 739 | /** \brief Send Consumer | ||
| 740 | * | ||
| 741 | * FIXME: Needs doc | ||
| 742 | */ | ||
| 681 | static void send_consumer(uint16_t data) | 743 | static void send_consumer(uint16_t data) |
| 682 | { | 744 | { |
| 683 | uint8_t timeout = 255; | 745 | uint8_t timeout = 255; |
| @@ -739,6 +801,10 @@ static void send_consumer(uint16_t data) | |||
| 739 | ******************************************************************************/ | 801 | ******************************************************************************/ |
| 740 | #ifdef CONSOLE_ENABLE | 802 | #ifdef CONSOLE_ENABLE |
| 741 | #define SEND_TIMEOUT 5 | 803 | #define SEND_TIMEOUT 5 |
| 804 | /** \brief Send Char | ||
| 805 | * | ||
| 806 | * FIXME: Needs doc | ||
| 807 | */ | ||
| 742 | int8_t sendchar(uint8_t c) | 808 | int8_t sendchar(uint8_t c) |
| 743 | { | 809 | { |
| 744 | // Not wait once timeouted. | 810 | // Not wait once timeouted. |
| @@ -842,18 +908,30 @@ bool recv_midi_packet(MIDI_EventPacket_t* const event) { | |||
| 842 | ******************************************************************************/ | 908 | ******************************************************************************/ |
| 843 | 909 | ||
| 844 | #ifdef VIRTSER_ENABLE | 910 | #ifdef VIRTSER_ENABLE |
| 911 | /** \brief Virtual Serial Init | ||
| 912 | * | ||
| 913 | * FIXME: Needs doc | ||
| 914 | */ | ||
| 845 | void virtser_init(void) | 915 | void virtser_init(void) |
| 846 | { | 916 | { |
| 847 | cdc_device.State.ControlLineStates.DeviceToHost = CDC_CONTROL_LINE_IN_DSR ; | 917 | cdc_device.State.ControlLineStates.DeviceToHost = CDC_CONTROL_LINE_IN_DSR ; |
| 848 | CDC_Device_SendControlLineStateChange(&cdc_device); | 918 | CDC_Device_SendControlLineStateChange(&cdc_device); |
| 849 | } | 919 | } |
| 850 | 920 | ||
| 921 | /** \brief Virtual Serial Receive | ||
| 922 | * | ||
| 923 | * FIXME: Needs doc | ||
| 924 | */ | ||
| 851 | void virtser_recv(uint8_t c) __attribute__ ((weak)); | 925 | void virtser_recv(uint8_t c) __attribute__ ((weak)); |
| 852 | void virtser_recv(uint8_t c) | 926 | void virtser_recv(uint8_t c) |
| 853 | { | 927 | { |
| 854 | // Ignore by default | 928 | // Ignore by default |
| 855 | } | 929 | } |
| 856 | 930 | ||
| 931 | /** \brief Virtual Serial Task | ||
| 932 | * | ||
| 933 | * FIXME: Needs doc | ||
| 934 | */ | ||
| 857 | void virtser_task(void) | 935 | void virtser_task(void) |
| 858 | { | 936 | { |
| 859 | uint16_t count = CDC_Device_BytesReceived(&cdc_device); | 937 | uint16_t count = CDC_Device_BytesReceived(&cdc_device); |
| @@ -864,6 +942,10 @@ void virtser_task(void) | |||
| 864 | virtser_recv(ch); | 942 | virtser_recv(ch); |
| 865 | } | 943 | } |
| 866 | } | 944 | } |
| 945 | /** \brief Virtual Serial Send | ||
| 946 | * | ||
| 947 | * FIXME: Needs doc | ||
| 948 | */ | ||
| 867 | void virtser_send(const uint8_t byte) | 949 | void virtser_send(const uint8_t byte) |
| 868 | { | 950 | { |
| 869 | uint8_t timeout = 255; | 951 | uint8_t timeout = 255; |
| @@ -896,6 +978,10 @@ void virtser_send(const uint8_t byte) | |||
| 896 | /******************************************************************************* | 978 | /******************************************************************************* |
| 897 | * main | 979 | * main |
| 898 | ******************************************************************************/ | 980 | ******************************************************************************/ |
| 981 | /** \brief Setup MCU | ||
| 982 | * | ||
| 983 | * FIXME: Needs doc | ||
| 984 | */ | ||
| 899 | static void setup_mcu(void) | 985 | static void setup_mcu(void) |
| 900 | { | 986 | { |
| 901 | /* Disable watchdog if enabled by bootloader/fuses */ | 987 | /* Disable watchdog if enabled by bootloader/fuses */ |
| @@ -909,6 +995,10 @@ static void setup_mcu(void) | |||
| 909 | CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0); | 995 | CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0); |
| 910 | } | 996 | } |
| 911 | 997 | ||
| 998 | /** \brief Setup USB | ||
| 999 | * | ||
| 1000 | * FIXME: Needs doc | ||
| 1001 | */ | ||
| 912 | static void setup_usb(void) | 1002 | static void setup_usb(void) |
| 913 | { | 1003 | { |
| 914 | // Leonardo needs. Without this USB device is not recognized. | 1004 | // Leonardo needs. Without this USB device is not recognized. |
| @@ -921,6 +1011,10 @@ static void setup_usb(void) | |||
| 921 | print_set_sendchar(sendchar); | 1011 | print_set_sendchar(sendchar); |
| 922 | } | 1012 | } |
| 923 | 1013 | ||
| 1014 | /** \brief Main | ||
| 1015 | * | ||
| 1016 | * FIXME: Needs doc | ||
| 1017 | */ | ||
| 924 | int main(void) __attribute__ ((weak)); | 1018 | int main(void) __attribute__ ((weak)); |
| 925 | int main(void) | 1019 | int main(void) |
| 926 | { | 1020 | { |
diff --git a/tmk_core/protocol/lufa/outputselect.c b/tmk_core/protocol/lufa/outputselect.c index 0df5d3b75..42de80612 100644 --- a/tmk_core/protocol/lufa/outputselect.c +++ b/tmk_core/protocol/lufa/outputselect.c | |||
| @@ -20,15 +20,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | 20 | ||
| 21 | uint8_t desired_output = OUTPUT_DEFAULT; | 21 | uint8_t desired_output = OUTPUT_DEFAULT; |
| 22 | 22 | ||
| 23 | /** \brief Set Output | ||
| 24 | * | ||
| 25 | * FIXME: Needs doc | ||
| 26 | */ | ||
| 23 | void set_output(uint8_t output) { | 27 | void set_output(uint8_t output) { |
| 24 | set_output_user(output); | 28 | set_output_user(output); |
| 25 | desired_output = output; | 29 | desired_output = output; |
| 26 | } | 30 | } |
| 27 | 31 | ||
| 32 | /** \brief Set Output User | ||
| 33 | * | ||
| 34 | * FIXME: Needs doc | ||
| 35 | */ | ||
| 28 | __attribute__((weak)) | 36 | __attribute__((weak)) |
| 29 | void set_output_user(uint8_t output) { | 37 | void set_output_user(uint8_t output) { |
| 30 | } | 38 | } |
| 31 | 39 | ||
| 40 | /** \brief Auto Detect Output | ||
| 41 | * | ||
| 42 | * FIXME: Needs doc | ||
| 43 | */ | ||
| 32 | uint8_t auto_detect_output(void) { | 44 | uint8_t auto_detect_output(void) { |
| 33 | if (USB_DeviceState == DEVICE_STATE_Configured) { | 45 | if (USB_DeviceState == DEVICE_STATE_Configured) { |
| 34 | return OUTPUT_USB; | 46 | return OUTPUT_USB; |
| @@ -47,6 +59,10 @@ uint8_t auto_detect_output(void) { | |||
| 47 | return OUTPUT_NONE; | 59 | return OUTPUT_NONE; |
| 48 | } | 60 | } |
| 49 | 61 | ||
| 62 | /** \brief Where To Send | ||
| 63 | * | ||
| 64 | * FIXME: Needs doc | ||
| 65 | */ | ||
| 50 | uint8_t where_to_send(void) { | 66 | uint8_t where_to_send(void) { |
| 51 | if (desired_output == OUTPUT_AUTO) { | 67 | if (desired_output == OUTPUT_AUTO) { |
| 52 | return auto_detect_output(); | 68 | return auto_detect_output(); |
