mirror of
https://github.com/osiweb/unified_retro_keyboard.git
synced 2024-12-21 15:29:21 +00:00
Convert more keymaps to new scheme (untested)
- Replace asdf_keymap_defs_xxx.h files with asdf_keymap_xxx.[c,h] modules - add _clang_format in keymaps directory
This commit is contained in:
parent
952e425986
commit
8088c0e157
46
firmware/asdf/src/Keymaps/_clang-format
Normal file
46
firmware/asdf/src/Keymaps/_clang-format
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
BasedOnStyle: Mozilla
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||
AllowShortBlocksOnASingleLine: 'false'
|
||||
AllowShortCaseLabelsOnASingleLine: 'true'
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: 'false'
|
||||
AllowShortLoopsOnASingleLine: 'true'
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: 'true'
|
||||
BinPackArguments: 'true'
|
||||
BinPackParameters: 'true'
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Stroustrup
|
||||
ColumnLimit: '100'
|
||||
ConstructorInitializerIndentWidth: '2'
|
||||
ContinuationIndentWidth: '2'
|
||||
DerivePointerAlignment: 'false'
|
||||
DisableFormat: 'false'
|
||||
IncludeBlocks: Preserve
|
||||
IndentCaseLabels: 'true'
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: '2'
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'true'
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: '2'
|
||||
PointerAlignment: Right
|
||||
ReflowComments: 'true'
|
||||
SortIncludes: 'false'
|
||||
SpaceAfterCStyleCast: 'true'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '1'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
TabWidth: '8'
|
||||
UseTab: Never
|
||||
|
||||
...
|
106
firmware/asdf/src/Keymaps/asdf_keymap_apple2.c
Normal file
106
firmware/asdf/src/Keymaps/asdf_keymap_apple2.c
Normal file
@ -0,0 +1,106 @@
|
||||
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Unified Keyboard Project
|
||||
// ASDF keyboard firmware
|
||||
//
|
||||
// asdf_keymap_apple2.c
|
||||
//
|
||||
// set up keymaps for Apple II keyboards
|
||||
//
|
||||
// Copyright 2019 David Fenyes
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation, either version 3 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
#include "asdf_keymap_apple2.h"
|
||||
#include "asdf_keymap_defs_dipswitch.h"
|
||||
|
||||
// PROCEDURE:
|
||||
// INPUTS:
|
||||
// OUTPUTS:
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// SIDE EFFECTS:
|
||||
//
|
||||
// NOTES:
|
||||
//
|
||||
// SCOPE:
|
||||
//
|
||||
// COMPLEXITY:
|
||||
//
|
||||
|
||||
|
||||
|
||||
// PROCEDURE: apple_add_map
|
||||
|
||||
// INPUTS: asdf_keycode_t (*matrix) - a SOL_NUM_ROWS x SOL_NUM_COLS matrix of
|
||||
// keycodes for each physical row/column pair
|
||||
// modifier_index_t modifier index - the modifier state corresponding to
|
||||
// the keycode matrix
|
||||
//
|
||||
// OUTPUTS: none
|
||||
// DESCRIPTION: Passes the keycode matrix and modifier state through to
|
||||
// asdf_keymaps_add_map(), along with the row/column dimensions.
|
||||
//
|
||||
// SIDE EFFECTS: the matrix is added to the keymap
|
||||
//
|
||||
// SCOPE: private
|
||||
//
|
||||
// COMPLEXITY: 1
|
||||
//
|
||||
static void apple_add_map(const asdf_keycode_t (*matrix)[APPLE_NUM_COLS],
|
||||
modifier_index_t modifier_index)
|
||||
{
|
||||
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) APPLE_NUM_ROWS,
|
||||
(uint8_t) APPLE_NUM_COLS);
|
||||
}
|
||||
|
||||
void setup_classic_keymap(void)
|
||||
{
|
||||
apple_add_map(apple_plain_map, MOD_PLAIN_MAP);
|
||||
apple_add_map(apple_caps_map, MOD_CAPS_MAP);
|
||||
apple_add_map(apple_shift_map, MOD_SHIFT_MAP);
|
||||
apple_add_map(apple_ctrl_map, MOD_CTRL_MAP);
|
||||
|
||||
asdf_virtual_init();
|
||||
|
||||
|
||||
// Attach the physical POWER LED as the CAPS LED. Assign no triggered
|
||||
// function, and initialize to initial state of the CAPS logic. The CAPS LED
|
||||
// will be controlled by the state of the CAPSLOCK logic.
|
||||
{ .virtual_device = VCAPS_LED, .physical_device = APPLE_POWER_LED, .initial_value = 0 }, \
|
||||
asdf_virtual_assign(VCAPS_LED, APPLE_POWER_LED, V_NOFUNC, APPLE_POWER_LED_INIT_VALUE);
|
||||
|
||||
// Assign CAPS LED to virtual CAPS LED, and initialize to the INIT value, to
|
||||
// match the initial CAPSLOCK state. The capslock state code will alter the
|
||||
// virtual LED according to the state.
|
||||
asdf_virtual_assign(VCAPS_LED, APPLE_CAPS_LED, V_NOFUNC, APPLE_CAPS_LED_INIT_VALUE);
|
||||
{ .virtual_device = APPLE_VIRTUAL_DISABLED_LED, \
|
||||
.physical_device = APPLE_DISABLED_LED, \
|
||||
.initial_value = 0 }, \
|
||||
|
||||
// assign RESET output to the virtual RESET output, configure to produce a short pulse when activated
|
||||
asdf_virtual_assign(APPLE_VIRTUAL_RESET, APPLE_RESET_OUTPUT, V_PULSE_SHORT, !APPLE_RESET_ACTIVE_VALUE);
|
||||
|
||||
// assign the CLRSCR output to the virtual CLRSCR output, configure to produce a long pulse when activated
|
||||
asdf_virtual_assign(APPLE_VIRTUAL_CLR_SCR, APPLE_CLR_SCR_OUTPUT, V_PULSE_LONG, !APPLE_CLR_SCR_ACTIVE_VALUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------|---------|---------+---------+---------+---------+---------+---------+
|
||||
// Above line is 80 columns, and should display completely in the editor.
|
||||
|
298
firmware/asdf/src/Keymaps/asdf_keymap_apple2.h
Normal file
298
firmware/asdf/src/Keymaps/asdf_keymap_apple2.h
Normal file
@ -0,0 +1,298 @@
|
||||
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Unfified Keyboard Project
|
||||
// ASDF keyboard firmware
|
||||
//
|
||||
// asdf_keymap_apple2.h
|
||||
//
|
||||
// Apple 2 keymaps
|
||||
//
|
||||
// Copyright 2019 David Fenyes
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation, either version 3 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
// This file supplies the Apple 2 ASCII keyboard keymap. Two variants are provided:
|
||||
//
|
||||
// 1) An Upper/Lowercase variant. This variant moves the @ and ^ symbols from
|
||||
// the P and N keys to the REPEAT key, since the P and N keys need to reserve
|
||||
// the shifted value for the uppercase characters. Also, the "Power" key
|
||||
// doubles as a caps-lock key.
|
||||
//
|
||||
// 2) A CAPS only keyboard, following the standard Apple II conventions and
|
||||
// layout, with ^ above the N key and @ above the P key, and a functioning
|
||||
// REPEAT key.
|
||||
//
|
||||
// For both variants, CTRL+RESET is required for a system reset.
|
||||
|
||||
#if !defined(ASDF_KEYMAP_DEFS_APPLE2_H)
|
||||
#define ASDF_KEYMAP_DEFS_APPLE2_H
|
||||
|
||||
// Edit the number of rows and columns used in this map. If the number is less
|
||||
// than the maxium, the unused elements will be initialized to 0.
|
||||
|
||||
#define ASDF_APPLE2_NUM_ROWS 9 // DIP switches are row 8 (zero-based)
|
||||
#define ASDF_APPLE2_NUM_COLS 8
|
||||
|
||||
#define APPLE_ACTION_RESET ACTION_VOUT1
|
||||
#define APPLE_VIRTUAL_RESET VOUT1
|
||||
#define APPLE_RESET_OUTPUT PHYSICAL_OUT3_OPEN_HI
|
||||
#define APPLE_RESET_ACTIVE_VALUE 0
|
||||
|
||||
#define APPLE_ACTION_CLEAR ACTION_VOUT2
|
||||
#define APPLE_VIRTUAL_CLR_SCR VOUT2
|
||||
#define APPLE_CLR_SCR_OUTPUT PHYSICAL_OUT1_OPEN_LO
|
||||
#define APPLE_CLR_SCR_ACTIVE_VALUE 1
|
||||
|
||||
#define APPLE_VIRTUAL_POWER_LED VLED1
|
||||
#define APPLE_POWER_LED PHYSICAL_LED1
|
||||
#define APPLE_POWER_LED_INIT_VALUE 1
|
||||
|
||||
#define APPLE_VIRTUAL_DISABLED_LED VLED2
|
||||
#define APPLE_DISABLED_LED PHYSICAL_LED3
|
||||
#define APPLE_DISABLED_INIT_VALUE 0
|
||||
|
||||
// The PLAIN map uses the "power" button as a caps-lock, so map the CAPS LED to
|
||||
// the power button LED.
|
||||
#define ASDF_APPLE2_PLAIN_KEYMAP_INITIALIZER \
|
||||
{ \
|
||||
{ .virtual_device = VCAPS_LED, .physical_device = APPLE_POWER_LED, .initial_value = 0 }, \
|
||||
{ .virtual_device = APPLE_VIRTUAL_DISABLED_LED, \
|
||||
.physical_device = APPLE_DISABLED_LED, \
|
||||
.initial_value = 0 }, \
|
||||
{ .virtual_device = APPLE_VIRTUAL_RESET, \
|
||||
.physical_device = APPLE_RESET_OUTPUT, \
|
||||
.function = V_PULSE_SHORT, \
|
||||
.initial_value = !APPLE_RESET_ACTIVE_VALUE }, \
|
||||
{ \
|
||||
.virtual_device = APPLE_VIRTUAL_CLR_SCR, .physical_device = APPLE_CLR_SCR_OUTPUT, \
|
||||
.function = V_PULSE_LONG, .initial_value = !APPLE_CLR_SCR_ACTIVE_VALUE \
|
||||
} \
|
||||
}
|
||||
|
||||
// The ALL CAPS map is the classic Apple II/II+ map. There is no CAPS LED, since
|
||||
// CAPS doesn't matter in the ALL CAPS keymap.
|
||||
#define ASDF_APPLE2_CAPS_KEYMAP_INITIALIZER \
|
||||
{ \
|
||||
{ .virtual_device = APPLE_VIRTUAL_POWER_LED, \
|
||||
.physical_device = APPLE_POWER_LED, \
|
||||
.initial_value = APPLE_POWER_LED_INIT_VALUE }, \
|
||||
{ .virtual_device = APPLE_VIRTUAL_DISABLED_LED, \
|
||||
.physical_device = APPLE_DISABLED_LED, \
|
||||
.initial_value = 0 }, \
|
||||
{ .virtual_device = APPLE_VIRTUAL_RESET, \
|
||||
.physical_device = APPLE_RESET_OUTPUT, \
|
||||
.function = V_PULSE_SHORT, \
|
||||
.initial_value = !APPLE_RESET_ACTIVE_VALUE }, \
|
||||
{ \
|
||||
.virtual_device = APPLE_VIRTUAL_CLR_SCR, .physical_device = APPLE_CLR_SCR_OUTPUT, \
|
||||
.function = V_PULSE_LONG, .initial_value = !APPLE_CLR_SCR_ACTIVE_VALUE \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define ASDF_APPLE2_KEYMAP_INITIALIZER \
|
||||
ASDF_APPLE2_PLAIN_KEYMAP_INITIALIZER, ASDF_APPLE2_CAPS_KEYMAP_INITIALIZER
|
||||
|
||||
// Structure to initialize hooks. No hook functions are needed for APPLE2 keyboard.
|
||||
#define ASDF_APPLE2_KEYMAP_HOOK_INITIALIZER_LENGTH 0
|
||||
#define ASDF_APPLE2_PLAIN_KEYMAP_HOOK_INITIALIZER \
|
||||
{ \
|
||||
}
|
||||
#define ASDF_APPLE2_CAPS_KEYMAP_HOOK_INITIALIZER \
|
||||
{ \
|
||||
}
|
||||
#define ASDF_APPLE2_KEYMAP_HOOK_INITIALIZER \
|
||||
ASDF_APPLE2_PLAIN_KEYMAP_HOOK_INITIALIZER, ASDF_APPLE2_CAPS_KEYMAP_HOOK_INITIALIZER
|
||||
|
||||
|
||||
// Key Matrix for combination of ASCII controller and Classic ASCII matrix
|
||||
//
|
||||
// Col-> 0 1 2 3 4 5 6 7
|
||||
// Row 0 POWER R-Shift L-Shift (no key) ESC TAB CTRL \(backslash)
|
||||
// Row 1 Rubout P ; / SPACEBAR Z A Q
|
||||
// Row 2 Break ,(comma) M N B V C X
|
||||
// Row 3 Spare K J H G F D A
|
||||
// Row 4 Rt arrow I U Y T R E W
|
||||
// Row 5 LT arrow Repeat CapsLock Return LineFeed O(alpha) L .(period)
|
||||
// Row 6 ~(tilde) ] [ -(dash) :(colon) 0(numeral) 9 8
|
||||
// Row 7 @(at) 7 6 5 4 3 2 1
|
||||
//
|
||||
// Row 15 DIP switches 0-7
|
||||
//
|
||||
// Notes:
|
||||
//
|
||||
// 1) The keys above correspond to the silk screen on the PCB. For the OSI and
|
||||
// Apple layouts, the keys may not all match the silk screen. When creating a
|
||||
// layout different from the silk screen, look up the row and column for the
|
||||
// silk screen label at the desired position, and then place the desired
|
||||
// function in the keymap definition at the desired row and column. For
|
||||
// example, the Apple 2 keymap places the "RESET" key at the "[" silk-screen
|
||||
// position, Row 6, Col 2. The keymap places ACTION_RESET at Row 6, Col 2 in
|
||||
// the "ASDF_APPLE2_CTRL_MAP" to map the RESET function to the CTRL-RESET key
|
||||
// combination.
|
||||
//
|
||||
// 2) To ensure consistent DIP switch operation within the keymap, a
|
||||
// ASDF_ASCII_DIP_SWITCHES macro is defined. Keeping the ACTION_MAPSEL0-3
|
||||
// definitions in positions 0-3 ensures consistent map selection among all
|
||||
// keymaps.
|
||||
|
||||
#define ASDF_APPLE2_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
|
||||
|
||||
#define APPLE_LEFT_ARROW ASCII_CTRL_H
|
||||
#define APPLE_RIGHT_ARROW ASCII_CTRL_U
|
||||
|
||||
// clang-format off
|
||||
#define ASDF_APPLE2_PLAIN_MAP \
|
||||
{ \
|
||||
[0] = { ACTION_CAPS, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
|
||||
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, APPLE_RIGHT_ARROW }, \
|
||||
[1] = { ASCII_DEL, 'p', ';', '/', ASCII_SPACE, 'z', 'a', 'q' }, \
|
||||
[2] = { ACTION_NOTHING, ASCII_COMMA, 'm', 'n', 'b', 'v', 'c', 'x' }, \
|
||||
[3] = { ACTION_NOTHING, 'k', 'j', 'h', 'g', 'f', 'd', 's' }, \
|
||||
[4] = { ACTION_NOTHING, 'i', 'u', 'y', 't', 'r', 'e', 'w' }, \
|
||||
[5] = { ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ASCII_CR, '^', 'o', 'l', ASCII_PERIOD }, \
|
||||
[6] = { ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, '-', ':', ASCII_ZERO, '9', '8' }, \
|
||||
[7] = { APPLE_LEFT_ARROW, '7', '6', '5', '4', '3', '2', '1' }, \
|
||||
ASDF_APPLE2_DIP_SWITCHES \
|
||||
}
|
||||
|
||||
#define ASDF_APPLE2_SHIFT_MAP \
|
||||
{ \
|
||||
[0] = { ACTION_CAPS, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
|
||||
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, APPLE_RIGHT_ARROW }, \
|
||||
[1] = { ACTION_NOTHING, 'P', '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' }, \
|
||||
[2] = { ACTION_NOTHING, '<', 'M', 'N', 'B', 'V', 'C', 'X' }, \
|
||||
[3] = { ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
|
||||
[4] = { ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
|
||||
[5] = { ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ASCII_CR, ASCII_AT, 'O', 'L', '>' }, \
|
||||
[6] = { ACTION_NOTHING, ACTION_NOTHING, APPLE_ACTION_CLEAR, '=', \
|
||||
'*', ASCII_ZERO, ASCII_RT_PAREN, ASCII_LT_PAREN }, \
|
||||
[7] = { APPLE_LEFT_ARROW, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' }, \
|
||||
ASDF_APPLE2_DIP_SWITCHES \
|
||||
}
|
||||
|
||||
#define ASDF_APPLE2_CAPS_MAP \
|
||||
{ \
|
||||
[0] = { ACTION_CAPS, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
|
||||
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, APPLE_RIGHT_ARROW }, \
|
||||
[1] = { ACTION_NOTHING, 'P', ';', '/', ASCII_SPACE, 'Z', 'A', 'Q' }, \
|
||||
[2] = { ACTION_NOTHING, ASCII_COMMA, 'M', 'N', 'B', 'V', 'C', 'X' }, \
|
||||
[3] = { ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
|
||||
[4] = { ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
|
||||
[5] = { ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ASCII_CR, ACTION_REPEAT, 'O', 'L', ASCII_PERIOD }, \
|
||||
[6] = { ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, '-', ':', ASCII_ZERO, '9', '8' }, \
|
||||
[7] = { APPLE_LEFT_ARROW, '7', '6', '5', '4', '3', '2', '1' }, \
|
||||
ASDF_APPLE2_DIP_SWITCHES \
|
||||
}
|
||||
|
||||
|
||||
#define ASDF_APPLE2_SHIFT_CAPS_MAP \
|
||||
{ \
|
||||
[0] = { ACTION_CAPS, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
|
||||
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, APPLE_RIGHT_ARROW }, \
|
||||
[1] = { ACTION_NOTHING, ASCII_AT, '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' }, \
|
||||
[2] = { ACTION_NOTHING, '<', 'M', '^', 'B', 'V', 'C', 'X' }, \
|
||||
[3] = { ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
|
||||
[4] = { ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
|
||||
[5] = { ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ASCII_CR, ACTION_REPEAT, 'O', 'L', '>' }, \
|
||||
[6] = { ACTION_NOTHING, ACTION_NOTHING, APPLE_ACTION_CLEAR, '=', \
|
||||
'*', ASCII_ZERO, ASCII_RT_PAREN, ASCII_LT_PAREN }, \
|
||||
[7] = { APPLE_LEFT_ARROW, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' }, \
|
||||
ASDF_APPLE2_DIP_SWITCHES \
|
||||
}
|
||||
|
||||
#define ASDF_APPLE2_CTRL_MAP \
|
||||
{ \
|
||||
[0] = { ACTION_CAPS, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
|
||||
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, APPLE_RIGHT_ARROW }, \
|
||||
[1] = { ACTION_NOTHING, ASCII_CTRL_P, ACTION_NOTHING, ACTION_NOTHING, \
|
||||
ASCII_SPACE, ASCII_CTRL_Z, ASCII_CTRL_A, ASCII_CTRL_Q }, \
|
||||
[2] = { ACTION_NOTHING, ASCII_COMMA, ASCII_CTRL_M, ASCII_CTRL_N, \
|
||||
ASCII_CTRL_B, ASCII_CTRL_V, ASCII_CTRL_C, ASCII_CTRL_X }, \
|
||||
[3] = { ACTION_NOTHING, ASCII_CTRL_K, ASCII_CTRL_J, ASCII_CTRL_H, \
|
||||
ASCII_CTRL_G, ASCII_CTRL_F, ASCII_CTRL_D, ASCII_CTRL_S }, \
|
||||
[4] = { ACTION_NOTHING, ASCII_CTRL_I, ASCII_CTRL_U, ASCII_CTRL_Y, \
|
||||
ASCII_CTRL_T, ASCII_CTRL_R, ASCII_CTRL_E, ASCII_CTRL_W }, \
|
||||
[5] = { ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ASCII_CR, \
|
||||
ACTION_REPEAT, ASCII_CTRL_O, ASCII_CTRL_L, ACTION_NOTHING }, \
|
||||
[6] = { ACTION_NOTHING, ACTION_NOTHING, APPLE_ACTION_RESET, ACTION_NOTHING, \
|
||||
ACTION_NOTHING, ACTION_FN_10, ACTION_FN_9, ACTION_FN_8 }, \
|
||||
[7] = { APPLE_LEFT_ARROW, ACTION_FN_7, ACTION_FN_6, ACTION_FN_5, \
|
||||
ACTION_FN_4, ACTION_FN_3, ACTION_FN_2, ACTION_FN_1 }, \
|
||||
ASDF_APPLE2_DIP_SWITCHES \
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
#define ASDF_APPLE2_MAP_DECLARATIONS \
|
||||
static const FLASH keycode_matrix_t apple2_plain_matrix = ASDF_APPLE2_PLAIN_MAP; \
|
||||
static const FLASH keycode_matrix_t apple2_shift_matrix = ASDF_APPLE2_SHIFT_MAP; \
|
||||
static const FLASH keycode_matrix_t apple2_caps_matrix = ASDF_APPLE2_CAPS_MAP; \
|
||||
static const FLASH keycode_matrix_t apple2_caps_shift_matrix = ASDF_APPLE2_SHIFT_CAPS_MAP; \
|
||||
static const FLASH keycode_matrix_t apple2_ctrl_matrix = ASDF_APPLE2_CTRL_MAP;
|
||||
|
||||
|
||||
// Here, you can specify which maps are associated with which modifier keys.
|
||||
// There can be multiple definitions. For example, as shown here, an ALL CAPS
|
||||
// keymap can be made by assigning the caps map to the "no modifier" position.
|
||||
// Or, more additional keymaps can be defined above, and keymap sets can be
|
||||
// defined below that pick and choose between them. The modifiers are assigned as follows:
|
||||
//
|
||||
// [0]: plain (no modifiers)
|
||||
// [1]: shift (shift key or shift lock active)
|
||||
// [2]: caps (caps lock active)
|
||||
// [3]: ctrl: (control key active)
|
||||
|
||||
#define ASDF_APPLE2_PLAIN_MAP_DEFS \
|
||||
{ \
|
||||
[MOD_PLAIN_MAP] = &apple2_plain_matrix, [MOD_SHIFT_MAP] = &apple2_shift_matrix, \
|
||||
[MOD_CAPS_MAP] = &apple2_caps_matrix, [MOD_CTRL_MAP] = &apple2_ctrl_matrix \
|
||||
}
|
||||
|
||||
#define ASDF_APPLE2_CAPS_MAP_DEFS \
|
||||
{ \
|
||||
[MOD_PLAIN_MAP] = &apple2_caps_matrix, [MOD_SHIFT_MAP] = &apple2_caps_shift_matrix, \
|
||||
[MOD_CAPS_MAP] = &apple2_caps_matrix, [MOD_CTRL_MAP] = &apple2_ctrl_matrix \
|
||||
}
|
||||
|
||||
#define ASDF_APPLE2_ALL_MAPS ASDF_APPLE2_PLAIN_MAP_DEFS, ASDF_APPLE2_CAPS_MAP_DEFS
|
||||
|
||||
#define ASDF_APPLE2_ALL_MAPS_COUNT 2
|
||||
|
||||
#if !defined(ASDF_NUM_ROWS) || (ASDF_NUM_ROWS < ASDF_APPLE2_NUM_ROWS)
|
||||
#undef ASDF_NUM_ROWS
|
||||
#define ASDF_NUM_ROWS ASDF_APPLE2_NUM_ROWS
|
||||
#endif
|
||||
|
||||
#if !defined(ASDF_NUM_COLS) || (ASDF_NUM_COLS < ASDF_APPLE2_NUM_COLS)
|
||||
#undef ASDF_NUM_COLS
|
||||
#define ASDF_NUM_COLS ASDF_APPLE2_NUM_COLS
|
||||
#endif
|
||||
|
||||
#if !defined(ASDF_KEYMAP_INITIALIZER_LENGTH) \
|
||||
|| (ASDF_KEYMAP_INITIALIZER_LENGTH < ASDF_APPLE2_KEYMAP_INITIALIZER_LENGTH)
|
||||
#undef ASDF_KEYMAP_INITIALIZER_LENGTH
|
||||
#define ASDF_KEYMAP_INITIALIZER_LENGTH ASDF_APPLE2_KEYMAP_INITIALIZER_LENGTH
|
||||
#endif
|
||||
|
||||
#if !defined(ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH) \
|
||||
|| (ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH < ASDF_APPLE2_KEYMAP_HOOK_INITIALIZER_LENGTH)
|
||||
#undef ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH
|
||||
#define ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH ASDF_APPLE2_KEYMAP_HOOK_INITIALIZER_LENGTH
|
||||
#endif
|
||||
|
||||
#endif /* !defined (ASDF_KEYMAP_DEFS_APPLE2_H) */
|
||||
|
||||
//-------|---------|---------+---------+---------+---------+---------+---------+
|
||||
// Above line is 80 columns, and should display completely in the editor.
|
211
firmware/asdf/src/Keymaps/asdf_keymap_classic.c
Normal file
211
firmware/asdf/src/Keymaps/asdf_keymap_classic.c
Normal file
@ -0,0 +1,211 @@
|
||||
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Unified Keyboard Project
|
||||
// ASDF keyboard firmware
|
||||
//
|
||||
// asdf_keymap_classic.c
|
||||
//
|
||||
// Implements the "classic" ADM 3A style keymaps
|
||||
//
|
||||
// Copyright 2019 David Fenyes
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation, either version 3 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "asdf_keymap_classic.h"
|
||||
|
||||
// Key Matrix for combination of ASCII controller and Classic ASCII matrix
|
||||
//
|
||||
// Col-> 0 1 2 3 4 5 6 7
|
||||
// Row 0 POWER R-Shift L-Shift (no key) ESC TAB CTRL \(backslash)
|
||||
// Row 1 Rubout P ; / SPACEBAR Z A Q
|
||||
// Row 2 Break ,(comma) M N B V C X
|
||||
// Row 3 Spare K J H G F D A
|
||||
// Row 4 Rt arrow I U Y T R E W
|
||||
// Row 5 LT arrow Repeat CapsLock Return LineFeed O(alpha) L .(period)
|
||||
// Row 6 ~(tilde) ] [ -(dash) :(colon) 0(numeral) 9 8
|
||||
// Row 7 @(at) 7 6 5 4 3 2 1
|
||||
//
|
||||
// Row 15 DIP switches 0-7
|
||||
//
|
||||
// Notes:
|
||||
//
|
||||
// 1) The keys above correspond to the silk screen on the PCB. For the OSI and
|
||||
// Apple layouts, the keys may not all match the silk screen. When creating a
|
||||
// layout different from the silk screen, look up the row and column for the
|
||||
// silk screen label at the desired position, and then place the desired
|
||||
// function in the keymap definition at the desired row and column. For
|
||||
// example, the Apple 2 keymap places the "RESET" key at the "[" silk-screen
|
||||
// position, Row 6, Col 2. The keymap places ACTION_RESET at Row 6, Col 2 in
|
||||
// the "ASDF_APPLE2_CTRL_MAP" to map the RESET function to the CTRL-RESET key
|
||||
// combination.
|
||||
//
|
||||
// 2) To ensure consistent DIP switch operation within the keymap, a
|
||||
// ASDF_ASCII_DIP_SWITCHES macro is defined. Keeping the ACTION_MAPSEL0-3
|
||||
// definitions in positions 0-3 ensures consistent map selection among all
|
||||
// keymaps.
|
||||
|
||||
#define ASDF_CLASSIC_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
|
||||
|
||||
static const FLASH keycode_matrix_t ascii_plain_matrix = {
|
||||
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, CLASSIC_ESC, ASCII_TAB,
|
||||
ACTION_CTRL, ASCII_BACKSLASH },
|
||||
[1] = { ASCII_DEL, 'p', ';', '/', ASCII_SPACE, 'z', 'a', 'q' },
|
||||
[2] = { ASCII_ACTION_BREAK, ASCII_COMMA, 'm', 'n', 'b', 'v', 'c', 'x' },
|
||||
[3] = { ACTION_NOTHING, 'k', 'j', 'h', 'g', 'f', 'd', 's' },
|
||||
[4] = { ACTION_NOTHING, 'i', 'u', 'y', 't', 'r', 'e', 'w' },
|
||||
[5] = { ACTION_NOTHING, ACTION_REPEAT, ACTION_CAPS, ASCII_CR, ASCII_LF, 'o', 'l', ASCII_PERIOD },
|
||||
[6] = { ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', ASCII_ZERO, '9',
|
||||
'8' },
|
||||
[7] = { ASCII_AT, '7', '6', '5', '4', '3', '2', '1' },
|
||||
ASDF_CLASSIC_DIP_SWITCHES
|
||||
};
|
||||
|
||||
static const FLASH keycode_matrix_t ascii_shift_matrix = {
|
||||
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, ASCII_ESC, ASCII_TAB,
|
||||
ACTION_CTRL, ASCII_VERT_BAR },
|
||||
[1] = { ASCII_DEL, 'P', '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' },
|
||||
[2] = { ASCII_ACTION_CLEAR, '<', 'M', 'N', 'B', 'V', 'C', 'X' },
|
||||
[3] = { ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' },
|
||||
[4] = { ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' },
|
||||
[5] = { ACTION_NOTHING, ACTION_REPEAT, ACTION_CAPS, ASCII_CR, ASCII_LF, 'O', 'L', '>' },
|
||||
[6] = { ASCII_TILDE, ASCII_RT_CURLY_BRACE, ASCII_LT_CURLY_BRACE, '=', '*', ASCII_ZERO,
|
||||
ASCII_RT_PAREN, ASCII_LT_PAREN },
|
||||
[7] = { ASCII_GRAVE_ACCENT, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' },
|
||||
ASDF_CLASSIC_DIP_SWITCHES
|
||||
};
|
||||
|
||||
static const FLASH keycode_matrix_t ascii_caps_matrix = {
|
||||
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, ASCII_ESC, ASCII_TAB,
|
||||
ACTION_CTRL, ASCII_BACKSLASH },
|
||||
[1] = { ASCII_DEL, 'P', ';', '/', ASCII_SPACE, 'Z', 'A', 'Q' },
|
||||
[2] = { ASCII_ACTION_BREAK, ASCII_COMMA, 'M', 'N', 'B', 'V', 'C', 'X' },
|
||||
[3] = { ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' },
|
||||
[4] = { ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' },
|
||||
[5] = { ACTION_NOTHING, ACTION_REPEAT, ACTION_CAPS, ASCII_CR, ASCII_LF, 'O', 'L', ASCII_PERIOD },
|
||||
[6] = { ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', ASCII_ZERO, '9',
|
||||
'8' },
|
||||
[7] = { ASCII_AT, '7', '6', '5', '4', '3', '2', '1' },
|
||||
ASDF_CLASSIC_DIP_SWITCHES
|
||||
};
|
||||
|
||||
static const FLASH keycode_matrix_t ascii_ctrl_matrix = {
|
||||
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, ASCII_ESC, ASCII_TAB,
|
||||
ACTION_CTRL, 0x1c },
|
||||
[1] = { ACTION_NOTHING, ASCII_CTRL_P, ACTION_NOTHING, ACTION_NOTHING, ASCII_SPACE, ASCII_CTRL_Z,
|
||||
ASCII_CTRL_A, ASCII_CTRL_Q },
|
||||
[2] = { ASCII_ACTION_RESET, ASCII_COMMA, ASCII_CTRL_M, ASCII_CTRL_N, ASCII_CTRL_B, ASCII_CTRL_V,
|
||||
ASCII_CTRL_C, ASCII_CTRL_X },
|
||||
[3] = { ACTION_NOTHING, ASCII_CTRL_K, ASCII_CTRL_J, ASCII_CTRL_H, ASCII_CTRL_G, ASCII_CTRL_F,
|
||||
ASCII_CTRL_D, ASCII_CTRL_S },
|
||||
[4] = { ACTION_NOTHING, ASCII_CTRL_I, ASCII_CTRL_U, ASCII_CTRL_Y, ASCII_CTRL_T, ASCII_CTRL_R,
|
||||
ASCII_CTRL_E, ASCII_CTRL_W },
|
||||
[5] = { ACTION_NOTHING, ACTION_REPEAT, ACTION_CAPS, ASCII_CR, ASCII_LF, ASCII_CTRL_O,
|
||||
ASCII_CTRL_L, ACTION_NOTHING },
|
||||
[6] = { ACTION_NOTHING, 0x1d, ASCII_ESC, ACTION_NOTHING, ACTION_NOTHING, ACTION_FN_10,
|
||||
ACTION_FN_9, ACTION_FN_8 },
|
||||
[7] = { ASCII_NULL, ACTION_FN_7, ACTION_FN_6, ACTION_FN_5, ACTION_FN_4, ACTION_FN_3, ACTION_FN_2,
|
||||
ACTION_FN_1 },
|
||||
ASDF_CLASSIC_DIP_SWITCHES
|
||||
};
|
||||
|
||||
|
||||
// PROCEDURE:
|
||||
// INPUTS:
|
||||
// OUTPUTS:
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// SIDE EFFECTS:
|
||||
//
|
||||
// NOTES:
|
||||
//
|
||||
// SCOPE:
|
||||
//
|
||||
// COMPLEXITY:
|
||||
//
|
||||
|
||||
// PROCEDURE: classic_add_map
|
||||
// INPUTS: asdf_keycode_t (*matrix) - a SOL_NUM_ROWS x SOL_NUM_COLS matrix of keycodes for each physical row/column pair
|
||||
// modifier_index_t modifier index - the modifier state corresponding to the keycode matrix
|
||||
// OUTPUTS: none
|
||||
// DESCRIPTION: Passes the keycode matrix and modifier state through to
|
||||
// asdf_keymaps_add_map(), along with the row/column dimensions.
|
||||
//
|
||||
// SIDE EFFECTS: the matrix is added to the keymap
|
||||
//
|
||||
// SCOPE: private
|
||||
//
|
||||
// COMPLEXITY: 1
|
||||
//
|
||||
static void classic_add_map(const asdf_keycode_t (*matrix)[CLASSIC_NUM_COLS],
|
||||
modifier_index_t modifier_index)
|
||||
{
|
||||
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) CLASSIC_NUM_ROWS,
|
||||
(uint8_t) CLASSIC_NUM_COLS);
|
||||
}
|
||||
|
||||
|
||||
void setup_classic_keymap(void)
|
||||
{
|
||||
classic_add_map(classic_plain_map, MOD_PLAIN_MAP);
|
||||
classic_add_map(classic_caps_map, MOD_CAPS_MAP);
|
||||
classic_add_map(classic_shift_map, MOD_SHIFT_MAP);
|
||||
classic_add_map(classic_ctrl_map, MOD_CTRL_MAP);
|
||||
|
||||
asdf_virtual_init();
|
||||
|
||||
// Assign power LED to virtual power LED, and initialize to ON
|
||||
asdf_virtual_assign(CLASSIC_VIRTUAL_POWER_LED, CLASSIC_POWER_LED, V_NOFUNC, CLASSIC_POWER_LED_INIT_VALUE);
|
||||
|
||||
// Assign CAPS LED to virtual CAPS LED, and initialize to the INIT value, to
|
||||
// match the initial CAPSLOCK state. The capslock state code will alter the
|
||||
// virtual LED according to the state.
|
||||
asdf_virtual_assign(VCAPS_LED, CLASSIC_CAPS_LED, V_NOFUNC, CLASSIC_CAPS_LED_INIT_VALUE);
|
||||
|
||||
// assign RESET output to the virtual RESET output, configure to produce a short pulse when activated
|
||||
asdf_virtual_assign(CLASSIC_VIRTUAL_RESET, CLASSIC_RESET_OUTPUT, V_PULSE_SHORT, !CLASSIC_RESET_ACTIVE_VALUE);
|
||||
|
||||
// assign the CLRSCR output to the virtual CLRSCR output, configure to produce a long pulse when activated
|
||||
asdf_virtual_assign(CLASSIC_VIRTUAL_CLR_SCR, CLASSIC_CLR_SCR_OUT, V_PULSE_LONG, !CLASSIC_CLR_SCR_ACTIVE_VALUE);
|
||||
}
|
||||
|
||||
void setup_classic_caps_keymap(void)
|
||||
{
|
||||
// for the ALL CAPS keymap, the "plain" mode is the same as "all caps" mode:
|
||||
classic_add_map(classic_caps_map, MOD_PLAIN_MAP);
|
||||
classic_add_map(classic_caps_map, MOD_CAPS_MAP);
|
||||
classic_add_map(classic_shift_map, MOD_SHIFT_MAP);
|
||||
classic_add_map(classic_ctrl_map, MOD_CTRL_MAP);
|
||||
|
||||
asdf_virtual_init();
|
||||
|
||||
// Assign power LED to virtual power LED, and initialize to ON
|
||||
asdf_virtual_assign(CLASSIC_VIRTUAL_POWER_LED, CLASSIC_POWER_LED, V_NOFUNC, CLASSIC_POWER_LED_INIT_VALUE);
|
||||
|
||||
// Because the virtual power LED never changes, also assign the CAPSLOCK
|
||||
// physical LED to the virtual Power LED, and intialize to OFF (or can change
|
||||
// to ON depending on preference)
|
||||
asdf_virtual_assign(CLASSIC_VIRTUAL_POWER_LED, CLASSIC_CAPS_LED, V_NOFUNC, CLASSIC_CAPS_LED_INIT_VALUE);
|
||||
|
||||
// assign RESET output to the virtual RESET output, configure to produce a short pulse when activated
|
||||
asdf_virtual_assign(CLASSIC_VIRTUAL_RESET, CLASSIC_RESET_OUTPUT, V_PULSE_SHORT, !CLASSIC_RESET_ACTIVE_VALUE);
|
||||
|
||||
// assign the CLRSCR output to the virtual CLRSCR output, configure to produce a long pulse when activated
|
||||
asdf_virtual_assign(CLASSIC_VIRTUAL_CLR_SCR, CLASSIC_CLR_SCR_OUT, V_PULSE_LONG, !CLASSIC_CLR_SCR_ACTIVE_VALUE);
|
||||
}
|
||||
|
||||
|
||||
//-------|---------|---------+---------+---------+---------+---------+---------+
|
||||
// Above line is 80 columns, and should display completely in the editor.
|
102
firmware/asdf/src/Keymaps/asdf_keymap_classic.h
Normal file
102
firmware/asdf/src/Keymaps/asdf_keymap_classic.h
Normal file
@ -0,0 +1,102 @@
|
||||
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Unfified Keyboard Project
|
||||
// ASDF keyboard firmware
|
||||
//
|
||||
// asdf_keymap_classic.h
|
||||
//
|
||||
// Ascii keymaps
|
||||
//
|
||||
// Copyright 2019 David Fenyes
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation, either version 3 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
// To use this ascii for a new keymap, edit the keymaps definitions as
|
||||
// desired. The keymaps are organized from row 0, counting upward, and each row
|
||||
// includes the columns from 0-NUM_COLS.
|
||||
//
|
||||
|
||||
#if !defined(ASDF_KEYMAP_DEFS_CLASSIC_H)
|
||||
#define ASDF_KEYMAP_DEFS_CLASSIC_H
|
||||
|
||||
// include DIP switch definitions
|
||||
#include "asdf_keymap_defs_dipswitch.h"
|
||||
|
||||
// Edit the number of rows and columns used in this map. If the number is less
|
||||
// than the maxium, the unused elements will be initialized to 0.
|
||||
|
||||
#define ASDF_CLASSIC_NUM_ROWS 9 // DIP switches are row 8 (zero based)
|
||||
#define ASDF_CLASSIC_NUM_COLS 8
|
||||
|
||||
#define CLASSIC_ACTION_BREAK ACTION_NOTHING
|
||||
|
||||
#define CLASSIC_VIRTUAL_RESET VOUT1
|
||||
#define CLASSIC_ACTION_RESET ACTION_VOUT1
|
||||
#define CLASSIC_RESET_OUTPUT PHYSICAL_OUT3_OPEN_HI
|
||||
#define CLASSIC_RESET_ACTIVE_VALUE 0
|
||||
|
||||
#define CLASSIC_VIRTUAL_CLR_SCR VOUT2
|
||||
#define CLASSIC_ACTION_CLEAR ACTION_VOUT2
|
||||
#define CLASSIC_CLR_SCR_OUT PHYSICAL_OUT1_OPEN_LO
|
||||
#define CLASSIC_CLR_SCR_ACTIVE_VALUE 1
|
||||
|
||||
#define CLASSIC_VIRTUAL_POWER_LED VLED1
|
||||
#define CLASSIC_POWER_LED PHYSICAL_LED1
|
||||
#define CLASSIC_POWER_LED_INIT_VALUE 1
|
||||
|
||||
#define CLASSIC_CAPS_LED PHYSICAL_LED3
|
||||
#define CLASSIC_CAPS_LED_INIT_VALUE 0
|
||||
|
||||
|
||||
|
||||
// Key Matrix for combination of ASCII controller and Classic ASCII matrix
|
||||
//
|
||||
// Col-> 0 1 2 3 4 5 6 7
|
||||
// Row 0 POWER R-Shift L-Shift (no key) ESC TAB CTRL \(backslash)
|
||||
// Row 1 Rubout P ; / SPACEBAR Z A Q
|
||||
// Row 2 Break ,(comma) M N B V C X
|
||||
// Row 3 Spare K J H G F D A
|
||||
// Row 4 Rt arrow I U Y T R E W
|
||||
// Row 5 LT arrow Repeat CapsLock Return LineFeed O(alpha) L .(period)
|
||||
// Row 6 ~(tilde) ] [ -(dash) :(colon) 0(numeral) 9 8
|
||||
// Row 7 @(at) 7 6 5 4 3 2 1
|
||||
//
|
||||
// Row 15 DIP switches 0-7
|
||||
//
|
||||
// Notes:
|
||||
//
|
||||
// 1) The keys above correspond to the silk screen on the PCB. For the OSI and
|
||||
// Apple layouts, the keys may not all match the silk screen. When creating a
|
||||
// layout different from the silk screen, look up the row and column for the
|
||||
// silk screen label at the desired position, and then place the desired
|
||||
// function in the keymap definition at the desired row and column. For
|
||||
// example, the Apple 2 keymap places the "RESET" key at the "[" silk-screen
|
||||
// position, Row 6, Col 2. The keymap places ACTION_RESET at Row 6, Col 2 in
|
||||
// the "ASDF_APPLE2_CTRL_MAP" to map the RESET function to the CTRL-RESET key
|
||||
// combination.
|
||||
//
|
||||
// 2) To ensure consistent DIP switch operation within the keymap, a
|
||||
// ASDF_ASCII_DIP_SWITCHES macro is defined. Keeping the ACTION_MAPSEL0-3
|
||||
// definitions in positions 0-3 ensures consistent map selection among all
|
||||
// keymaps.
|
||||
|
||||
#define ASDF_CLASSIC_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
|
||||
|
||||
|
||||
|
||||
#endif /* !defined (ASDF_KEYMAP_DEFS_ASCII_H) */
|
||||
|
||||
//-------|---------|---------+---------+---------+---------+---------+---------+
|
||||
// Above line is 80 columns, and should display completely in the editor.
|
170
firmware/asdf/src/Keymaps/asdf_keymap_sol.c
Normal file
170
firmware/asdf/src/Keymaps/asdf_keymap_sol.c
Normal file
@ -0,0 +1,170 @@
|
||||
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
|
||||
//
|
||||
// Unified Keyboard Project
|
||||
// ASDF keyboard firmware
|
||||
//
|
||||
// asdf_keymap_sol.c
|
||||
//
|
||||
// Implements the keymap definition and setup routines for the sol-20 keymap
|
||||
//
|
||||
// Copyright 2019 David Fenyes
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation, either version 3 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
|
||||
static const FLASH asdf_keycode_t sol_plain_map[ASDF_SOL_NUM_ROWS][ASDF_SOL_NUM_COLS] = {
|
||||
[0] = { ACTION_CTRL, SOL_KBD_SHIFTLOCK_ACTION, 'a', 's', 'd', 'f', 'g', 'h' },
|
||||
[1] = { 'j', 'k', 'l', ';', ':', ASCII_DEL, ACTION_REPEAT, ACTION_CTRL },
|
||||
[2] = { ACTION_CAPS, ACTION_SHIFT, 'z', 'x', 'c', 'v', 'b', 'n' },
|
||||
[3] = { 'm', ASCII_COMMA, ASCII_PERIOD, '/', ACTION_SHIFT, SOL_ASCII_MODE_SELECT, ACTION_NOTHING,
|
||||
ACTION_NOTHING },
|
||||
[4] = { ASCII_ESC, '1', '2', '3', '4', '5', '6', '7' },
|
||||
[5] = { '8', '9', ASCII_ZERO, '-', '^', ASCII_LT_SQUARE_BRACE, ASCII_BACKSLASH,
|
||||
ASCII_RT_SQUARE_BRACE },
|
||||
[6] = { SOL_KBD_BREAK_ACTION, ASCII_TAB, 'q', 'w', 'e', 'r', 't', 'y' },
|
||||
[7] = { 'u', 'i', 'o', 'p', ASCII_AT, ASCII_CR, ASCII_LF, SOL_ASCII_LOAD },
|
||||
[9] = { SOL_KBD_LOCAL_ACTION, SOL_ASCII_UP_ARROW, SOL_ASCII_LT_ARROW, ASCII_SPACE,
|
||||
SOL_ASCII_RT_ARROW, SOL_ASCII_DN_ARROW, SOL_ASCII_HOME, SOL_ASCII_CLEAR },
|
||||
[10] = { '-', '7', '*', '8', '/', '9', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[11] = { '4', '1', '5', '2', '6', '3', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[12] = { '0', ASCII_PERIOD, '+', ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING,
|
||||
ACTION_NOTHING },
|
||||
ASDF_SOL_DIP_SWITCHES,
|
||||
};
|
||||
|
||||
static const FLASH asdf_keycode_t sol_caps_map[ASDF_SOL_NUM_ROWS][ASDF_SOL_NUM_COLS] = {
|
||||
[0] = { ACTION_CTRL, SOL_KBD_SHIFTLOCK_ACTION, 'A', 'S', 'D', 'F', 'G', 'H' },
|
||||
[1] = { 'J', 'K', 'L', ';', ':', ASCII_DEL, ACTION_REPEAT, ACTION_CTRL },
|
||||
[2] = { ACTION_CAPS, ACTION_SHIFT, 'Z', 'X', 'C', 'V', 'B', 'N' },
|
||||
[3] = { 'M', ASCII_COMMA, ASCII_PERIOD, '/', ACTION_SHIFT, SOL_ASCII_MODE_SELECT, ACTION_NOTHING,
|
||||
ACTION_NOTHING },
|
||||
[4] = { ASCII_ESC, '1', '2', '3', '4', '5', '6', '7' }, /**/
|
||||
[5] = { '8', '9', ASCII_ZERO, '-', '^', ASCII_LT_SQUARE_BRACE, ASCII_BACKSLASH,
|
||||
ASCII_RT_SQUARE_BRACE },
|
||||
[6] = { SOL_KBD_BREAK_ACTION, ASCII_TAB, 'Q', 'W', 'E', 'R', 'T', 'Y' },
|
||||
[7] = { 'U', 'I', 'O', 'P', ASCII_AT, ASCII_CR, ASCII_LF, SOL_ASCII_LOAD },
|
||||
[9] = { SOL_KBD_LOCAL_ACTION, SOL_ASCII_UP_ARROW, SOL_ASCII_LT_ARROW, ASCII_SPACE,
|
||||
SOL_ASCII_RT_ARROW, SOL_ASCII_DN_ARROW, SOL_ASCII_HOME, SOL_ASCII_CLEAR },
|
||||
[10] = { '-', '7', '*', '8', '/', '9', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[11] = { '4', '1', '5', '2', '6', '3', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[12] = { '0', ASCII_PERIOD, '+', ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING,
|
||||
ACTION_NOTHING },
|
||||
ASDF_SOL_DIP_SWITCHES,
|
||||
};
|
||||
|
||||
|
||||
static const FLASH asdf_keycode_t sol_shift_map[ASDF_SOL_NUM_ROWS][ASDF_SOL_NUM_COLS] = {
|
||||
[0] = { ACTION_CTRL, SOL_KBD_SHIFTLOCK_ACTION, 'A', 'S', 'D', 'F', 'G', 'H' },
|
||||
[1] = { 'J', 'K', 'L', ';', ':', ASCII_UNDERSCORE, ACTION_REPEAT, ACTION_CTRL },
|
||||
[2] = { ACTION_CAPS, ACTION_SHIFT, 'Z', 'X', 'C', 'V', 'B', 'N' },
|
||||
[3] = { 'M', '<', '>', '?', ACTION_SHIFT, SOL_ASCII_MODE_SELECT, ACTION_NOTHING, ACTION_NOTHING },
|
||||
[4] = { ASCII_ESC, '!', ASCII_DOUBLE_QUOTE, '#', '$', '%', '&', ASCII_SINGLE_QUOTE },
|
||||
[5] = { ASCII_LT_PAREN, ASCII_RT_PAREN, ASCII_SPACE, '=', ASCII_TILDE, ASCII_LT_SQUARE_BRACE,
|
||||
ASCII_BACKSLASH, ASCII_RT_SQUARE_BRACE },
|
||||
[6] = { SOL_KBD_BREAK_ACTION, ASCII_TAB, 'Q', 'W', 'E', 'R', 'T', 'Y' },
|
||||
[7] = { 'U', 'I', 'O', 'P', ASCII_GRAVE_ACCENT, ASCII_CR, ASCII_LF, SOL_ASCII_LOAD },
|
||||
[9] = { SOL_KBD_LOCAL_ACTION, SOL_ASCII_UP_ARROW, SOL_ASCII_LT_ARROW, ASCII_SPACE,
|
||||
SOL_ASCII_RT_ARROW, SOL_ASCII_DN_ARROW, SOL_ASCII_HOME, SOL_ASCII_CLEAR },
|
||||
[10] = { '-', '7', '*', '8', '/', '9', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[11] = { '4', '1', '5', '2', '6', '3', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[12] = { '0', ASCII_PERIOD, '+', ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING,
|
||||
ACTION_NOTHING },
|
||||
ASDF_SOL_DIP_SWITCHES,
|
||||
};
|
||||
|
||||
|
||||
static const FLASH asdf_keycode_t sol_ctrl_map[ASDF_SOL_NUM_ROWS][ASDF_SOL_NUM_COLS] = {
|
||||
[0] = { ACTION_CTRL, SOL_KBD_SHIFTLOCK_ACTION, ASCII_CTRL_A, ASCII_CTRL_S, ASCII_CTRL_D,
|
||||
ASCII_CTRL_F, ASCII_CTRL_G, ASCII_CTRL_H },
|
||||
[1] = { ASCII_CTRL_J, ASCII_CTRL_K, ASCII_CTRL_L, ASCII_VT, ASCII_LF, ASCII_DEL,
|
||||
SOL_KBD_RESET_ACTION, ACTION_CTRL },
|
||||
[2] = { ACTION_CAPS, ACTION_SHIFT, ASCII_CTRL_Z, ASCII_CTRL_X, ASCII_CTRL_C, ASCII_CTRL_V,
|
||||
ASCII_CTRL_B, ASCII_CTRL_N },
|
||||
[3] = { ASCII_CTRL_M, ASCII_FF, ASCII_SO, ASCII_SI, ACTION_SHIFT, SOL_ASCII_MODE_SELECT,
|
||||
ACTION_NOTHING, ACTION_NOTHING },
|
||||
[4] = { ASCII_ESC, ASCII_SOH, ASCII_STX, ASCII_ETX, ASCII_EOT, ASCII_ENQ, ASCII_ACK, ASCII_BEL },
|
||||
[5] = { ASCII_BS, ASCII_TAB, ASCII_NULL, ASCII_CR, ASCII_RS, ASCII_ESC, ASCII_FS, ASCII_GS },
|
||||
[6] = { SOL_KBD_BREAK_ACTION, ASCII_TAB, ASCII_CTRL_Q, ASCII_CTRL_W, ASCII_CTRL_E, ASCII_CTRL_R,
|
||||
ASCII_CTRL_T, ASCII_CTRL_Y },
|
||||
[7] = { ASCII_CTRL_U, ASCII_CTRL_I, ASCII_CTRL_O, ASCII_CTRL_P, ASCII_NULL, ASCII_CR, ASCII_LF,
|
||||
SOL_ASCII_LOAD },
|
||||
[9] = { SOL_KBD_LOCAL_ACTION, SOL_ASCII_UP_ARROW, SOL_ASCII_LT_ARROW, ASCII_SPACE,
|
||||
SOL_ASCII_RT_ARROW, SOL_ASCII_DN_ARROW, SOL_ASCII_HOME, SOL_ASCII_CLEAR },
|
||||
[10] = { '-', '7', '*', '8', '/', '9', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[11] = { '4', '1', '5', '2', '6', '3', ACTION_NOTHING, ACTION_NOTHING },
|
||||
[12] = { '0', ASCII_PERIOD, '+', ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING, ACTION_NOTHING,
|
||||
ACTION_NOTHING },
|
||||
ASDF_SOL_DIP_SWITCHES,
|
||||
};
|
||||
|
||||
|
||||
// PROCEDURE: sol_add_map
|
||||
// INPUTS: asdf_keycode_t (*matrix) - a SOL_NUM_ROWS x SOL_NUM_COLS matrix of keycodes for each physical row/column pair
|
||||
// modifier_index_t modifier index - the modifier state corresponding to the keycode matrix
|
||||
// OUTPUTS: none
|
||||
// DESCRIPTION: Passes the keycode matrix and modifier state through to
|
||||
// asdf_keymaps_add_map(), along with the row/column dimensions.
|
||||
//
|
||||
// SIDE EFFECTS: the matrix is added to the keymap
|
||||
//
|
||||
// SCOPE: private
|
||||
//
|
||||
// COMPLEXITY: 1
|
||||
//
|
||||
static void sol_add_map(const asdf_keycode_t (*matrix)[SOL_NUM_COLS],
|
||||
modifier_index_t modifier_index)
|
||||
{
|
||||
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) SOL_NUM_ROWS,
|
||||
(uint8_t) SOL_NUM_COLS);
|
||||
}
|
||||
|
||||
|
||||
void setup_sol_keymap(void)
|
||||
{
|
||||
sol_add_map(sol_plain_map, MOD_PLAIN_MAP);
|
||||
sol_add_map(sol_caps_map, MOD_CAPS_MAP);
|
||||
sol_add_map(sol_shift_map, MOD_SHIFT_MAP);
|
||||
sol_add_map(sol_ctrl_map, MOD_CTRL_MAP);
|
||||
|
||||
asdf_virtual_init();
|
||||
|
||||
// Set up the ALL CAPS LED, default = off
|
||||
asdf_virtual_assign(VCAPS_LED, SOL_KBD_LED_UPPERCASE, V_NOFUNC, SOL_KBD_LED_OFF);
|
||||
|
||||
// Set up the SHIFT LED, default = off
|
||||
asdf_virtual_assign(VSHIFT_LED, SOL_KBD_LED_SHIFTLOCK, V_NOFUNC, SOL_KBD_LED_OFF);
|
||||
|
||||
// Set up the LOCAL LED and output, default LED=OFF, TTL output HIGH. Both LED
|
||||
// and TTL out are bound to the save virtual device.
|
||||
asdf_virtual_assign(SOL_KBD_VLOCAL, SOL_KBD_TTLOUT_LOCAL, V_TOGGLE, SOL_KBD_TTL_HIGH);
|
||||
asdf_virtual_assign(SOL_KBD_VLOCAL, SOL_KBD_LED_LOCAL, V_TOGGLE, SOL_KBD_LED_OFF);
|
||||
|
||||
// Set up the RESET output, produce a short pulse when activated. Default output HIGH
|
||||
asdf_virtual_assign(SOL_KBD_VRESET, SOL_KBD_TTLOUT_RESET, V_PULSE_SHORT, SOL_KBD_TTL_HIGH);
|
||||
|
||||
// Set up the BREAK output, produce a long pulse when activated, default output high
|
||||
asdf_virtual_assign(SOL_KBD_VBREAK, V_PULSE_LONG, SOL_KBD_TTL_HIGH);
|
||||
|
||||
|
||||
// Activate the ALL CAPS mode to emulate the original keyboard:
|
||||
asdf_modifier_capslock_activate();
|
||||
|
||||
// Configure negative strobe
|
||||
asdf_arch_set_neg_strobe();
|
||||
}
|
||||
|
||||
|
||||
//-------|---------|---------+---------+---------+---------+---------+---------+
|
||||
// Above line is 80 columns, and should display completely in the editor.
|
Loading…
Reference in New Issue
Block a user