Cleanups for new map scheme

- update ARCHITECTURE-keymaps.org file for new keymap definition method
- remove unused keymap table template files
- in keymap_setup.c template, set default to keymap 0.
This commit is contained in:
Dave 2021-12-01 15:56:25 -06:00
parent 9c0e9a9326
commit 7796b7f753
4 changed files with 14 additions and 128 deletions

View File

@ -1,15 +1,14 @@
* Keymap architecture * Keymap architecture
** Keymap definition module ** Keymap definition modules are in src/Keymaps
The keymap definition module defines: ** Each keymap has its own keymap setup routine
*** The key mappings used by a keymap *** void setup_mapname_keymap(void) - keymap setup function
*** The virtual devices required by the keymap **** register a keycode map for each modifier combination
This includes definitions for LED's and I/O lines, including their initial ***** The keycode maps are in flash (ROM)
states, and default I/O operations such as toggle, pulse, etc. **** set up virtual devices for the keymap
*** Function hooks used by the keymap. ***** virtual device to physical device mapping
Specifies which functions are used for operations such as key scanning, I/O, ***** associated virtual device function on activate/deactivate
special keybindings, etc. ***** initial state
**** set up function hooks used by keymap
Any special functions or logic required by the keymap are also defined and used in the module.
** Keymap definition API ** Keymap definition API
*** mapping keys *** mapping keys
@ -24,12 +23,6 @@
***** Accept a virtual device code, a physical device code, a default function, and a default initial value, and create a new entry in the virtual device table. ***** Accept a virtual device code, a physical device code, a default function, and a default initial value, and create a new entry in the virtual device table.
***** increment the virtual device table pointer and set next (last) entry to NULL ***** increment the virtual device table pointer and set next (last) entry to NULL
* Eliminate keymaps table and instead have table of keymap init routines with MAX_KEYMAPS entries
* keymap setup routine adds maps for each modifier to the keymap, now only rxcxMODIFIERS instead of rxcxmodifiersxkeymaps
* remove the keymap index from the add_map() call.
* select_keymap() will call setup routine for the g
iven keymap.
* Each keymap sets its own num_rows and num_columns, per matrix for each modifier
* DIP SWITCHES * DIP SWITCHES
Note that the DIP switches are keys in the key matrix, which is initialized to Note that the DIP switches are keys in the key matrix, which is initialized to

View File

@ -51,9 +51,7 @@
// //
void asdf_keymap_setup(uint8_t index) { void asdf_keymap_setup(uint8_t index) {
switch(index) { switch(index) {
@keymap_table@ default: @keymap_table@
default:
break;
} }
} }
@ -76,12 +74,12 @@ void asdf_keymap_setup(uint8_t index) {
uint8_t asdf_keymap_valid(uint8_t index) { uint8_t asdf_keymap_valid(uint8_t index) {
uint8_t valid = 0; uint8_t valid = 0;
switch(index) { switch(index) { @keymap_valid@
@keymap_valid@ valid = 1;
valid= 1;
break; break;
default: default:
valid = 0;
break; break;
} }

View File

@ -1,63 +0,0 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_table.c
//
// initialize keymap setup function table
//
// *** AUTO-generated file. DO NOT EDIT. ***
// *** To modify template, edit $ROOT/src/Keymaps/asdf_keymap_table.c.in ***
// *** To modify keymap list, edit $ROOT/keymap_list.cmake
//
// 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 <stdint.h>
@keymap_declarations@
// PROCEDURE: asdf_keymap_setup
//
// INPUTS: (uint8_t) index - index of the keymap setup function to call
// OUTPUTS: none
////
// DESCRIPTION: This function calls the keymap setup function specified
// by the index.
//
// 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_setup(uint8_t index) {
switch(index) {
@keymap_table@
default:
break;
}
};
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -1,42 +0,0 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_table.c
//
// initialize keymap setup function table
//
// *** AUTO-generated file. DO NOT EDIT. ***
// *** To modify template, edit $ROOT/src/Keymaps/asdf_keymap_table.c.in ***
// *** To modify keymap list, edit $ROOT/keymap_list.cmake
//
// 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/>.
//
#define ASDF_NUM_KEYMAPS @num_keymaps@
// PROCEDURE: asdf_keymap_setup
// INPUTS: (uint8_t) index - index of the keymap setup function to call
// OUTPUTS: none
// DESCRIPTION: This function calls the keymap setup function specified
// by the index.
// SIDE EFFECTS: See Description
void asdf_keymap_setup(uint8_t index);
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.