Apply clang-format to files

This commit is contained in:
Dave 2020-05-15 14:48:40 -05:00
parent c9cc1a76fe
commit 97890eaf63
8 changed files with 36 additions and 35 deletions

View File

@ -28,7 +28,7 @@
// this program. If not, see <https://www.gnu.org/licenses/>. // this program. If not, see <https://www.gnu.org/licenses/>.
// //
#if !defined (CONFIG_H) #if !defined(CONFIG_H)
#define CONFIG_H #define CONFIG_H
#define ASDF_POSITIVE_POLARITY 0 #define ASDF_POSITIVE_POLARITY 0
@ -76,4 +76,3 @@
//-------|---------|---------+---------+---------+---------+---------+---------+ //-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor. // Above line is 80 columns, and should display completely in the editor.

View File

@ -36,8 +36,6 @@
#include "asdf_keymap_defs.h" #include "asdf_keymap_defs.h"
// hooks_table[] contains all the function hooks. The entry for each ID contains // hooks_table[] contains all the function hooks. The entry for each ID contains
// a pointer to the first in the list of functions (if any) assigned to the hook // a pointer to the first in the list of functions (if any) assigned to the hook
// ID. // ID.

View File

@ -62,7 +62,8 @@ static const asdf_virtual_initializer_t keymap_initializer_list[ASDF_NUM_KEYMAPS
// function hooks unique to the keyboard defined by the map. This builds the // function hooks unique to the keyboard defined by the map. This builds the
// function hook initializer array from the definitions in the keymap definition // function hook initializer array from the definitions in the keymap definition
// files. // files.
static const asdf_hook_initializer_t keymap_hook_initializer_list[ASDF_NUM_KEYMAPS] [ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH] = static const asdf_hook_initializer_t
keymap_hook_initializer_list[ASDF_NUM_KEYMAPS][ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH] =
ASDF_KEYMAP_HOOK_INITIALIZERS; ASDF_KEYMAP_HOOK_INITIALIZERS;
// Index of the currently active keymap, initialized to zero in the init // Index of the currently active keymap, initialized to zero in the init
@ -77,10 +78,14 @@ static uint8_t keymap_index;
// DESCRIPTION: accepts a index value. If the requested keymap index is valid, // DESCRIPTION: accepts a index value. If the requested keymap index is valid,
// then: // then:
// 1) assign the value to the global (to the module) keymap_index variable // 1) assign the value to the global (to the module) keymap_index variable
// 2) initialize the virtual outputs for the selected keymap. // 2) execute the architecture-dependent init routine, to undo any settings
// 3) initialize the modifier key states. // from the previous keymap
// 3) initialize the virtual outputs for the selected keymap.
// 4) initialize the modifier key states.
// //
// SIDE EFFECTS: May change the module-global keymap_index variable. // SIDE EFFECTS:
// - May change the module-global keymap_index variable.
// - Architecture is initialized to default configuration.
// //
// NOTES: If the requested index is not valid, then no action is performed. // NOTES: If the requested index is not valid, then no action is performed.
// //
@ -92,6 +97,7 @@ void asdf_keymaps_select_keymap(uint8_t index)
{ {
if (index < ASDF_NUM_KEYMAPS) { if (index < ASDF_NUM_KEYMAPS) {
keymap_index = index; keymap_index = index;
asdf_arch_init();
asdf_virtual_init((asdf_virtual_initializer_t *const) keymap_initializer_list[keymap_index]); asdf_virtual_init((asdf_virtual_initializer_t *const) keymap_initializer_list[keymap_index]);
asdf_modifiers_init(); asdf_modifiers_init();
asdf_hook_init((asdf_hook_initializer_t *const) keymap_hook_initializer_list[keymap_index]); asdf_hook_init((asdf_hook_initializer_t *const) keymap_hook_initializer_list[keymap_index]);

View File

@ -41,14 +41,12 @@ static ctrl_state_t ctrl_state;
// The active modifier map depends on the current state of the modifier // The active modifier map depends on the current state of the modifier
// variables. The map encodes the order or precedence of the various modifiers. // variables. The map encodes the order or precedence of the various modifiers.
static const modifier_index_t modifier_mapping[] = { static const modifier_index_t modifier_mapping[] = { MOD_PLAIN_MAP, // 0x00: no modifiers
MOD_PLAIN_MAP, // 0x00: no modifiers
MOD_SHIFT_MAP, // 0x01: only SHIFT active MOD_SHIFT_MAP, // 0x01: only SHIFT active
MOD_CAPS_MAP, // 0x02: only CAPS active MOD_CAPS_MAP, // 0x02: only CAPS active
MOD_SHIFT_MAP, // 0x03: CAPS and SHIFT active MOD_SHIFT_MAP, // 0x03: CAPS and SHIFT active
MOD_CTRL_MAP, // CTRL overrides SHIFT and CAPS MOD_CTRL_MAP, // CTRL overrides SHIFT and CAPS
MOD_CTRL_MAP, MOD_CTRL_MAP, MOD_CTRL_MAP MOD_CTRL_MAP, MOD_CTRL_MAP, MOD_CTRL_MAP };
};
// PROCEDURE: set_shift_state // PROCEDURE: set_shift_state
@ -130,7 +128,7 @@ void asdf_modifier_shiftlock_toggle_activate(void)
static void asdf_modifier_set_caps_state(uint8_t new_state) static void asdf_modifier_set_caps_state(uint8_t new_state)
{ {
caps_state = new_state; caps_state = new_state;
asdf_virtual_action(VCAPS_LED, (caps_state ? V_SET_HI : V_SET_LO )); asdf_virtual_action(VCAPS_LED, (caps_state ? V_SET_HI : V_SET_LO));
} }
// PROCEDURE: asdf_modifier_capslock_activate // PROCEDURE: asdf_modifier_capslock_activate

View File

@ -65,7 +65,6 @@ static physical_device_table_entry_t physical_device_table[ASDF_PHYSICAL_NUM_RES
}; };
// PROCEDURE: asdf_physical_set // PROCEDURE: asdf_physical_set
// INPUTS: (asdf_physical_dev_t) physical_out: which real output to set or clear // INPUTS: (asdf_physical_dev_t) physical_out: which real output to set or clear
// INPUTS: (uint8_t) value // INPUTS: (uint8_t) value
@ -223,13 +222,13 @@ asdf_physical_dev_t asdf_physical_next_device(asdf_physical_dev_t device)
// //
// COMPLEXITY: 2 // COMPLEXITY: 2
// //
uint8_t asdf_physical_allocate(asdf_physical_dev_t physical_out, asdf_physical_dev_t tail, uint8_t initial_value) uint8_t asdf_physical_allocate(asdf_physical_dev_t physical_out, asdf_physical_dev_t tail,
uint8_t initial_value)
{ {
uint8_t success = 0; uint8_t success = 0;
asdf_physical_dev_t predecessor = physical_device_is_available(physical_out); asdf_physical_dev_t predecessor = physical_device_is_available(physical_out);
if (valid_physical_device(physical_out) if (valid_physical_device(physical_out) && (ASDF_PHYSICAL_NUM_RESOURCES != predecessor)) {
&& (ASDF_PHYSICAL_NUM_RESOURCES != predecessor)) {
// remove from available list: // remove from available list:
physical_device_table[predecessor].next = physical_device_table[physical_out].next; physical_device_table[predecessor].next = physical_device_table[physical_out].next;

View File

@ -97,7 +97,8 @@ asdf_physical_dev_t asdf_physical_next_device(asdf_physical_dev_t device);
// available. If so, then remove the resource from the physical resource table // available. If so, then remove the resource from the physical resource table
// and assign an initial value, then return a TRUE (1). Return FALSE (0) if // and assign an initial value, then return a TRUE (1). Return FALSE (0) if
// allocation was not successful. // allocation was not successful.
uint8_t asdf_physical_allocate(asdf_physical_dev_t physical_out, asdf_physical_dev_t tail, uint8_t initial_value); uint8_t asdf_physical_allocate(asdf_physical_dev_t physical_out, asdf_physical_dev_t tail,
uint8_t initial_value);
// PROCEDURE: asdf_physical_init // PROCEDURE: asdf_physical_init
// INPUTS: none // INPUTS: none