summaryrefslogtreecommitdiffstats
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common/action.c63
-rw-r--r--tmk_core/common/action_code.h34
-rw-r--r--tmk_core/common/action_layer.c101
-rw-r--r--tmk_core/common/action_macro.c4
-rw-r--r--tmk_core/common/action_tapping.c37
-rw-r--r--tmk_core/common/action_util.c113
-rw-r--r--tmk_core/common/avr/bootloader.c15
-rw-r--r--tmk_core/common/avr/sleep_led.c19
-rw-r--r--tmk_core/common/avr/suspend.c20
-rw-r--r--tmk_core/common/avr/timer.c24
-rw-r--r--tmk_core/common/backlight.c28
-rw-r--r--tmk_core/common/bootmagic.c14
-rw-r--r--tmk_core/common/bootmagic.h2
-rw-r--r--tmk_core/common/chibios/bootloader.c8
-rw-r--r--tmk_core/common/chibios/eeprom.c44
-rw-r--r--tmk_core/common/chibios/suspend.c18
-rw-r--r--tmk_core/common/command.h4
-rw-r--r--tmk_core/common/eeconfig.c56
-rw-r--r--tmk_core/common/keyboard.c32
-rw-r--r--tmk_core/common/keycode.h1
-rw-r--r--tmk_core/common/led.h3
-rw-r--r--tmk_core/common/magic.c4
-rw-r--r--tmk_core/common/report.c36
-rw-r--r--tmk_core/protocol/lufa/lufa.c106
-rw-r--r--tmk_core/protocol/lufa/outputselect.c16
25 files changed, 732 insertions, 70 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 33d920554f..fff8347915 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -44,6 +44,10 @@ int retro_tapping_counter = 0;
#include <fauxclicky.h>
#endif
+/** \brief Called to execute an action.
+ *
+ * FIXME: Needs documentation.
+ */
void action_exec(keyevent_t event)
{
if (!IS_NOEVENT(event)) {
@@ -95,6 +99,10 @@ void action_exec(keyevent_t event)
bool swap_hands = false;
bool swap_held = false;
+/** \brief Process Hand Swap
+ *
+ * FIXME: Needs documentation.
+ */
void process_hand_swap(keyevent_t *event) {
static swap_state_row_t swap_state[MATRIX_ROWS];
@@ -134,7 +142,10 @@ bool process_record_quantum(keyrecord_t *record) {
}
#ifndef NO_ACTION_TAPPING
-// Allows for handling tap-hold actions immediately instead of waiting for TAPPING_TERM or another keypress.
+/** \brief Allows for handling tap-hold actions immediately instead of waiting for TAPPING_TERM or another keypress.
+ *
+ * FIXME: Needs documentation.
+ */
void process_record_tap_hint(keyrecord_t *record)
{
action_t action = layer_switch_get_action(record->event.key);
@@ -154,6 +165,10 @@ void process_record_tap_hint(keyrecord_t *record)
}
#endif
+/** \brief Take a key event (key press or key release) and processes it.
+ *
+ * FIXME: Needs documentation.
+ */
void process_record(keyrecord_t *record)
{
if (IS_NOEVENT(record->event)) { return; }
@@ -172,6 +187,10 @@ void process_record(keyrecord_t *record)
process_action(record, action);
}
+/** \brief Take an action and processes it.
+ *
+ * FIXME: Needs documentation.
+ */
void process_action(keyrecord_t *record, action_t action)
{
keyevent_t event = record->event;
@@ -674,8 +693,9 @@ void process_action(keyrecord_t *record, action_t action)
-/*
- * Utilities for actions.
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
*/
void register_code(uint8_t code)
{
@@ -755,6 +775,10 @@ void register_code(uint8_t code)
}
}
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
void unregister_code(uint8_t code)
{
if (code == KC_NO) {
@@ -810,6 +834,10 @@ void unregister_code(uint8_t code)
}
}
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
void register_mods(uint8_t mods)
{
if (mods) {
@@ -818,6 +846,10 @@ void register_mods(uint8_t mods)
}
}
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
void unregister_mods(uint8_t mods)
{
if (mods) {
@@ -826,12 +858,20 @@ void unregister_mods(uint8_t mods)
}
}
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
void clear_keyboard(void)
{
clear_mods();
clear_keyboard_but_mods();
}
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
void clear_keyboard_but_mods(void)
{
clear_weak_mods();
@@ -848,6 +888,10 @@ void clear_keyboard_but_mods(void)
#endif
}
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
bool is_tap_key(keypos_t key)
{
action_t action = layer_switch_get_action(key);
@@ -880,14 +924,19 @@ bool is_tap_key(keypos_t key)
}
-/*
- * debug print
+/** \brief Debug print (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
*/
void debug_event(keyevent_t event)
{
dprintf("%04X%c(%u)", (event.key.row<<8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time);
}
+/** \brief Debug print (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
void debug_record(keyrecord_t record)
{
debug_event(record.event);
@@ -896,6 +945,10 @@ void debug_record(keyrecord_t record)
#endif
}
+/** \brief Debug print (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
void debug_action(action_t action)
{
switch (action.kind.id) {
diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h
index fe2735b973..d836b7a8a3 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/>.
#ifndef ACTION_CODE_H
#define ACTION_CODE_H
-/* Action codes
- * ============
- * 16bit code: action_kind(4bit) + action_parameter(12bit)
+/** \brief Action codes
*
+ * 16bit code: action_kind(4bit) + action_parameter(12bit)
*
* Key Actions(00xx)
* -----------------
@@ -38,7 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 001r|mods|0000 00xx (reserved)
* 001r|mods| keycode Modifiers with Tap Key(Dual role)
*
- *
* Other Keys(01xx)
* ----------------
* ACT_USAGE(0100): TODO: Not needed?
@@ -47,17 +45,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 0100|10| usage(10) (reserved)
* 0100|11| usage(10) (reserved)
*
- *
* ACT_MOUSEKEY(0101): TODO: Merge these two actions to conserve space?
* 0101|xxxx| keycode Mouse key
*
* ACT_SWAP_HANDS(0110):
* 0110|xxxx| keycode Swap hands (keycode on tap, or options)
*
- *
* 0111|xxxx xxxx xxxx (reserved)
*
- *
* Layer Actions(10xx)
* -------------------
* ACT_LAYER(1000):
@@ -84,7 +79,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 101E|LLLL|1111 xxxx Reserved (0xF5-FF)
* ELLLL: layer 0-31(E: extra bit for layer 16-31)
*
- *
* Extensions(11xx)
* ----------------
* ACT_MACRO(1100):
@@ -126,7 +120,7 @@ enum action_kind_id {
};
-/* Action Code Struct
+/** \brief Action Code Struct
*
* NOTE:
* In avr-gcc bit field seems to be assigned from LSB(bit0) to MSB(bit15).
@@ -198,10 +192,9 @@ typedef union {
#define ACTION(kind, param) ((kind)<<12 | (param))
-/*
- * Key Actions
- */
-/* Mod bits: 43210
+/** \brief Key Actions
+ *
+ * Mod bits: 43210
* bit 0 ||||+- Control
* bit 1 |||+-- Shift
* bit 2 ||+--- Alt
@@ -230,8 +223,7 @@ enum mods_codes {
#define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE)
-/*
- * Other Keys
+/** \brief Other Keys
*/
enum usage_pages {
PAGE_SYSTEM,
@@ -243,20 +235,25 @@ enum usage_pages {
-/*
- * Layer Actions
+/** \brief Layer Actions
*/
enum layer_param_on {
ON_PRESS = 1,
ON_RELEASE = 2,
ON_BOTH = 3,
};
+
+/** \brief Layer Actions
+ */
enum layer_param_bit_op {
OP_BIT_AND = 0,
OP_BIT_OR = 1,
OP_BIT_XOR = 2,
OP_BIT_SET = 3,
};
+
+/** \brief Layer Actions
+ */
enum layer_param_tap_op {
OP_TAP_TOGGLE = 0xF0,
OP_ON_OFF,
@@ -296,8 +293,7 @@ enum layer_param_tap_op {
#define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0)
-/*
- * Extensions
+/** \brief Extensions
*/
enum backlight_opt {
BACKLIGHT_INCREASE = 0,
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c
index 22331376aa..f3cd381ab0 100644
--- a/tmk_core/common/action_layer.c
+++ b/tmk_core/common/action_layer.c
@@ -11,16 +11,23 @@
#endif
-/*
- * Default Layer State
+/** \brief Default Layer State
*/
uint32_t default_layer_state = 0;
+/** \brief Default Layer State Set At Keyboard Level
+ *
+ * FIXME: Needs docs
+ */
__attribute__((weak))
uint32_t default_layer_state_set_kb(uint32_t state) {
return state;
}
+/** \brief Default Layer State Set
+ *
+ * FIXME: Needs docs
+ */
static void default_layer_state_set(uint32_t state)
{
state = default_layer_state_set_kb(state);
@@ -31,25 +38,45 @@ static void default_layer_state_set(uint32_t state)
clear_keyboard_but_mods(); // To avoid stuck keys
}
+/** \brief Default Layer Print
+ *
+ * FIXME: Needs docs
+ */
void default_layer_debug(void)
{
dprintf("%08lX(%u)", default_layer_state, biton32(default_layer_state));
}
+/** \brief Default Layer Set
+ *
+ * FIXME: Needs docs
+ */
void default_layer_set(uint32_t state)
{
default_layer_state_set(state);
}
#ifndef NO_ACTION_LAYER
+/** \brief Default Layer Or
+ *
+ * FIXME: Needs docs
+ */
void default_layer_or(uint32_t state)
{
default_layer_state_set(default_layer_state | state);
}
+/** \brief Default Layer And
+ *
+ * FIXME: Needs docs
+ */
void default_layer_and(uint32_t state)
{
default_layer_state_set(default_layer_state & state);
}
+/** \brief Default Layer Xor
+ *
+ * FIXME: Needs docs
+ */
void default_layer_xor(uint32_t state)
{
default_layer_state_set(default_layer_state ^ state);
@@ -58,21 +85,32 @@ void default_layer_xor(uint32_t state)
#ifndef NO_ACTION_LAYER
-/*
- * Keymap Layer State
+/** \brief Keymap Layer State
*/
uint32_t layer_state = 0;
+/** \brief Layer state set user
+ *
+ * FIXME: Needs docs
+ */
__attribute__((weak))
uint32_t layer_state_set_user(uint32_t state) {
return state;
}
+/** \brief Layer state set keyboard
+ *
+ * FIXME: Needs docs
+ */
__attribute__((weak))
uint32_t layer_state_set_kb(uint32_t state) {
return layer_state_set_user(state);
}
+/** \brief Layer state set
+ *
+ * FIXME: Needs docs
+ */
void layer_state_set(uint32_t state)
{
state = layer_state_set_kb(state);
@@ -83,54 +121,98 @@ void layer_state_set(uint32_t state)
clear_keyboard_but_mods(); // To avoid stuck keys
}
+/** \brief Layer clear
+ *
+ * FIXME: Needs docs
+ */
void layer_clear(void)
{
layer_state_set(0);
}
+/** \brief Layer state is
+ *
+ * FIXME: Needs docs
+ */
bool layer_state_is(uint8_t layer)
{
return layer_state_cmp(layer_state, layer);
}
+/** \brief Layer state compare
+ *
+ * FIXME: Needs docs
+ */
bool layer_state_cmp(uint32_t cmp_layer_state, uint8_t layer) {
if (!cmp_layer_state) { return layer == 0; }
return (cmp_layer_state & (1UL<<layer)) != 0;
}
+/** \brief Layer move
+ *
+ * FIXME: Needs docs
+ */
void layer_move(uint8_t layer)
{
layer_state_set(1UL<<layer);
}
+/** \brief Layer on
+ *
+ * FIXME: Needs docs
+ */
void layer_on(uint8_t layer)
{
layer_state_set(layer_state | (1UL<<layer));
}
+/** \brief Layer off
+ *
+ * FIXME: Needs docs
+ */
void layer_off(uint8_t layer)
{
layer_state_set(layer_state & ~(1UL<<layer));
}
+/** \brief Layer invert
+ *
+ * FIXME: Needs docs
+ */
void layer_invert(uint8_t layer)
{
layer_state_set(layer_state ^ (1UL<<layer));
}
+/** \brief Layer or
+ *
+ * FIXME: Needs docs
+ */
void layer_or(uint32_t state)
{
layer_state_set(layer_state | state);
}
+/** \brief Layer and
+ *
+ * FIXME: Needs docs
+ */
void layer_and(uint32_t state)
{
layer_state_set(layer_state & state);
}
+/** \brief Layer xor
+ *
+ * FIXME: Needs docs
+ */
void layer_xor(uint32_t state)
{
layer_state_set(layer_state ^ state);
}
+/** \brief Layer debug printing
+ *
+ * FIXME: Needs docs
+ */
void layer_debug(void)
{
dprintf("%08lX(%u)", layer_state, biton32(layer_state));
@@ -172,7 +254,8 @@ uint8_t read_source_layers_cache(keypos_t key)
}
#endif
-/*
+/** \brief Store or get action (FIXME: Needs better summary)
+ *
* Make sure the action triggered when the key is released is the same
* one as the one triggered on press. It's important for the mod keys
* when the layer is switched after the down event but before the up
@@ -201,6 +284,10 @@ action_t store_or_get_action(bool pressed, keypos_t key)
}
+/** \brief Layer switch get layer
+ *
+ * FIXME: Needs docs
+ */
int8_t layer_switch_get_layer(keypos_t key)
{
#ifndef NO_ACTION_LAYER
@@ -224,6 +311,10 @@ int8_t layer_switch_get_layer(keypos_t key)
#endif
}
+/** \brief Layer switch get layer
+ *
+ * FIXME: Needs docs
+ */
action_t layer_switch_get_action(keypos_t key)
{
return action_for_key(layer_switch_get_layer(key), key);
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c
index 7726b11907..12bef29586 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/>.
#ifndef NO_ACTION_MACRO
#define MACRO_READ() (macro = MACRO_GET(macro_p++))
+/** \brief Action Macro Play
+ *
+ * FIXME: Needs doc
+ */
void action_macro_play(const macro_t *macro_p)
{
macro_t macro = END;
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c
index 6280c6c36f..8adf013e16 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);
static void debug_waiting_buffer(void);
+/** \brief Action Tapping Process
+ *
+ * FIXME: Needs doc
+ */
void action_tapping_process(keyrecord_t record)
{
if (process_tapping(&record)) {
@@ -70,7 +74,7 @@ void action_tapping_process(keyrecord_t record)
}
-/* Tapping
+/** \brief Tapping
*
* Rule: Tap key is typed(pressed and released) within TAPPING_TERM.
* (without interfering by typing other key)
@@ -289,8 +293,9 @@ bool process_tapping(keyrecord_t *keyp)
}
-/*
- * Waiting buffer
+/** \brief Waiting buffer enq
+ *
+ * FIXME: Needs docs
*/
bool waiting_buffer_enq(keyrecord_t record)
{
@@ -310,12 +315,20 @@ bool waiting_buffer_enq(keyrecord_t record)
return true;
}
+/** \brief Waiting buffer clear
+ *
+ * FIXME: Needs docs
+ */
void waiting_buffer_clear(void)
{
waiting_buffer_head = 0;
waiting_buffer_tail = 0;
}
+/** \brief Waiting buffer typed
+ *
+ * FIXME: Needs docs
+ */
bool waiting_buffer_typed(keyevent_t event)
{
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)
return false;
}
+/** \brief Waiting buffer has anykey pressed
+ *
+ * FIXME: Needs docs
+ */
__attribute__((unused))
bool waiting_buffer_has_anykey_pressed(void)
{
@@ -335,7 +352,10 @@ bool waiting_buffer_has_anykey_pressed(void)
return false;
}
-/* scan buffer for tapping */
+/** \brief Scan buffer for tapping
+ *
+ * FIXME: Needs docs
+ */
void waiting_buffer_scan_tap(void)
{
// tapping already is settled
@@ -359,14 +379,19 @@ void waiting_buffer_scan_tap(void)
}
-/*
- * debug print
+/** \brief Tapping key debug print
+ *
+ * FIXME: Needs docs
*/
static void debug_tapping_key(void)
{
debug("TAPPING_KEY="); debug_record(tapping_key); debug("\n");
}
+/** \brief Waiting buffer debug print
+ *
+ * FIXME: Needs docs
+ */
static void debug_waiting_buffer(void)
{
debug("{ ");
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c
index 148162a510..afd4ae8b25 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) {
/* oneshot layer */
#ifndef NO_ACTION_ONESHOT
-/* oneshot_layer_data bits
-* LLLL LSSS
-* where:
-* L => are layer bits
-* S => oneshot state bits
-*/
+/** \brief oneshot_layer_data bits
+ * LLLL LSSS
+ * where:
+ * L => are layer bits
+ * S => oneshot state bits
+ */
static int8_t oneshot_layer_data = 0;
inline uint8_t get_oneshot_layer(void) { return oneshot_layer_data >> 3; }
@@ -86,7 +86,10 @@ inline bool has_oneshot_layer_timed_out() {
}
#endif
-/* Oneshot layer */
+/** \brief Set oneshot layer
+ *
+ * FIXME: needs doc
+ */
void set_oneshot_layer(uint8_t layer, uint8_t state)
{
oneshot_layer_data = layer << 3 | state;
@@ -95,12 +98,20 @@ void set_oneshot_layer(uint8_t layer, uint8_t state)
oneshot_layer_time = timer_read();
#endif
}
+/** \brief Reset oneshot layer
+ *
+ * FIXME: needs doc
+ */
void reset_oneshot_layer(void) {
oneshot_layer_data = 0;
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
oneshot_layer_time = 0;
#endif
}
+/** \brief Clear oneshot layer
+ *
+ * FIXME: needs doc
+ */
void clear_oneshot_layer_state(oneshot_fullfillment_t state)
{
uint8_t start_state = oneshot_layer_data;
@@ -112,12 +123,20 @@ void clear_oneshot_layer_state(oneshot_fullfillment_t state)
#endif
}
}
+/** \brief Is oneshot layer active
+ *
+ * FIXME: needs doc
+ */
bool is_oneshot_layer_active(void)
{
return get_oneshot_layer_state();
}
#endif
+/** \brief Send keyboard report
+ *
+ * FIXME: needs doc
+ */
void send_keyboard_report(void) {
keyboard_report->mods = real_mods;
keyboard_report->mods |= weak_mods;
@@ -140,29 +159,90 @@ void send_keyboard_report(void) {
host_keyboard_send(keyboard_report);
}
-/* modifier */
+/** \brief Get mods
+ *
+ * FIXME: needs doc
+ */
uint8_t get_mods(void) { return real_mods; }
+/** \brief add mods
+ *
+ * FIXME: needs doc
+ */
void add_mods(uint8_t mods) { real_mods |= mods; }
+/** \brief del mods
+ *
+ * FIXME: needs doc
+ */
void del_mods(uint8_t mods) { real_mods &= ~mods; }
+/** \brief set mods
+ *
+ * FIXME: needs doc
+ */
void set_mods(uint8_t mods) { real_mods = mods; }
+/** \brief clear mods
+ *
+ * FIXME: needs doc
+ */
void clear_mods(void) { real_mods = 0; }
-/* weak modifier */
+/** \brief get weak mods
+ *
+ * FIXME: needs doc
+ */
uint8_t get_weak_mods(void) { return weak_mods; }
+/** \brief add weak mods
+ *
+ * FIXME: needs doc
+ */
void add_weak_mods(uint8_t mods) { weak_mods |= mods; }
+/** \brief del weak mods
+ *
+ * FIXME: needs doc
+ */
void del_weak_mods(uint8_t mods) { weak_mods &= ~mods; }
+/** \brief set weak mods
+ *
+ * FIXME: needs doc
+ */
void set_weak_mods(uint8_t mods) { weak_mods = mods; }
+/** \brief clear weak mods
+ *
+ * FIXME: needs doc
+ */
void clear_weak_mods(void) { weak_mods = 0; }
/* macro modifier */
+/** \brief get macro mods
+ *
+ * FIXME: needs doc
+ */
uint8_t get_macro_mods(void) { return macro_mods; }
+/** \brief add macro mods
+ *
+ * FIXME: needs doc
+ */
void add_macro_mods(uint8_t mods) { macro_mods |= mods; }
+/** \brief del macro mods
+ *
+ * FIXME: needs doc
+ */
void del_macro_mods(uint8_t mods) { macro_mods &= ~mods; }
+/** \brief set macro mods
+ *
+ * FIXME: needs doc
+ */
void set_macro_mods(uint8_t mods) { macro_mods = mods; }
+/** \brief clear macro mods
+ *
+ * FIXME: needs doc
+ */
void clear_macro_mods(void) { macro_mods = 0; }
-/* Oneshot modifier */
#ifndef NO_ACTION_ONESHOT
+/** \brief set oneshot mods
+ *
+ * FIXME: needs doc
+ */
void set_oneshot_mods(uint8_t mods)
{
oneshot_mods = mods;
@@ -170,6 +250,10 @@ void set_oneshot_mods(uint8_t mods)
oneshot_time = timer_read();
#endif
}
+/** \brief clear oneshot mods
+ *
+ * FIXME: needs doc
+ */
void clear_oneshot_mods(void)
{
oneshot_mods = 0;
@@ -177,14 +261,19 @@ void clear_oneshot_mods(void)
oneshot_time = 0;
#endif
}
+/** \brief get oneshot mods
+ *
+ * FIXME: needs doc
+ */
uint8_t get_oneshot_mods(void)
{
return oneshot_mods;
}
#endif
-/*
- * inspect keyboard state
+/** \brief inspect keyboard state
+ *
+ * FIXME: needs doc
*/
uint8_t has_anymod(void)
{
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index ee150817c3..d89c8d768d 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -13,12 +13,11 @@
#endif
-/* Bootloader Size in *bytes*
+/** \brief Bootloader Size in *bytes*
*
* AVR Boot section size are defined by setting BOOTSZ fuse in fact. Consult with your MCU datasheet.
* Note that 'Word'(2 bytes) size and address are used in datasheet while TMK uses 'Byte'.
*
- *
* Size of Bootloaders in bytes:
* Atmel DFU loader(ATmega32U4) 4096
* Atmel DFU loader(AT90USB128) 8192
@@ -28,10 +27,8 @@
* Teensy halfKay(ATmega32U4) 512
* Teensy++ halfKay(AT90USB128) 1024
*
- *
* AVR Boot section is located at the end of Flash memory like the followings.
*
- *
* byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB128)
* 0x0000 +---------------+ 0x00000 +---------------+
* | | | |
@@ -57,7 +54,6 @@
* | Bootloader | 512B | Bootloader | 1KB
* 0x7FFF +---------------+ 0x1FFFF +---------------+
*/
-
#define FLASH_SIZE (FLASHEND + 1L)
#if !defined(BOOTLOADER_SIZE)
@@ -69,14 +65,17 @@
#define BOOT_SIZE_1024 0b010
#define BOOT_SIZE_2048 0b000
-/*
- * Entering the Bootloader via Software
+/** \brief Entering the Bootloader via Software
+ *
* http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__software_bootloader_start.html
*/
#define BOOTLOADER_RESET_KEY 0xB007B007
uint32_t reset_key __attribute__ ((section (".noinit")));
-/* initialize MCU status by watchdog reset */
+/** \brief initialize MCU status by watchdog reset
+ *
+ * FIXME: needs doc
+ */
void bootloader_jump(void) {
#if !defined(BOOTLOADER_SIZE)
diff --git a/tmk_core/common/avr/sleep_led.c b/tmk_core/common/avr/sleep_led.c
index dab3eb0f3c..0cb774c81f 100644
--- a/tmk_core/common/avr/sleep_led.c
+++ b/tmk_core/common/avr/sleep_led.c
@@ -18,6 +18,10 @@
*/
#define SLEEP_LED_TIMER_TOP F_CPU/(256*64)
+/** \brief Sleep LED initialization
+ *
+ * FIXME: needs doc
+ */
void sleep_led_init(void)
{
/* Timer1 setup */
@@ -33,18 +37,30 @@ void sleep_led_init(void)
SREG = sreg;
}
+/** \brief Sleep LED enable
+ *
+ * FIXME: needs doc
+ */
void sleep_led_enable(void)
{
/* Enable Compare Match Interrupt */
TIMSK1 |= _BV(OCIE1A);
}
+/** \brief Sleep LED disable
+ *
+ * FIXME: needs doc
+ */
void sleep_led_disable(void)
{
/* Disable Compare Match Interrupt */
TIMSK1 &= ~_BV(OCIE1A);
}
+/** \brief Sleep LED toggle
+ *
+ * FIXME: needs doc
+ */
void sleep_led_toggle(void)
{
/* Disable Compare Match Interrupt */
@@ -52,7 +68,8 @@ void sleep_led_toggle(void)
}
-/* Breathing Sleep LED brighness(PWM On period) table
+/** \brief Breathing Sleep LED brighness(PWM On period) table
+ *
* (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle
*
* 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 213f03f6fa..4cdd6a420e 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -41,6 +41,10 @@ __asm__ __volatile__ ( \
)
+/** \brief Suspend idle
+ *
+ * FIXME: needs doc
+ */
void suspend_idle(uint8_t time)
{
cli();
@@ -52,7 +56,8 @@ void suspend_idle(uint8_t time)
}
#ifndef NO_SUSPEND_POWER_DOWN
-/* Power down MCU with watchdog timer
+/** \brief Power down MCU with watchdog timer
+ *
* wdto: watchdog timer timeout defined in <avr/wdt.h>
* WDTO_15MS
* WDTO_30MS
@@ -67,6 +72,10 @@ void suspend_idle(uint8_t time)
*/
static uint8_t wdt_timeout = 0;
+/** \brief Power down
+ *
+ * FIXME: needs doc
+ */
static void power_down(uint8_t wdto)
{
#ifdef PROTOCOL_LUFA
@@ -111,6 +120,10 @@ static void power_down(uint8_t wdto)
}
#endif
+/** \brief Suspend power down
+ *
+ * FIXME: needs doc
+ */
void suspend_power_down(void)
{
#ifndef NO_SUSPEND_POWER_DOWN
@@ -131,7 +144,10 @@ bool suspend_wakeup_condition(void)
return false;
}
-// run immediately after wakeup
+/** \brief run immediately after wakeup
+ *
+ * FIXME: needs doc
+ */
void suspend_wakeup_init(void)
{
// clear keyboard state
diff --git a/tmk_core/common/avr/timer.c b/tmk_core/common/avr/timer.c
index 369015200d..b7d4f060ef 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/>.
// NOTE: union { uint32_t timer32; struct { uint16_t dummy; uint16_t timer16; }}
volatile uint32_t timer_count;
+/** \brief timer initialization
+ *
+ * FIXME: needs doc
+ */
void timer_init(void)
{
#if TIMER_PRESCALER == 1
@@ -60,6 +64,10 @@ void timer_init(void)
#endif
}
+/** \brief timer clear
+ *
+ * FIXME: needs doc
+ */
inline
void timer_clear(void)
{
@@ -68,6 +76,10 @@ void timer_clear(void)
}
}
+/** \brief timer read
+ *
+ * FIXME: needs doc
+ */
inline
uint16_t timer_read(void)
{
@@ -80,6 +92,10 @@ uint16_t timer_read(void)
return (t & 0xFFFF);
}
+/** \brief timer read32
+ *
+ * FIXME: needs doc
+ */
inline
uint32_t timer_read32(void)
{
@@ -92,6 +108,10 @@ uint32_t timer_read32(void)
return t;
}
+/** \brief timer elapsed
+ *
+ * FIXME: needs doc
+ */
inline
uint16_t timer_elapsed(uint16_t last)
{
@@ -104,6 +124,10 @@ uint16_t timer_elapsed(uint16_t last)
return TIMER_DIFF_16((t & 0xFFFF), last);
}
+/** \brief timer elaps