firmware now compiles without errors

test suite passes
have not yet tested firmware
This commit is contained in:
Dave 2021-05-19 13:32:23 -05:00
parent 1f2f420de0
commit 63805800af
23 changed files with 122 additions and 791 deletions

View File

@ -42,6 +42,10 @@ else()
if((ARCH MATCHES atmega328p) OR (ARCH MATCHES atmega2560))
set (ASDF_EXECUTABLE_TARGET_NAME ${ASDF_TARGET_NAME}.elf)
function(custom_add_library EXECUTABLE_NAME)
add_avr_library(${EXECUTABLE_NAME} ${ARGN})
endfunction(custom_add_library)
function(custom_add_executable EXECUTABLE_NAME)
add_avr_executable(${EXECUTABLE_NAME} ${ARGN})
endfunction(custom_add_executable)

View File

@ -1,8 +1,8 @@
list(APPEND keymap_list
"<classic:0>"
"<classic_caps:1>"
"<apple2:2>"
"<apple2_caps:3>"
# "<apple2:2>"
# "<apple2_caps:3>"
"<sol:4>"
)

View File

@ -39,6 +39,7 @@
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdint.h>
#include "asdf.h"
#include "asdf_config.h"
static volatile uint8_t tick = 0;
@ -752,7 +753,8 @@ asdf_cols_t asdf_arch_read_row(uint8_t row)
asdf_cols_t cols = 0;
// first, output the new row value:
ASDF_ROW_PORT = (ASDF_ROW_PORT & ~ASDF_ROW_MASK) | ((row & ASDF_ROW_MASK) << ASDF_ROW_OFFSET);
ASDF_ROW_PORT = (ASDF_ROW_PORT & ~ASDF_ROW_MASK)
| ((row & ASDF_ROW_MASK) << ASDF_ROW_OFFSET);
// read in the columns. Set LOAD mode and pulse clock.
@ -767,7 +769,7 @@ asdf_cols_t asdf_arch_read_row(uint8_t row)
// After the load operation, the LSB is already at the output pin, so there
// will be one fewer read than clock pulse. Continue reading the bits until
// the leader bit is in the boundary position.
for (uint8_t i = 0; i < ASDF_NUM_COLS; i++) {
for (uint8_t i = 0; i < ASDF_MAX_COLS; i++) {
// invert the bits as they are read (see note 1)
cols |= (((~(ASDF_COL_PIN) >> ASDF_COL_BIT) & 1) << i);

View File

@ -1,11 +1,21 @@
message("C compiler: ${CMAKE_C_COMPILER}")
function(create_keymap_setups keymaps keymap_table)
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\n [\\2] = setup_\\1_keymap" OUTPUT_VARIABLE temp_list)
string(REPLACE ";" "," temp_list2 "${temp_list}")
set(${keymap_table} "${temp_list2}" PARENT_SCOPE)
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\n keymap_setup_function_lookup_table[\\2] = setup_\\1_keymap" OUTPUT_VARIABLE temp_list)
# we can keep the ';' cmake list separators as the C statement separators.
# However, we need to append an extra ';' at the end.
string(APPEND temp_list ";")
set(${keymap_table} "${temp_list}" PARENT_SCOPE)
endfunction(create_keymap_setups)
function(create_keymap_declarations keymaps keymap_decl)
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\nextern asdf_keymap_setup_function_t setup_\\1_keymap" OUTPUT_VARIABLE temp_list)
# we can keep the ';' cmake list separators as the C statement separators.
# However, we need to append an extra ';' at the end.
string(APPEND temp_list ";")
set(${keymap_decl} "${temp_list}" PARENT_SCOPE)
endfunction(create_keymap_declarations)
function(create_keymap_report keymaps keymap_report)
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\nkeymap [\\2]: \\1" OUTPUT_VARIABLE temp_list)
string(REPLACE ";" "" temp_list2 "${temp_list}")
@ -16,6 +26,7 @@ include(../keymap_list.cmake)
create_keymap_setups("${keymap_list}" keymap_table)
create_keymap_report("${keymap_list}" keymap_report)
create_keymap_declarations("${keymap_list}" keymap_declarations)
# get list length and decrement by one to account for trailing semicolon
list (LENGTH keymap_list num_keymaps)
@ -24,6 +35,7 @@ message("**********************")
message("Keymap table: ${keymap_report}")
message("**********************\n\n")
set (ASDF_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
configure_file(${ASDF_SRC_DIR}/Arch/asdf_arch_${ARCH}.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.h COPYONLY)
configure_file(${ASDF_SRC_DIR}/Arch/asdf_arch_${ARCH}.c ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.c COPYONLY)
@ -60,6 +72,7 @@ list(APPEND C_FLAGS
list (APPEND SOURCES
asdf.c
${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.c
${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_table.c
asdf_buffer.c
asdf_hook.c
asdf_keymap_table.c
@ -80,7 +93,9 @@ if (COMMAND custom_add_executable)
${SOURCES}
)
else()
add_executable(${ASDF_TARGET_NAME})
add_executable(${ASDF_TARGET_NAME}
${SOURCES}
)
endif()
target_include_directories(${ASDF_EXECUTABLE_TARGET_NAME}

View File

@ -1,73 +0,0 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_defs.h
//
// gathers up all the keymap definitions to be included in the firmware.
//
// 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/>.
// While there is nothing preventing a standard keyboard from having both a
// "Shift Lock" key and a "Caps Lock" key, usually only one will be present. For
// testing, both must be present to test their functionality.
#if !defined(ASDF_KEYMAP_DEFS_H)
#define ASDF_KEYMAP_DEFS_H
#include "asdf.h"
#include "asdf_arch.h"
#include "asdf_ascii.h"
#include "asdf_physical.h"
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "Keymaps/asdf_keymap_defs_ascii.h"
#include "Keymaps/asdf_keymap_defs_apple2.h"
#include "Keymaps/asdf_keymap_defs_sol.h"
#define ASDF_NUM_KEYMAPS \
(ASDF_ASCII_ALL_MAPS_COUNT + ASDF_APPLE2_ALL_MAPS_COUNT + ASDF_SOL_ALL_MAPS_COUNT)
#define ASDF_KEYMAP_DEFS \
{ \
ASDF_ASCII_ALL_MAPS, ASDF_APPLE2_ALL_MAPS, ASDF_SOL_ALL_MAPS \
}
#define ASDF_KEYMAP_DECLARATIONS \
ASDF_ASCII_MAP_DECLARATIONS ASDF_APPLE2_MAP_DECLARATIONS ASDF_SOL_MAP_DECLARATIONS
#define ASDF_KEYMAP_INITIALIZERS \
{ \
ASDF_ASCII_KEYMAP_INITIALIZER, ASDF_APPLE2_KEYMAP_INITIALIZER, ASDF_SOL_KEYMAP_INITIALIZER \
}
#define ASDF_KEYMAP_HOOK_INITIALIZERS \
{ \
ASDF_ASCII_KEYMAP_HOOK_INITIALIZER, ASDF_APPLE2_KEYMAP_HOOK_INITIALIZER, \
ASDF_SOL_KEYMAP_HOOK_INITIALIZER \
}
typedef asdf_keycode_t keycode_matrix_t[ASDF_NUM_ROWS][ASDF_NUM_COLS];
typedef asdf_keycode_t keycode_matrix_t[ASDF_NUM_ROWS][ASDF_NUM_COLS];
#endif /* !defined (ASDF_KEYMAP_DEFS_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -1,68 +0,0 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_defs.h
//
// gathers up all the keymap definitions to be included in the firmware.
//
// 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/>.
// While there is nothing preventing a standard keyboard from having both a
// "Shift Lock" key and a "Caps Lock" key, usually only one will be present. For
// testing, both must be present to test their functionality.
#if !defined(ASDF_KEYMAP_DEFS_H)
#define ASDF_KEYMAP_DEFS_H
#include "asdf.h"
#include "test_asdf_lib.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "Keymaps/asdf_keymap_defs_test.h"
#include "Keymaps/asdf_keymap_defs_test2.h"
#define ASDF_TEST_BASE 0
#define ASDF_TEST2_BASE (ASDF_TEST_BASE + ASDF_TEST_KEYMAPS_COUNT)
#define ASDF_NUM_KEYMAPS (ASDF_TEST_BASE + ASDF_TEST_KEYMAPS_COUNT + ASDF_TEST2_KEYMAPS_COUNT)
#define ASDF_KEYMAP_DEFS \
{ \
ASDF_TEST_KEYMAPS, ASDF_TEST2_KEYMAPS \
}
#define ASDF_KEYMAP_DECLARATIONS ASDF_TEST_DECLARATIONS ASDF_TEST2_DECLARATIONS
#define ASDF_KEYMAP_INITIALIZERS \
{ \
ASDF_TEST_KEYMAP_INITIALIZER, ASDF_TEST2_KEYMAP_INITIALIZER \
}
#define ASDF_KEYMAP_HOOK_INITIALIZERS \
{ \
ASDF_TEST_KEYMAP_HOOK_INITIALIZER, ASDF_TEST2_KEYMAP_HOOK_INITIALIZER \
}
typedef asdf_keycode_t keycode_matrix_t[ASDF_NUM_ROWS][ASDF_NUM_COLS];
#endif /* !defined (ASDF_KEYMAP_DEFS_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -23,6 +23,8 @@
// this program. If not, see <https://www.gnu.org/licenses/>.
//
#include "asdf_keymaps.h"
#include "asdf_virtual.h"
#include "asdf_keymap_classic.h"
#include "asdf_keymap_classic_add_map.h"
@ -65,31 +67,6 @@ void setup_classic_keymap(void)
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.

View File

@ -37,8 +37,8 @@
// 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_NUM_ROWS 9 // DIP switches are row 8 (zero based)
#define CLASSIC_NUM_COLS 8
#define CLASSIC_ACTION_BREAK ACTION_NOTHING
@ -59,9 +59,6 @@
#define CLASSIC_CAPS_LED PHYSICAL_LED3
#define CLASSIC_CAPS_LED_INIT_VALUE 0
void classic_add_map(const asdf_keycode_t (*matrix)[CLASSIC_NUM_COLS],modifier_index_t);
#endif /* !defined (ASDF_KEYMAP_DEFS_ASCII_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+

View File

@ -23,7 +23,12 @@
// this program. If not, see <https://www.gnu.org/licenses/>.
//
#include "asdf_arch.h"
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_classic.h"
#include "asdf_keymap_classic_add_map.h"
// Key Matrix for combination of ASCII controller and Classic ASCII matrix
//
@ -58,11 +63,15 @@
#define ASDF_CLASSIC_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
const FLASH keycode_matrix_t ascii_plain_matrix = {
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, CLASSIC_ESC, ASCII_TAB,
typedef asdf_keycode_t classic_keycode_matrix_t[CLASSIC_NUM_ROWS][CLASSIC_NUM_COLS];
const FLASH classic_keycode_matrix_t classic_plain_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' },
[2] = { CLASSIC_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 },
@ -72,11 +81,11 @@ const FLASH keycode_matrix_t ascii_plain_matrix = {
ASDF_CLASSIC_DIP_SWITCHES
};
const FLASH keycode_matrix_t ascii_shift_matrix = {
const FLASH classic_keycode_matrix_t classic_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' },
[2] = { CLASSIC_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', '>' },
@ -86,11 +95,11 @@ const FLASH keycode_matrix_t ascii_shift_matrix = {
ASDF_CLASSIC_DIP_SWITCHES
};
const FLASH keycode_matrix_t ascii_caps_matrix = {
const FLASH classic_keycode_matrix_t classic_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' },
[2] = { CLASSIC_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 },
@ -100,12 +109,12 @@ const FLASH keycode_matrix_t ascii_caps_matrix = {
ASDF_CLASSIC_DIP_SWITCHES
};
const FLASH keycode_matrix_t ascii_ctrl_matrix = {
const FLASH classic_keycode_matrix_t classic_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,
[2] = { CLASSIC_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 },
@ -122,19 +131,19 @@ const FLASH keycode_matrix_t ascii_ctrl_matrix = {
static keycode_matrix_t *classic_maps[] = {
[CLASSIC_CAPS_MAP] = classic_caps_matrix,
[CLASSIC_PLAIN_MAP] = classic_plain_matrix,
[CLASSIC_SHIFT_MAP] = classic_shift_matrix,
[CLASSIC_CTRL_MAP] = classic_ctrl_matrix,
}
static const classic_keycode_matrix_t *classic_maps[] = {
[CLASSIC_CAPS_MAP] = &classic_caps_matrix,
[CLASSIC_PLAIN_MAP] = &classic_plain_matrix,
[CLASSIC_SHIFT_MAP] = &classic_shift_matrix,
[CLASSIC_CTRL_MAP] = &classic_ctrl_matrix,
};
void classic_add_map(const classic_maps_index_t map_index,
void classic_add_map(const classic_map_index_t map_index,
modifier_index_t modifier_index)
{
asdf_keycode_t (*matrix)[CLASSIC_NUM_COLS] =
classic_maps[map_index];
(asdf_keycode_t (*)[CLASSIC_NUM_COLS]) classic_maps[map_index];
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) CLASSIC_NUM_ROWS,
(uint8_t) CLASSIC_NUM_COLS);

View File

@ -31,6 +31,7 @@
#if !defined(ASDF_KEYMAP_CLASSIC_ADD_MAP_H)
#define ASDF_KEYMAP_CLASSIC_ADD_MAP_H
#include "asdf_modifiers.h"
typedef enum {
CLASSIC_PLAIN_MAP,
@ -43,7 +44,6 @@ typedef enum {
// function prototypes
void classic_add_map(const classic_map_index_t map_index, modifier_index_t modifier_index);
#endif /* !defined (ASDF_KEYMAP_CLASSIC_ADD_MAP_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+

View File

@ -23,6 +23,8 @@
// this program. If not, see <https://www.gnu.org/licenses/>.
//
#include "asdf_keymaps.h"
#include "asdf_virtual.h"
#include "asdf_keymap_classic.h"
#include "asdf_keymap_classic_add_map.h"

View File

@ -1,278 +0,0 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymaps_ascii.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_ASCII_H)
#define ASDF_KEYMAP_DEFS_ASCII_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_ASCII_NUM_ROWS 9 // DIP switches are row 8 (zero based)
#define ASDF_ASCII_NUM_COLS 8
#define ASCII_ACTION_BREAK ACTION_NOTHING
#define ASCII_VIRTUAL_RESET VOUT1
#define ASCII_ACTION_RESET ACTION_VOUT1
#define ASCII_RESET_OUTPUT PHYSICAL_OUT3_OPEN_HI
#define ASCII_RESET_ACTIVE_VALUE 0
#define ASCII_VIRTUAL_CLR_SCR VOUT2
#define ASCII_ACTION_CLEAR ACTION_VOUT2
#define ASCII_CLR_SCR_OUT PHYSICAL_OUT1_OPEN_LO
#define ASCII_CLR_SCR_ACTIVE_VALUE 1
#define ASCII_VIRTUAL_POWER_LED VLED1
#define ASCII_POWER_LED PHYSICAL_LED1
#define ASCII_POWER_LED_INIT_VALUE 1
#define ASCII_CAPS_LED PHYSICAL_LED3
#define ASCII_CAPS_LED_INIT_VALUE 0
#define ASDF_ASCII_KEYMAP_INITIALIZER_LENGTH 4
#define ASDF_ASCII_PLAIN_KEYMAP_INITIALIZER \
{ \
{ .virtual_device = ASCII_VIRTUAL_POWER_LED, \
.physical_device = ASCII_POWER_LED, \
.initial_value = ASCII_POWER_LED_INIT_VALUE }, \
{ .virtual_device = VCAPS_LED, \
.physical_device = ASCII_CAPS_LED, \
.initial_value = ASCII_CAPS_LED_INIT_VALUE }, \
{ .virtual_device = ASCII_VIRTUAL_RESET, \
.physical_device = ASCII_RESET_OUTPUT, \
.function = V_PULSE_SHORT, \
.initial_value = !ASCII_RESET_ACTIVE_VALUE }, \
{ .virtual_device = ASCII_VIRTUAL_CLR_SCR, \
.physical_device = ASCII_CLR_SCR_OUT, \
.function = V_PULSE_LONG, \
.initial_value = !ASCII_CLR_SCR_ACTIVE_VALUE }, \
}
// For the CAPS map, no LED is mapped to the CapsLock virtual LED, since
// Capslock has no observable effect. The LED on the CAPSLOCK key is mapped to
// an unused LED output, initialized to OFF, to ensure the LED is dark.
#define ASDF_ASCII_CAPS_KEYMAP_INITIALIZER \
{ \
{ .virtual_device = ASCII_VIRTUAL_POWER_LED, \
.physical_device = ASCII_POWER_LED, \
.initial_value = ASCII_POWER_LED_INIT_VALUE }, \
{ .virtual_device = VLED1, \
.physical_device = ASCII_CAPS_LED, \
.initial_value = ASCII_CAPS_LED_INIT_VALUE }, \
{ .virtual_device = ASCII_VIRTUAL_RESET, \
.physical_device = ASCII_RESET_OUTPUT, \
.function = V_PULSE_SHORT, \
.initial_value = !ASCII_RESET_ACTIVE_VALUE }, \
{ .virtual_device = ASCII_VIRTUAL_CLR_SCR, \
.physical_device = ASCII_CLR_SCR_OUT, \
.function = V_PULSE_LONG, \
.initial_value = !ASCII_CLR_SCR_ACTIVE_VALUE }, \
}
#define ASDF_ASCII_KEYMAP_INITIALIZER \
ASDF_ASCII_PLAIN_KEYMAP_INITIALIZER, ASDF_ASCII_CAPS_KEYMAP_INITIALIZER
// Structure to initialize hooks. No hook functions are needed for ASCII keyboard.
#define ASDF_ASCII_KEYMAP_HOOK_INITIALIZER_LENGTH 0
#define ASDF_ASCII_PLAIN_KEYMAP_HOOK_INITIALIZER \
{ \
}
#define ASDF_ASCII_CAPS_KEYMAP_HOOK_INITIALIZER \
{ \
}
#define ASDF_ASCII_KEYMAP_HOOK_INITIALIZER \
ASDF_ASCII_PLAIN_KEYMAP_HOOK_INITIALIZER, ASDF_ASCII_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_ASCII_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
// clang-format off
#define ASDF_ASCII_PLAIN_MAP \
{ \
[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_ASCII_DIP_SWITCHES \
}
#define ASDF_ASCII_CAPS_MAP \
{ \
[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_ASCII_DIP_SWITCHES \
}
#define ASDF_ASCII_SHIFT_MAP \
{ \
[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_ASCII_DIP_SWITCHES \
}
#define ASDF_ASCII_CTRL_MAP \
{ \
[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_ASCII_DIP_SWITCHES \
}
// clang-format on
#define ASDF_ASCII_MAP_DECLARATIONS \
static const FLASH keycode_matrix_t ascii_plain_matrix = ASDF_ASCII_PLAIN_MAP; \
static const FLASH keycode_matrix_t ascii_shift_matrix = ASDF_ASCII_SHIFT_MAP; \
static const FLASH keycode_matrix_t ascii_caps_matrix = ASDF_ASCII_CAPS_MAP; \
static const FLASH keycode_matrix_t ascii_ctrl_matrix = ASDF_ASCII_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_ASCII_PLAIN_MAP_DEFS \
{ \
[MOD_PLAIN_MAP] = &ascii_plain_matrix, [MOD_SHIFT_MAP] = &ascii_shift_matrix, \
[MOD_CAPS_MAP] = &ascii_caps_matrix, [MOD_CTRL_MAP] = &ascii_ctrl_matrix \
}
#define ASDF_ASCII_CAPS_MAP_DEFS \
{ \
[MOD_PLAIN_MAP] = &ascii_caps_matrix, [MOD_SHIFT_MAP] = &ascii_shift_matrix, \
[MOD_CAPS_MAP] = &ascii_caps_matrix, [MOD_CTRL_MAP] = &ascii_ctrl_matrix \
}
#define ASDF_ASCII_ALL_MAPS ASDF_ASCII_PLAIN_MAP_DEFS, ASDF_ASCII_CAPS_MAP_DEFS
#define ASDF_ASCII_ALL_MAPS_COUNT 2
#if !defined(ASDF_NUM_ROWS) || (ASDF_NUM_ROWS < ASDF_ASCII_NUM_ROWS)
#undef ASDF_NUM_ROWS
#define ASDF_NUM_ROWS ASDF_ASCII_NUM_ROWS
#endif
#if !defined(ASDF_NUM_COLS) || (ASDF_NUM_COLS < ASDF_ASCII_NUM_COLS)
#undef ASDF_NUM_COLS
#define ASDF_NUM_COLS ASDF_ASCII_NUM_COLS
#endif
#if !defined(ASDF_KEYMAP_INITIALIZER_LENGTH) \
|| (ASDF_KEYMAP_INITIALIZER_LENGTH < ASDF_ASCII_KEYMAP_INITIALIZER_LENGTH)
#undef ASDF_KEYMAP_INITIALIZER_LENGTH
#define ASDF_KEYMAP_INITIALIZER_LENGTH ASDF_ASCII_KEYMAP_INITIALIZER_LENGTH
#endif
#if !defined(ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH) \
|| (ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH < ASDF_ASCII_KEYMAP_HOOK_INITIALIZER_LENGTH)
#undef ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH
#define ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH ASDF_ASCII_KEYMAP_HOOK_INITIALIZER_LENGTH
#endif
#endif /* !defined (ASDF_KEYMAP_DEFS_ASCII_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -1,137 +0,0 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymaps.h
//
// 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/>.
#if !defined(ASDF_KEYMAP_DEFS_H)
#define ASDF_KEYMAP_DEFS_H
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#define ASDF_NUM_ROWS 8
#define ASDF_NUM_COLS 8
#define ASCII_PLAIN_MAP \
{ \
{ ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
{ ASCII_DEL, 'p', ';', '/', ASCII_SPACE, 'z', 'a', 'q' }, \
{ ACTION_BREAK, ASCII_COMMA, 'm', 'n', 'b', 'v', 'c', 'x' }, \
{ ACTION_NOTHING, 'k', 'j', 'h', 'g', 'f', 'd', 's' }, \
{ ACTION_CLEAR, 'i', 'u', 'y', 't', 'r', 'e', 'w' }, { ACTION_REPEAT, \
ACTION_HERE_IS, \
ACTION_CAPS, \
ASCII_CR, \
ASCII_LF, \
'0', \
'l', \
ASCII_PERIOD }, \
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', 'o', '9', '8' }, \
{ \
ASCII_AT, '7', '6', '5', '4', '3', '2', '1' \
} \
}
#define ASCII_CAPS_MAP \
{ \
{ ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
{ ASCII_DEL, 'P', ';', '/', ASCII_SPACE, 'Z', 'A', 'Q' }, \
{ ACTION_BREAK, ASCII_COMMA, 'M', 'N', 'B', 'V', 'C', 'X' }, \
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
{ ACTION_CLEAR, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, { ACTION_REPEAT, \
ACTION_HERE_IS, \
ACTION_CAPS, \
ASCII_CR, \
ASCII_LF, \
'0', \
'L', \
ASCII_PERIOD }, \
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', 'O', '9', '8' }, \
{ \
ASCII_AT, '7', '6', '5', '4', '3', '2', '1' \
} \
}
#define ASCII_SHIFT_MAP \
{ \
{ ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_VERT_BAR }, \
{ ASCII_DEL, 'P', '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' }, \
{ ACTION_BREAK, '<', 'M', 'N', 'B', 'V', 'C', 'X' }, \
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
{ ACTION_CLEAR, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
{ ACTION_REPEAT, ACTION_HERE_IS, ACTION_CAPS, ASCII_CR, ASCII_LF, '0', 'L', '>' }, \
{ ASCII_TILDE, ASCII_RT_CURLY_BRACE, ASCII_LT_CURLY_BRACE, '=', '*', \
'O', ASCII_RT_PAREN, ASCII_LT_PAREN }, \
{ \
ASCII_GRAVE_ACCENT, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' \
} \
}
#define ASCII_CTRL_MAP \
{ \
{ ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, 0x1c }, \
{ ACTION_NOTHING, ASCII_CTRL_P, ACTION_NOTHING, ACTION_NOTHING, \
ASCII_SPACE, ASCII_CTRL_Z, ASCII_CTRL_A, ASCII_CTRL_Q }, \
{ ACTION_RESET /*ctrl-break is RESET*/, \
ASCII_COMMA, \
ASCII_CTRL_M, \
ASCII_CTRL_N, \
ASCII_CTRL_B, \
ASCII_CTRL_V, \
ASCII_CTRL_C, \
ASCII_CTRL_X }, \
{ ACTION_CLEAR, ASCII_CTRL_I, ASCII_CTRL_U, ASCII_CTRL_Y, \
ASCII_CTRL_T, ASCII_CTRL_R, ASCII_CTRL_E, ASCII_CTRL_W }, \
{ ACTION_REPEAT, ACTION_HERE_IS, ACTION_CAPS, ASCII_CR, \
ASCII_LF, ACTION_FN_10, ASCII_CTRL_L, ACTION_NOTHING }, \
{ ACTION_NOTHING, 0x1d, ASCII_ESC, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_CTRL_O, ACTION_FN_9, ACTION_FN_8 }, \
{ \
ACTION_NOTHING, ACTION_FN_7, ACTION_FN_6, ACTION_FN_5, ACTION_FN_4, ACTION_FN_3, \
ACTION_FN_2, ACTION_FN_2 \
} \
}
// PROCEDURE: asdf_keymaps_init
// INPUTS: none
// OUTPUTS: none
// DESCRIPTION: Assigns the keymaps to the indices specified by the modifier
// index, to avoid hard-coding constant index values.
void asdf_keymaps_init(void);
// PROCEDURE: asdf_keymaps_get_code
// INPUTS: row, col: row and column of key that has been pressed
// modifiers_index: index into the keymap array, based on modifier state
// OUTPUTS: returns a key code.
// DESCRIPTION: Given a key row and column, and an index based on modifier
// state, return the appropriate keycode.
asdf_keycode_t asdf_keymaps_get_code(uint8_t row, uint8_t col, uint8_t modifier_index);
#endif /* !defined (ASDF_KEYMAP_DEFS_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -1,166 +0,0 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymaps_template.h
//
// Template file for adding new 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 template 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_TEMPLATE_H)
#define ASDF_KEYMAP_DEFS_TEMPLATE_H
#include "asdf_modifier.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_TEMPLATE_NUM_ROWS 16 // DIP switches are row 15.
#define ASDF_TEMPLATE_NUM_COLS 8
#if !defined(ASDF_NUM_ROWS) || (ASDF_NUM_ROWS < ASDF_TEMPLATE_NUM_ROWS)
#undef ASDF_NUM_ROWS
#define ASDF_NUM_ROWS ASDF_TEMPLATE_NUM_ROWS
#endif
#if !defined(ASDF_NUM_COLS) || (ASDF_NUM_COLS < ASDF_ASCII_NUM_COLS)
#undef ASDF_NUM_COLS
#define ASDF_NUM_COLS ASDF_TEMPLATE_NUM_COLS
#endif
// TO ensure consistent DIP switch operation within the keymap, a
// ASDF_TEMPLATE_DIP_SWITCHES macro is defined. Keeping the ACTION_MAPSEL0-3
// definitions in positions 0-3 ensures consistent map selection among all
// keymaps.
#define ASDF_TEMPLATE_DIP_SWITCHES \
[ASDF_LAST_ROW] = { ACTION_MAPSEL_0, ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3 }
#define ASDF_TEMPLATE_PLAIN_MAP \
{ \
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
[1] = { ASCII_DEL, 'p', ';', '/', ASCII_SPACE, 'z', 'a', 'q' }, \
[2] = { ACTION_BREAK, ASCII_COMMA, 'm', 'n', 'b', 'v', 'c', 'x' }, \
[3] = { ACTION_NOTHING, 'k', 'j', 'h', 'g', 'f', 'd', 's' }, \
[4] = { ACTION_CLEAR, 'i', 'u', 'y', 't', 'r', 'e', 'w' }, \
[5] = { ACTION_REPEAT, ACTION_HERE_IS, 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_TEMPLATE_DIP_SWITCHES \
}
#define ASDF_TEMPLATE_CAPS_MAP \
{ \
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
[1] = { ASCII_DEL, 'P', ';', '/', ASCII_SPACE, 'Z', 'A', 'Q' }, \
[2] = { ACTION_BREAK, ASCII_COMMA, 'M', 'N', 'B', 'V', 'C', 'X' }, \
[3] = { ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
[4] = { ACTION_CLEAR, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
[5] = { ACTION_REPEAT, ACTION_HERE_IS, 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_TEMPLATE_DIP_SWITCHES \
}
#define ASDF_TEMPLATE_SHIFT_MAP \
{ \
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_VERT_BAR }, \
[1] = { ASCII_DEL, 'P', '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' }, \
[2] = { ACTION_BREAK, '<', 'M', 'N', 'B', 'V', 'C', 'X' }, \
[3] = { ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
[4] = { ACTION_CLEAR, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
[5] = { ACTION_REPEAT, ACTION_HERE_IS, 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_TEMPLATE_DIP_SWITCHES \
}
#define ASDF_TEMPLATE_CTRL_MAP \
{ \
[0] = { ACTION_NOTHING, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, 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] = { 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_CLEAR, ASCII_CTRL_I, ASCII_CTRL_U, ASCII_CTRL_Y, \
ASCII_CTRL_T, ASCII_CTRL_R, ASCII_CTRL_E, ASCII_CTRL_W }, \
[5] = { ACTION_REPEAT, ACTION_HERE_IS, 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] = { ACTION_NOTHING, ACTION_FN_7, ACTION_FN_6, ACTION_FN_5, \
ACTION_FN_4, ACTION_FN_3, ACTION_FN_2, ACTION_FN_2 }, \
}, ASDF_TEMPLATE_DIP_SWITCHES \
}
#define ASDF_TEMPLATE_MAP_DECLARATIONS \
static const FLASH keycode_matrix_t template_plain_matrix = ASDF_TEMPLATE_PLAIN_MAP; \
static const FLASH keycode_matrix_t template_shift_matrix = ASDF_TEMPLATE_SHIFT_MAP; \
static const FLASH keycode_matrix_t template_caps_matrix = ASDF_TEMPLATE_CAPS_MAP; \
static const FLASH keycode_matrix_t template_ctrl_matrix = ASDF_TEMPLATE_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_TEMPLATE_PLAIN_MAP_DEFS \
{ \
[MOD_PLAIN_MAP] = &template_plain_matrix, \
[MOD_SHIFT_MAP] = &template_shift_matrix, \
[MOD_CAPS_MAP] = &template_caps_matrix, \
[MOD_CTRL_MAP] = &template_ctrl_matrix \
}
#define ASDF_TEMPLATE_CAPS_MAP_DEFS \
{ \
[MOD_PLAIN_MAP] = &template_caps_matrix, \
[MOD_SHIFT_MAP] = &template_shift_matrix, \
[MOD_CAPS_MAP] = &template_caps_matrix, \
[MOD_CTRL_MAP] = &template_ctrl_matrix \
}
#define ASDF_TEMPLATE_ALL_MAPS ASDF_TEMPLATE_PLAIN_MAP_DEFS, ASDF_TEMPLATE_CAPS_MAP_DEFS
#define ASDF_TEMPLATE_ALL_MAPS_COUNT 2
#endif /* !defined (ASDF_KEYMAP_DEFS_TEMPLATE_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.
P

View File

@ -23,6 +23,12 @@
// this program. If not, see <https://www.gnu.org/licenses/>.
//
#include "asdf_arch.h"
#include "asdf_keymap_sol.h"
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "asdf_keymaps.h"
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' },
@ -123,11 +129,11 @@ static const FLASH asdf_keycode_t sol_ctrl_map[ASDF_SOL_NUM_ROWS][ASDF_SOL_NUM_C
//
// COMPLEXITY: 1
//
static void sol_add_map(const asdf_keycode_t (*matrix)[SOL_NUM_COLS],
static void sol_add_map(const asdf_keycode_t (*matrix)[ASDF_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);
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) ASDF_SOL_NUM_ROWS,
(uint8_t) ASDF_SOL_NUM_COLS);
}
@ -155,7 +161,7 @@ void setup_sol_keymap(void)
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);
asdf_virtual_assign(SOL_KBD_VBREAK, SOL_KBD_TTLOUT_BREAK, V_PULSE_LONG, SOL_KBD_TTL_HIGH);
// Activate the ALL CAPS mode to emulate the original keyboard:

View File

@ -34,8 +34,12 @@
// an action code is not a valid keycode.
#define ASDF_INVALID_CODE ASDF_ACTION
// define ASDF_MAX_COLS to fit in asdf_cols_t
#define ASDF_MAX_COLS 8
#define ASDF_MAX_ROWS 16
// for efficiency on 8-bit machines, use 8 columns per row. For 16 columns per
// row, change cols_t to uint16_t and increase ASDF_NUM_COLS.
// row, change cols_t to uint16_t and increase ASDF_NUM_COLS to 16.
typedef uint8_t asdf_cols_t;
// ASCII keycodes are 7 bits. An 8-bit datatype encodes ASCII, plus a flag for a

View File

@ -29,10 +29,34 @@
#include "asdf_keymap_table.h"
@keymap_declarations@
asdf_keymap_setup_function_t keymap_setup_function_lookup_table[ASDF_NUM_KEYMAPS] = {
asdf_keymap_setup_function_t keymap_setup_function_lookup_table[ASDF_NUM_KEYMAPS];
// PROCEDURE: asdf_keymap_table_init
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: This function populates the keymap_setup_function_lookup_table
// with the various externally defined keymap setup functions, in the order
// specified in the keymap_list.cmake file.
//
// SIDE EFFECTS: See Description
//
// NOTES: This function is necessary because functions defined in external
// modules are not considered compile-time constants by the C99 standard, so the
// array cannot be initialized with a compile-time declaration.
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_keymap_table_init(void) {
@keymap_table@
}
};
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -34,6 +34,18 @@
typedef void (*asdf_keymap_setup_function_t)(void);
// PROCEDURE: asdf_keymap_table_init
// INPUTS: none
// OUTPUTS: none
// DESCRIPTION: This function populates the keymap_setup_function_lookup_table
// with the various externally defined keymap setup functions, in the order
// specified in the keymap_list.cmake file.
// SIDE EFFECTS: See Description
// NOTES: This function is necessary because functions defined in external
// modules are not considered compile-time constants by the C99 standard, so the
// array cannot be initialized with a compile-time declaration.
void asdf_keymap_table_init(void);
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -42,7 +42,6 @@ static asdf_keycode_map_t keymaps[ASDF_MOD_NUM_MODIFIERS] = {};
// keymap-specific function hooks and initial conditions for the keymap.
extern asdf_keymap_setup_function_t keymap_setup_function_lookup_table[ASDF_NUM_KEYMAPS];
// The current keymap index. This is stored so bitwise operators on the keymap index can be performed.
static uint8_t current_keymap_index;
@ -186,7 +185,8 @@ void asdf_keymaps_dummy_function(void) {}
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: initialize the keymap list. Called at startup.
// DESCRIPTION: initialize the keymap list. Called at startup. This function
// calls the auto-generated keymap table init function, then selects keymap 0.
//
// SIDE EFFECTS: See DESCRIPTION
//
@ -196,6 +196,7 @@ void asdf_keymaps_dummy_function(void) {}
//
void asdf_keymaps_init(void)
{
asdf_keymap_table_init();
current_keymap_index = 0;
}

View File

@ -42,9 +42,6 @@
#define ASDF_KEYMAP_BIT_2 4
#define ASDF_KEYMAP_BIT_3 8
#define ASDF_MAX_ROWS 16
#define ASDF_MAX_COLS 8
// define the type for a keymap setup function. Keymaps are registerd by storing
// a keymap setup function in the keymap setup array.
typedef void (*asdf_keymap_setup_function_t)(void);

View File

@ -1,4 +1,3 @@
configure_file(${ASDF_SRC_DIR}/Keymaps/asdf_all_keymap_defs_test.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_defs.h COPYONLY)
configure_file(${ASDF_SRC_DIR}/Arch/asdf_arch_test.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.h COPYONLY)
list(APPEND C_FLAGS

View File

@ -47,6 +47,9 @@ asdf_keymap_setup_function_t keymap_setup_function_lookup_table[ASDF_NUM_KEYMAPS
[ASDF_TEST_EACH_SCAN_MAP] = setup_test_hooks_each_scan,
};
void asdf_keymap_table_init(void) {}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -32,6 +32,7 @@
// a keymap setup function in the keymap setup array.
typedef void (*asdf_keymap_setup_function_t)(void);
void asdf_keymap_table_init(void);
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.