mirror of
https://github.com/osiweb/unified_retro_keyboard.git
synced 2024-11-25 09:31:11 +00:00
Apply clang-format to files
This commit is contained in:
parent
c9cc1a76fe
commit
97890eaf63
@ -92,14 +92,14 @@ typedef enum {
|
||||
#define ASCII_ENQ ASCII_CTRL_E // Enquiry
|
||||
#define ASCII_ACK ASCII_CTRL_F // Acknlowledge
|
||||
#define ASCII_BEL ASCII_CTRL_G // Bell
|
||||
#define ASCII_BS ASCII_CTRL_H // Backspace
|
||||
#define ASCII_BS ASCII_CTRL_H // Backspace
|
||||
#define ASCII_TAB ASCII_CTRL_I // Horizontal Tab
|
||||
#define ASCII_LF ASCII_CTRL_J // Line Feed
|
||||
#define ASCII_VT ASCII_CTRL_K // Vertical Tab
|
||||
#define ASCII_FF ASCII_CTRL_L // Form Feed
|
||||
#define ASCII_CR ASCII_CTRL_M // Carriage Return
|
||||
#define ASCII_SO ASCII_CTRL_N // Shift Out
|
||||
#define ASCII_SI ASCII_CTRL_O // Shift In
|
||||
#define ASCII_LF ASCII_CTRL_J // Line Feed
|
||||
#define ASCII_VT ASCII_CTRL_K // Vertical Tab
|
||||
#define ASCII_FF ASCII_CTRL_L // Form Feed
|
||||
#define ASCII_CR ASCII_CTRL_M // Carriage Return
|
||||
#define ASCII_SO ASCII_CTRL_N // Shift Out
|
||||
#define ASCII_SI ASCII_CTRL_O // Shift In
|
||||
#define ASCII_DLE ASCII_CTRL_P // Data Link Escape
|
||||
#define ASCII_DC1 ASCII_CTRL_Q // Device Control 1
|
||||
#define ASCII_DC2 ASCII_CTRL_R // Device Control 2
|
||||
@ -109,7 +109,7 @@ typedef enum {
|
||||
#define ASCII_SYN ASCII_CTRL_V // Synchronous Idle
|
||||
#define ASCII_ETB ASCII_CTRL_W // End of Transmission Block
|
||||
#define ASCII_CAN ASCII_CTRL_X // Cancel
|
||||
#define ASCII_EM ASCII_CTRL_Y // End of Medium
|
||||
#define ASCII_EM ASCII_CTRL_Y // End of Medium
|
||||
#define ASCII_SUB ASCII_CTRL_Z // Substitute
|
||||
#define ASCII_ESC 0x1b
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
|
||||
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Universal Keyboard Project
|
||||
// ASDF keyboard firmware
|
||||
@ -28,7 +28,7 @@
|
||||
// this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#if !defined (CONFIG_H)
|
||||
#if !defined(CONFIG_H)
|
||||
#define CONFIG_H
|
||||
|
||||
#define ASDF_POSITIVE_POLARITY 0
|
||||
@ -58,7 +58,7 @@
|
||||
#define ASDF_DEFAULT_REPEAT_STATE REPEAT_AUTO
|
||||
|
||||
// time to hold down a key in milliseconds before autorepeat starts
|
||||
#define ASDF_AUTOREPEAT_TIME_MS 525 // 525 msec.
|
||||
#define ASDF_AUTOREPEAT_TIME_MS 525 // 525 msec.
|
||||
|
||||
// time between repeats of a character with repeat key held, or in autorepeat (milliseconds)
|
||||
#define ASDF_REPEAT_TIME_MS (1000 / 15) // l5 characters per sec.
|
||||
@ -76,4 +76,3 @@
|
||||
|
||||
//-------|---------|---------+---------+---------+---------+---------+---------+
|
||||
// Above line is 80 columns, and should display completely in the editor.
|
||||
|
||||
|
@ -36,8 +36,6 @@
|
||||
#include "asdf_keymap_defs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
// ID.
|
||||
|
@ -62,8 +62,9 @@ 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 hook initializer array from the definitions in the keymap definition
|
||||
// files.
|
||||
static const asdf_hook_initializer_t keymap_hook_initializer_list[ASDF_NUM_KEYMAPS] [ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH] =
|
||||
ASDF_KEYMAP_HOOK_INITIALIZERS;
|
||||
static const asdf_hook_initializer_t
|
||||
keymap_hook_initializer_list[ASDF_NUM_KEYMAPS][ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH] =
|
||||
ASDF_KEYMAP_HOOK_INITIALIZERS;
|
||||
|
||||
// Index of the currently active keymap, initialized to zero in the init
|
||||
// routine.
|
||||
@ -77,10 +78,14 @@ static uint8_t keymap_index;
|
||||
// DESCRIPTION: accepts a index value. If the requested keymap index is valid,
|
||||
// then:
|
||||
// 1) assign the value to the global (to the module) keymap_index variable
|
||||
// 2) initialize the virtual outputs for the selected keymap.
|
||||
// 3) initialize the modifier key states.
|
||||
// 2) execute the architecture-dependent init routine, to undo any settings
|
||||
// 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.
|
||||
//
|
||||
@ -92,6 +97,7 @@ void asdf_keymaps_select_keymap(uint8_t index)
|
||||
{
|
||||
if (index < ASDF_NUM_KEYMAPS) {
|
||||
keymap_index = index;
|
||||
asdf_arch_init();
|
||||
asdf_virtual_init((asdf_virtual_initializer_t *const) keymap_initializer_list[keymap_index]);
|
||||
asdf_modifiers_init();
|
||||
asdf_hook_init((asdf_hook_initializer_t *const) keymap_hook_initializer_list[keymap_index]);
|
||||
|
@ -41,14 +41,12 @@ static ctrl_state_t ctrl_state;
|
||||
|
||||
// The active modifier map depends on the current state of the modifier
|
||||
// variables. The map encodes the order or precedence of the various modifiers.
|
||||
static const modifier_index_t modifier_mapping[] = {
|
||||
MOD_PLAIN_MAP, // 0x00: no modifiers
|
||||
MOD_SHIFT_MAP, // 0x01: only SHIFT active
|
||||
MOD_CAPS_MAP, // 0x02: only CAPS active
|
||||
MOD_SHIFT_MAP, // 0x03: CAPS and SHIFT active
|
||||
MOD_CTRL_MAP, // CTRL overrides SHIFT and CAPS
|
||||
MOD_CTRL_MAP, MOD_CTRL_MAP, MOD_CTRL_MAP
|
||||
};
|
||||
static const modifier_index_t modifier_mapping[] = { MOD_PLAIN_MAP, // 0x00: no modifiers
|
||||
MOD_SHIFT_MAP, // 0x01: only SHIFT active
|
||||
MOD_CAPS_MAP, // 0x02: only CAPS active
|
||||
MOD_SHIFT_MAP, // 0x03: CAPS and SHIFT active
|
||||
MOD_CTRL_MAP, // CTRL overrides SHIFT and CAPS
|
||||
MOD_CTRL_MAP, MOD_CTRL_MAP, MOD_CTRL_MAP };
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
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
|
||||
|
@ -65,7 +65,6 @@ static physical_device_table_entry_t physical_device_table[ASDF_PHYSICAL_NUM_RES
|
||||
};
|
||||
|
||||
|
||||
|
||||
// PROCEDURE: asdf_physical_set
|
||||
// INPUTS: (asdf_physical_dev_t) physical_out: which real output to set or clear
|
||||
// INPUTS: (uint8_t) value
|
||||
@ -223,13 +222,13 @@ asdf_physical_dev_t asdf_physical_next_device(asdf_physical_dev_t device)
|
||||
//
|
||||
// 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;
|
||||
asdf_physical_dev_t predecessor = physical_device_is_available(physical_out);
|
||||
|
||||
if (valid_physical_device(physical_out)
|
||||
&& (ASDF_PHYSICAL_NUM_RESOURCES != predecessor)) {
|
||||
if (valid_physical_device(physical_out) && (ASDF_PHYSICAL_NUM_RESOURCES != predecessor)) {
|
||||
|
||||
// remove from available list:
|
||||
physical_device_table[predecessor].next = physical_device_table[physical_out].next;
|
||||
|
@ -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
|
||||
// and assign an initial value, then return a TRUE (1). Return FALSE (0) if
|
||||
// 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
|
||||
// INPUTS: none
|
||||
|
@ -73,8 +73,8 @@ int main(void)
|
||||
|
||||
if (code != ASDF_INVALID_CODE) {
|
||||
void (*output_function)(asdf_keycode_t) =
|
||||
(void (*)(asdf_keycode_t)) asdf_hook_get(ASDF_HOOK_OUTPUT);
|
||||
(*output_function)(code);
|
||||
(void (*)(asdf_keycode_t)) asdf_hook_get(ASDF_HOOK_OUTPUT);
|
||||
(*output_function)(code);
|
||||
}
|
||||
asdf_keyscan();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user