Compare commits

...

139 Commits

Author SHA1 Message Date
Dave cb61d89fbd Merge branch 'mounting-hw' 2023-12-09 09:44:22 -06:00
Dave 150b6de0d8 Update to include mounting hardware
- Fix all components to include full information including BOM
information

- Include all mounting hardware in components List

- fix schematic to align on 0.1" grid.
2023-12-09 09:42:40 -06:00
Dave 3b24e0ea07 Add some mounting hardware 2023-12-04 23:54:05 -06:00
Dave 953b9f7496 Add dipswitches back to Ace keymap 2023-11-27 12:30:14 -06:00
Dave 90ec095f97 True up Franklin 1000 key spacing
- Make sure each 1U is 0.75 inch.
- Record key width for all keys > 1U, and ensure spacing is correct.
- create symbols for the mx keys
2023-11-27 01:14:13 -06:00
David Fenyes 24ffa280bd Update version and some text strings 2023-11-22 10:48:02 -06:00
Dave 7a20f70ce4 OSI Interface: Add special keys to repo. 2023-11-22 09:22:23 -06:00
Dave 506db36ed8 Fixed multiple problems with OSI interface
- off-by-one connections to keyboard connector
- wrong demultiplexing of select signals
- 2OE on 74LS240 was not inverted, resulting in wrong circuit.
- use pre-jumpered row diodes.
- fixed off-grid errors on schematic
2023-11-11 17:51:33 -06:00
Dave ee94c8f531 Merge branch 'franklin-temp' 2023-11-05 16:58:40 -06:00
Dave 5dcf744da5 More key fixes 2023-11-05 16:35:53 -06:00
Dave f0236a5281 Merge branch 'franklin-temp' of github.com:osiweb/unified_retro_keyboard into franklin-temp 2023-11-05 16:34:52 -06:00
dfnr2 cfa8a7f4a5
Franklin updates (#44)
* Remove rowcol references.

Will re-implement row-col scanner after keymap improvements.

* Fix number row sizes in keycap spec
2023-11-05 16:32:00 -06:00
Dave c6dec23634 Fix number row sizes in keycap spec 2023-08-30 22:36:07 -05:00
Dave 2383e32da8 Moved some keys to better position 2023-08-04 08:15:54 -05:00
Dave ecae8510db Update the keyboard to use project conventions
- Use the dual footprints for futaba / cherry keys
- Include a diode for every key (dual SMT/TH options)
- Add stabilizers to the spacebar
- Add cherry and futaba aligner plates
- Add SMT resistor option
- Add unified retro keyboard text
2023-07-18 01:22:10 -05:00
Dave 386c389f36 Updates to Franklin Ace keyboard
- Use the dual footprints for futaba / cherry keys

- include a diode for every key.

- Add stabilizers to the spacebar

- The Franklin keyboard is 9u, but it's very hard to find a 9u option. Instead, use 8u+1u

- Replace the LOCK key with a 1.75U key with LED window. Fix LED spacing to match original.
2023-07-02 16:28:08 -05:00
Dave 812f49ab20 Remove rowcol references.
Will re-implement row-col scanner after keymap improvements.
2023-05-12 22:42:31 -05:00
Dave f988d60603 Add franklin ace PCB 2023-05-08 00:41:30 -05:00
Dave 75173c875a remove kicad_prl file from version control 2023-05-07 22:15:54 -05:00
Dave 0c5ba4895c More work on diode-per-keyboard
extend spacebar to 9u
2023-05-07 17:23:27 -05:00
Dave 6ae95020dc Updates to franklin keyboard
- use new dual key footprints

- clean up violations

- convert to kicad 7

- on schematic, add diode per key

- start substituting unified keyboard project parts for standard kicad parts.
2023-05-07 14:27:54 -05:00
Dave b4c59c9a79 Add mounting holes to OSI keyboard cutout
- update OSI mounting hole footprint to include holes on eco2 so they
will be included with DXF exports of the OSI keyboard cutout on Eco2
2023-04-22 02:25:00 -05:00
Dave 411aa4e3fd Restore mounting holes
A prior commit apparently deleted several mounting holes.

- restore mounting holes
- update to Kicad7
- fix DRC errors resulting from update
- update footprints to use new shaped pads
2023-04-22 02:07:32 -05:00
Dave 663561c9f7 add osi mounting holes to ECO2 layer
In unikbd library, add eco2 layer holes to the OSI mounting holes part.
Since the osi keyboard cutout is on the eco2 layer, this allows the
mounting holes to be exported along with the cutout for case design.
2023-04-21 17:12:05 -05:00
Dave f66d8ba553 add OSI mounting holes to eco-2 layer in part lib
The Eco2 layer is used for OSI mounting holes.  Adding the eco2 layer to
the OSI mounting holes part allows export of these parts along with the
keyboard cutout as a DXF for case design.
2023-04-21 17:10:08 -05:00
Dave e505693c38 Add rowcol to keymap list and cmakefile 2023-04-21 17:00:44 -05:00
Dave da0e89ed5e Define default row scanner in arch headers
- in header files, change ASDF_ARCH_DEFAULT_SCANNER to
ASDF_ARCH_DEFAULT_ROW_SCANNER

- remove unused ASDF_NUM_KEYMAPS definition in asdf_keymap_setup.h.in
2023-04-18 02:46:43 -05:00
Dave 3f2e8aa249 Add hook for keyscan routine
A new hook was added, ASDF_HOOK_KEY_SCANNER.  This allows the entire keyscan routine
to be specified for each keymap.
2023-04-17 11:51:08 -05:00
dfnr2 b9927a3aad
Update README.md 2023-03-22 12:00:09 -05:00
dfnr2 f3c2bf8c39
Update README.md 2023-03-18 19:33:51 -05:00
Christopher Ryu 30ac997552
Add support for Franklin ACE 1000 replacement keyboard (#42)
* Initial commit.

* Add support for Franklin ACE 1000.

* Add ace1000_keyboard_test() for completeness.

* Add link to replacement keyboard.

* Add Franklin ACE 1000 replacement keyboard link.

* Add Franklin ACE 1000 keyboard.

* Activate caps-lock at powerup, and swap keymaps accordingly.

---------

Co-authored-by: Christopher RYU <software+github@disavowed.jp>
2023-03-18 19:30:04 -05:00
Dave 783ff8c644 Update key footprints for better pad definitions 2023-02-26 23:27:00 -06:00
Dave 1e3b5d1c50 Remove unused function 2023-01-02 04:17:27 -06:00
Dave ae4c228fff Merge branch 'asdf-build-test' 2023-01-02 04:10:52 -06:00
Dave 6a3c0073e5 remove phantom include 2023-01-02 04:07:28 -06:00
Dave f156ad9d80 removed extraneous function and source file61C0C5F1 2023-01-02 04:05:28 -06:00
Dave 327d8ec913 Fixes for make-targets.sh
- fix top dir to "."
- "clean" removes hex files and toc files from doc source directory
2023-01-02 03:30:03 -06:00
Dave f4ace5a9cb change install dir 2023-01-02 03:21:18 -06:00
Dave 62b27e0a3d fix videx keymappings fix applesoft keytest prog
- fixed the videx-like keymappings for the upper/lower keyboard
- moved @ to SHIFT-0 from CTRL-0, and put ID on CTRL-0
- bind the applesoft key test program to CTRL-3
- cram the keyboard test program into one line, to avoid adding a delay
 for BASIC parsing after the CR.
 - in main(), output only printable codes less than INVALID_CODE,
- instead of checking for code != INVALID_CODE.
2023-01-02 03:06:10 -06:00
Dave 8c8e021061 Add character test to apple keymap 2023-01-01 14:36:03 -06:00
Dave 573d6f842b Add user-bindable function to print ascii chars 2022-12-30 17:36:15 -06:00
Dave 14f7f1ed3e Added videx-style bindings to apple map
At the suggestion of @softwarejanitor, added the following ctrl codes to
upper/lower apple map:

CTRL-0: @
CTRL-1: | (vertical bar)
CTRL-2: ~ (tilde)
CTRL-6: ^ (caret)
CTRL-7: ` (grave)
CTRL-8: { (open curly brace)
CTRL-9: } (close curly brace)
CTRL--: _ (ctrl-dash -> underscore)
CTRL-,: [ (ctrl-comma -> open bracket)
CTRL-.: ] (ctrl-period -> close bracket)
CTRL-/: \ (ctrl-fwd_slash -> backslash)
2022-12-30 16:33:57 -06:00
Dave fe06e606d9 Merge branch 'videx' 2022-12-30 13:22:43 -06:00
Dave 23cbbeea54 Fixed root cmake root directory
- The previous commit changed the invocation of Cmake, which changed the
root directory.  This broke the web page build.
2022-12-30 13:06:44 -06:00
Dave ca8cff670a Streamline build and add more processor variants
- CMakeLists.txt, src/CMakeLists.txt: user ARCH for the actual
processor, and ARCH_FAMILY to specify the arch_*.[ch] files.

- generic-gcc-avr.cmake: fix optimizations to O1 or O0

- make-targets.sh: simplify cmake invocation, eliminate mkdir+cd,
instead use cmake flags to specify directory names and source dir.
2022-12-30 02:31:02 -06:00
David Fenyes 27f2616d22 Remove extraneous include 2022-12-27 15:30:57 -06:00
Dave cec0081bd4 Update readme 2022-12-04 10:48:01 -06:00
Dave d944b71f7f Updates to ASDF readme 2022-12-04 10:08:55 -06:00
Dave afdf74bd51 Fixed top CMakeLists.txt
replaced "asdf-" in target name with ${PROJECT_NAME}-, so now setting
project name (and version) in the project section will result in a
properly named result.
2022-12-03 20:44:42 -06:00
Dave bab5d3c8ab Merge branch 'asdf-build-test'
Fix yaml file
2022-12-03 04:34:49 -06:00
Dave ff0188ab2b Update eeprom-spec document 2022-12-03 04:24:29 -06:00
Dave f2a9b655a9 More Interface-ASCII PCB cleanups 2022-12-03 04:09:15 -06:00
Dave 33e68c6800 production cleanup for interface-ascii
- Add production package scripts
- Configure BOM generation for KiBOM
- Add 3D models to path (add kicad 5 path variable to list)
- bump version to 3 for compatibility with versioning scheme
2022-11-15 15:46:46 -06:00
Dave 0d0487df42 More README fixes 2022-09-07 22:22:51 -05:00
Dave f22c85e327 Update README for firmware 2022-09-07 22:16:16 -05:00
Dave 118fb24f7d Fixes to README 2022-09-07 22:13:14 -05:00
Dave 69d5d16544 Update firmware workflow and README 2022-09-07 21:56:24 -05:00
Dave 232b99a962 Update yml file to latest workflow 2022-09-07 21:31:46 -05:00
Dave 4e583a4a5a Remove unsed "uses" 2022-09-07 21:29:43 -05:00
Dave 98914eb1d5 Add dash before trigger branch names 2022-09-07 21:28:19 -05:00
Dave 51022040f1 Update to automate firmware builds
- build on checkin to asdf-release or asdf-built-test
- deploy to https://dfnr2.github.io/unified-retro-keyboard
2022-09-07 15:38:28 -05:00
Dave 21a30d2ca0 Add sphinx doc tree and Improve build automation
- Add a documentation directory to start documenting the firmware in
sphinx.
c
- Fix cmake scripts to generate files needed to make hex files available
  for download

- expand build script to automate the cmake file generation and builds
  for each architecture, install the python virtual environment needed for
  sphinx, and and to populate the sphinx source tree with links to built
  hex files.
2022-09-06 11:08:26 -05:00
Dave 9aa3bf4681 Fix compiler warning for GCC >= 11.3
- GCC version 12 generates a warnings for certain pointer
references.  Apparently this is to decect invalid offsets.  To properly
compiler, the recommended remedy is to add the compiler option
"--param=min-pagesize=0" to the flags.  This option was introduced in
version 11.3, so we need to check the compiler version and only add for
>11.3.

- Moved setting of compiler flags to a new function c_toolchain_flags in
the toolchain file "generic-gcc-avr.cmake".  This function is now called
from the CMakeLists.txt file in the src directory.  This allows the test
for the compiler version to be specified in the toolchain file, but not
executed until called by the src subdir CMakeLists.txt.  Delaying
evaluation of the function ensures that the CMAKE_C_VERSION variable is
properly set when the function is called.

- Moving the compiler flags out of the source dir CMakeLists.txt file
also improves portability by moving architecture-specific compiler
details from the source tree to the toolchain file.
2022-09-02 00:00:55 -05:00
Dave 18e451d8a6 Fix typo in src/CMakeLists.txt
for function create_keymap_valid, return statement had wrong function name.
2022-09-01 13:26:22 -05:00
Dave 1c855f9a4e Modified addon for 10-pin inline connector 2022-07-05 09:21:21 -05:00
Dave c77838e1b3 Update classic keyboard main PCB to kicad 6
- fix various ERC and DRC errors resulting from upgrade

- list included nets in busses on schematic

- Modify Footprints with multiple options (therefore multiple sets of
pads) to used shaped pads and proper pad numbering to eliminate DRC
issues, and ensure proper behavior
2022-04-09 14:56:23 -05:00
Dave cc77090f2c Merge branch 'main' of github.com:osiweb/unified_retro_keyboard 2022-04-07 19:46:39 -05:00
Dave b0ea2fad81 bump reset+SL addon to 1.4 2022-04-07 02:54:32 -05:00
Dave 802827402d Cleanup RESET+SHIFTLOCK addon
- replaced DIP header with 13-pin 0.1" vertical header.  Added labels to
the pins.

- removed left over unused diode

- reversed default on / default off labels on shiftlock mode jumper
block.
2022-04-07 01:57:16 -05:00
David Fenyes 721cb6585d Add missing keymap header files 2022-02-28 20:08:38 -06:00
Dave 6de71c63cd Add missing asdf_keymap_apple2_caps.h file 2022-02-28 20:03:44 -06:00
Dave 48977e3eb2 Clean up DRC errors 2022-02-22 16:00:30 -06:00
Dave d807d8720c OSI reset/shiftlock addon- add mounting holes 2022-02-22 15:49:20 -06:00
Lars Brinkhoff deb095aa10
Keycaps for Knight and SAIL keyboards (#39)
* Keycaps for Knight keyboard

* Keycaps for SAIL keyboard
2021-12-22 02:44:07 -06:00
David Fenyes e13c9d6888 BugFix: asdf_buffer_get: check for valid handle
Was only testing for handle less than next_handle, but not checking for
negative handle values. Fixed to use buffer_handle_valid() to test for a
valid handle.
2021-12-14 11:31:39 -06:00
Dave 118065236b Add asdf_keymap_setup.[ch] to test directory 2021-12-14 11:26:47 -06:00
Dave 975bb0e6a5 Remove extraneous chars. 2021-12-10 22:26:59 -06:00
Dave 1d5e76590f make sure all tests pass
- added keymap_setup() function to keymap tests

- The test string was not long enough to overflow the larger buffer.
Switched to use pseudo-random sequence intstead of a fixe test string.
2021-12-10 22:25:13 -06:00
Dave 3d7c80916b Add sol id message to CTL-0 and bump version 2021-12-05 00:08:16 -06:00
Dave 8bb2711ccb Fix bad msec delay routine in 2560 arch module 2021-12-05 00:07:41 -06:00
Dave 03069fc8b5 Tie message ID strings to function keys
for classic and classic_caps keyboards.
2021-12-04 23:53:15 -06:00
Dave 68086cde31 Apple2 u/l keyboard has CAPS by default.
Start LED off, and turn on by activating CAPS
2021-12-04 23:51:58 -06:00
Dave 7ce550257c Breakout keyboard init
factor out common code and add back wrappers, so keyboard initializes to
default keyboard on power up, and afterwards, won't reinitialize the
keyboard unless the map changes.
2021-12-04 23:12:32 -06:00
Dave 3a7e279453 Add ID message and keyboard test for apple2 kbds 2021-12-04 23:10:33 -06:00
Dave 116455ea61 Added ability to set the output rate for messages
A delay after each output character can be set, so slow interpreters,
etc. will not miss characters on systems with no handshaking.
2021-12-04 23:08:44 -06:00
Dave 66df34a972 Added arch API for msec delay. 2021-12-04 23:06:39 -06:00
Dave 45329de193 Fix slow repeat on some columns (Fixes #15)
Removed a bit of logic from the column bit test code that created
different scan rates for different columns.
2021-12-04 11:32:38 -06:00
Dave 7796b7f753 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.
2021-12-01 15:56:25 -06:00
Dave 9c0e9a9326 Fix Apple CAPS power LED to stay on. 2021-11-29 23:30:52 -06:00
Dave 2889bc3777 Typo fixes to classic keycap spreadsheet 2021-11-29 16:35:23 -06:00
Dave 562b859540 Add apple 2 caps, printing, bug fixes
- Added the apple 2 CAPS map

- auto-generate a function to check validity of a keymap index

- Added buffered message printing. This is different from keycode
buffering, since an extra delay is added for each message character to
allow polling hosts to keep up. Keycodes are generated at human speeds
and need no further slowdown.

- Added a message character delay to the arch-* modules

- enlarged the buffer pool, and created a buffer for messages

- bumped version number
2021-11-29 16:26:08 -06:00
Dave 233cda3e25 Add back the upper/lower Apple map
Port the old .h macro-based keymap definition to new C module based
definition.
2021-11-28 23:50:28 -06:00
Dave 818acf07ed Update to 1.6.0 for new map definition scheme 2021-11-28 15:49:40 -06:00
Dave 17d5313fe9 Merge branch 'master' into newmaps 2021-11-28 15:48:03 -06:00
Dave 304022ce93 Add cmake templates for keymap setup files 2021-11-28 15:34:32 -06:00
Dave 07ff09720b Fix library-related indirection bug
Accessing library functions via function pointer seems to cause a reset.
Still investigating the cause.

- compile keymaps subdir as part of main src cmakefile, rather than as a
separate library.

- rather than setup table of function pointers and using an indirection
in the main code, set up a jump table (switch).  This is cleaner.
2021-11-28 15:28:03 -06:00
Dave e2c2f56429 Fix extra indirection 2021-11-27 23:28:33 -06:00
Dave 52527265c0 Remove arch_init from main. 2021-11-27 23:26:47 -06:00
Dave 56d9c52edb Removed unused declaration 2021-11-27 23:26:09 -06:00
Dave f70a6006e1 Remove redundant reset code
keymaps_init calls select, which sets the index to 0 and resets the
keymaps.
2021-11-27 23:19:16 -06:00
Dave 836d0c4a4f Initialze buffers before other subsystems
Other subsystems may want to use buffers for output, e.g., for status
and debug.
2021-11-27 23:16:51 -06:00
Dave 64d683c9e7 Move tracks in classic kbd to avoid mounting holes 2021-11-24 14:04:16 -06:00
Dave 3e6c82830e Update comment do reflect correct DIPswitch row 2021-11-22 16:46:18 -06:00
Dave bd7fd85c7a Merge branch 'master' of github.com:osiweb/unified_retro_keyboard 2021-11-14 18:47:31 -06:00
Dave eabace40c9 Fix name and date 2021-11-14 18:46:00 -06:00
Dave c2fc6288da Bump version to 1.5.1 for bugfix 2021-11-08 22:47:31 -06:00
Dave f8a314d0ca BUGFIX: 328P OUT2 output was changing OUT1
This appears to have been a cut-paste typo in the asdf_arch_out2_set() function
in asdf_arch_atmega328p.c.  The port was set to OUT2, but the bit was OUT1.
2021-11-08 22:36:09 -06:00
Dave e6af897df2 Update photo in keycap spreadsheet
- use current keycap set of keycaps instead of outside examples
2021-09-26 03:12:29 -05:00
Dave ebe9344c82 Clean up keymap init routine
- replace asdf_keymaps_clear() with asdf_keymaps_reset() which does the
  clear, and also resets hooks and virtual devices for the keymap
2021-09-21 21:02:37 -05:00
Dave fc22f5be53 Fixed comment 2021-09-21 20:59:00 -05:00
Dave 123e345b6e Fix subscript on Sol map
- Change from 4 to 2, since only 3 maps for now.
2021-09-21 16:33:56 -05:00
Dave fb44b6844a Add keyboard cutout to PCB 2021-09-21 10:27:44 -05:00
Dave 1e7d53dc0a Merge branch 'master' of github.com:osiweb/unified_retro_keyboard 2021-08-25 11:49:46 -05:00
Dave 8fa6f3f648 Fix c compile flags.
C Flags set in src and test directories were not getting set because
they were assigned to C_FLAGS, which is ignored. Changed to CFLAGS,
which is used by cmake to set default c compilation options.
2021-08-25 11:46:23 -05:00
Dave 8acb6085eb fixed C FLAGS in newmaps
C compiler flags were ignored because they were assigned to C_FLAGS
var, which is ignored.  Changed to CFLAGS.
2021-08-25 10:53:11 -05:00
dfnr2 68c31fb078 Update README.md 2021-08-21 03:29:52 -05:00
Dave 7e0bdfb58b Clean up spreadsheet. 2021-08-08 13:29:28 -05:00
Dave 2a90669d9f Added silk screen annotations for connectors. 2021-08-08 13:20:26 -05:00
Dave 5e4c1ed078 Fix shunted diode footprints on encoder boards
The encoder boards (ATmega328P, Atmega2560, Apple2(2560) can accomodate
keyboard matrices with no diodes, by adding per-row diodes on the
encoder board.  For keyboards with per-key diodes (the typical use
case), the per-row diodes are not needed, and therefore the footprints
should be shunted by default, using a special shunted diode footprint.
When diodes are installed, the shunt can be cut with an x-acto knife.
Previous board revs had the correct footprint, but somehow the regular
diode footprint was substituted on the last release of each of these
PCBS.  The correct footprint has been restored.
2021-08-08 13:16:38 -05:00
Dave 10f1f4966e Fixed typo and slight further clarification 2021-06-19 16:45:41 -05:00
Dave a270418407 Added some clarifications to Classic order form 2021-06-19 16:42:54 -05:00
Dave 7d78b16738 the > and < symbols were backwards wrt "." and "," 2021-06-19 16:00:30 -05:00
Dave 4b18af964a Add multiple kicad footprints
- mounting posts (for futaba)
- aligner tool
- bending guide
2021-05-19 13:34:34 -05:00
Dave 63805800af firmware now compiles without errors
test suite passes
have not yet tested firmware
2021-05-19 13:32:23 -05:00
David Fenyes 23dd38b488 Fix test/CmakeLists.txt so tests compile.
Apparently some file pollution resulted in a successful compile that couldn't be
reprodued from a fresh git clone.  Fixed file copying and include paths so
compile works.  All tests pass.
2021-03-08 12:27:53 -06:00
Dave 1f2f420de0 Cleaned up generation of keymap table and NUM_KEYMAPS definition
Toward #23 and #27
2021-03-07 23:22:05 -06:00
Dave b0c01bb0ef newmaps passes all tests with cmake build. 2021-03-07 20:56:34 -06:00
Dave 8310259cc7 Progress toward building new keymap scheme with cmake
- keymap files (c,h) are in src/Keymaps
- keymap files are added to the keymap library in src/Keymaps/CMakeLists.txt
- keymaps for the build are listed, along with positions, in /keymap_lists.cmake
- cmake generates a keymap jump table from the keymap lib and list
- tests mostly passing.  Keymap structure for testing will be used as the model
  for the app keymaps.
2021-03-07 20:38:40 -06:00
Dave 3a854d97f2 Get tests to pass with CMake build system
progress on issues #23 (new mechanism to add keymaps) and #27 (Cmake build)
2021-03-05 01:17:33 -06:00
Dave a95a8ddb8d Remove redundant NUM_ROWS and NUM_COLS definition from test keymap 2021-03-05 01:00:40 -06:00
Dave 8088c0e157 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
2021-03-05 01:00:40 -06:00
Dave 952e425986 New map scheme passes all tests. (Issue #25) 2021-03-05 01:00:40 -06:00
Dave b688f1c56f Get virtual devices in new maps scheme to pass tests
Remove initialization from data structure.

Replace the previous virtual_init() with a virtual_init() that initializes the
data structures to a default state

Create virtual_sync() function to push the state of virtual devices to the
physical outputs.  Moved from the previous virtual_init() function.

The virtual device table is now built by direct calls to virtual_add() from the
setup function.

Toward issue [#23]
2021-03-05 01:00:39 -06:00
Dave bcde21f3a8 Get keymap tests to pass (issues [#23] and [#25])
Clean compile of asdf_keymaps.c/h and tests

Clean up keymap pointer notation

Reduce number of keymaps to 16, matching number of DIP switches allocated for
keymap selection.
2021-03-05 01:00:19 -06:00
Dave 14ad7c4cc2 More keymap updates toward [#23] amd [#25]
App code now compiles clean, but test code still needs to be updated to set up
the test keymaps.  So, no passing tests yet.
2021-11-30 13:11:48 -06:00
David Fenyes daa6ff672f WIP - non-compiling keymap updates
Please see ARCHITECTURE-keymaps.org for general idea and TODO list.
2021-03-05 00:59:46 -06:00
David Fenyes 99610395fc Get new keymap scheme to pass keymap tests
Toward issue #23
2021-03-05 00:59:40 -06:00
Dave d6edb15734 Rebase newmaps branch to master
(WARNING: WIP) Gathered Work-in-progress on alternate keymap defs

Exploratory branch.  Code is messy and untested.
Examining creating a module for each keymap rather than header file.
2021-03-05 00:58:06 -06:00
Dave 859a5e03d1 Change order of version and architecture in build target name 2021-03-04 22:44:09 -06:00
160 changed files with 215178 additions and 49383 deletions

39
.github/workflows/asdf-firmware.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: asdf-firmware
on:
push:
branches:
- asdf-release
- asdf-build-test
jobs:
build_firmware:
runs-on: ubuntu-latest
container: { image: alpine }
defaults:
run:
shell: sh
steps:
- name: install_git_and_bash
run: apk add bash git rsync
- name: checkout
uses: actions/checkout@v2
- run: apk add gcc-avr binutils-avr avr-libc
- run: apk add cmake make
- run: apk add python3 py3-pip
- run: pip install -U sphinx sphinx-rtd-theme sphinx-autodoc-typehints
- run: pip install -U sphinxcontrib-napoleon
- run: pip install -U toml
# - run: pip install pipenv
# Create the build directories, make all targets, and copy
# hex files to sphinx source directory for download links
- run: cd firmware/asdf; /bin/bash ./make-targets.sh -a -i -s
- run: mkdir public; touch public/.nojekyll
- run: sphinx-build -b html firmware/asdf/docs/source public
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: public

View File

@ -14,10 +14,12 @@ The keyboard is designed using KiCad in order to be the most useful for anybody
- Replacement keyboard for the Sol-20 computer
- Generic ADM-3A/Teletype style keyboard
- Apple I keyboard (multiple styles)
- Franklin ACE 1000 replacement keyboard by Chris Ryu (https://github.com/ryucats/Franklin-ACE-1000-Keyboard)
### Coming soon:
- Replace encoder board on Apple II/II+ keyboards
- Convert an OSI 542 keyboard into a generic ASCII keyboard
- Replica for Knight keyboard
### This keyboard project so far consists of:
- A classic retro-style ASCII keyboard, modeled after the ADM-3A keyboard, which

View File

@ -1,53 +1,97 @@
cmake_minimum_required(VERSION 3.19)
set(KEYMAPFILE keymaps.txt)
# Set up the toolchain and other architecture specific details
if(ARCH MATCHES atmega328p)
message(STATUS "setting up for atmega328p")
set(AVF_H_FUSE 0xd9)
set(ARCH_FAMILY_ATMEGA328P atmega328p)
set(ARCH_FAMILY_ATMEGA2560 atmega2560)
if(ARCH MATCHES atmega328p OR ARCH MATCHES atmega168p OR ARCH MATCHES atmega88p)
set(FUSE_NOTES "Setting up for ${ARCH}: \n\n\
Fuses: EXTENDED = 0xFF, HIGH = 0xdf, LOW = 0xd2\n\n\
Brownout detect level: 111 (disabled) \n\
Debug Wire (DWEN): 0 (disabled) \n\
SPIEN: 1 (enabled) \n\
Watchdog (WDTON): 0 (disabled) \n\
Save EEPROM (EESAVE): 0 (disabled) \n\
Boot section / size (BOOTZ): 11 (size=128[88p,168p]/256[328p])) \n\
Boot Reset Vector (BOOTRST): 0 (disabled) \n\
Divide Clock by 8 (CKDIV8): 0 (disabled) \n\
Clock out B0 (CKOUT) 0 (disabled) \n\
Clock select (CKSEL3:0): 0010 (Ext Crystal 8.0 MHz) \n\
Startup time (SUT): 01 (4.1 ms)\n\n")
set(AVR_X_FUSE 0xff)
set(AVR_H_FUSE 0xdf)
set(AVR_L_FUSE 0xd2)
set(AVR_MCU ${ARCH})
set(ARCH_FAMILY ${ARCH_FAMILY_ATMEGA328P})
set(ARCH_TYPE AVR)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/generic-gcc-avr.cmake)
set (ASDF_OUT_TARGET ${ASDF_TARGET}.elf)
set (FINAL_TARGET ${TARGET}.elf)
elseif(ARCH MATCHES atmega2560)
message(STATUS "setting up for atmega2560")
set(AVF_H_FUSE 0x99)
elseif(ARCH MATCHES atmega640 OR ARCH MATCHES atmega1280 OR ARCH MATCHES atmega2560)
set(FUSE_NOTES "Setting up for ${ARCH}: \n\n\
Fuses: EXTENDED = 0xFD, HIGH = 0x98, LOW = 0xFD\n\n\
Brownout detect level: 111 (disabled) \n\
On-chip Debug (OCD): 0 (disabled) \n\
JTAGEN: 1 (enabled) \n\
SPIEN: 1 (enabled) \n\
Watchdog (WDTON): 0 (disabled) \n\
Save EEPROM (EESAVE): 0 (disabled) \n\
Boot section / size (BOOTZ): 00 (size=4096/start=$1F000) \n\
Boot Reset Vector (BOOTRST): 0 (enabled) \n\
Divide Clock by 8 (CKDIV8): 0 (disabled) \n\
Clock out E7 (CKOUT) 0 (disabled) \n\
Clock select (CKSEL0:3): 0111 (Full Swing Osc.) \n\
Startup time (SUT): 10 (4.1 ms)\n\n")
set(AVR_X_FUSE 0xff)
set(AVR_H_FUSE 0x99)
set(AVR_L_FUSE 0xe7)
set(AVR_MCU ${ARCH})
set(ARCH_FAMILY ${ARCH_FAMILY_ATMEGA2560})
set(ARCH_TYPE AVR)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/generic-gcc-avr.cmake)
set (ASDF_OUT_TARGET ${ASDF_TARGET}.elf)
set (FINAL_TARGET ${TARGET}.elf)
endif()
project("asdf"
VERSION 1.5
VERSION 1.6.5
DESCRIPTION "A customizable keyboard matrix controller for retrocomputers"
LANGUAGES C)
set_property(GLOBAL PROPERTY C_STANDARD 99)
set(ASDF_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
message("SRC Dir is ${ASDF_SRC_DIR}")
set(PROJECT_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
message("SRC Dir is ${PROJECT_SRC_DIR}")
set (ASDF_TARGET_NAME asdf-${ARCH}-${PROJECT_VERSION})
set (ASDF_EXECUTABLE_TARGET_NAME ${ASDF_TARGET_NAME})
#set(PYTHON_SCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
#message("Python scripts Dir is ${PYTHON_SCRIPTS_DIR}")
set(DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs)
message("Documentation and web page directory is ${DOC_DIR}")
macro(temporary_config_file SOURCE_FILE GENERATED_FILE)
configure_file(${SOURCE_FILE} ${GENERATED_FILE}
COPYONLY)
list(APPEND TEMPFILE_LIST ${GENERATED_FILE})
endmacro(temporary_config_file)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
message("Install root: ${CMAKE_INSTALL_PREFIX}")
set (PROJECT_TARGET_NAME ${PROJECT_NAME}-v${PROJECT_VERSION}-${ARCH})
set (PROJECT_EXECUTABLE_TARGET_NAME ${PROJECT_TARGET_NAME})
if(ARCH MATCHES test)
add_subdirectory(test)
else()
if((ARCH MATCHES atmega328p) OR (ARCH MATCHES atmega2560))
set (ASDF_EXECUTABLE_TARGET_NAME ${ASDF_TARGET_NAME}.elf)
if(ARCH_TYPE MATCHES AVR)
set (PROJECT_EXECUTABLE_TARGET_NAME ${PROJECT_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})
@ -56,3 +100,8 @@ else()
add_subdirectory(src)
endif()
# generate reStructuredText index file for project version: Note: this may be
# rebuilt for each target, but as long as all have the same project version, the
# build is idempotent, so no issues.
configure_file(${DOC_DIR}/source/_templates/index.rst.in ${DOC_DIR}/source/index.rst)

20
firmware/asdf/Pipfile Normal file
View File

@ -0,0 +1,20 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
black = "*"
flake8 = "*"
pylint = "*"
mypy = "*"
[packages]
sphinx = "*"
sphinx-autodoc-typehints = "*"
sphinx-rtd-theme = "*"
toml = "*"
intelhex = "*"
[requires]
python_version = "3"

View File

@ -1,5 +1,5 @@
ASDF Keyboard scanning firmware
-
# ASDF Keyboard scanning firmware
This is a key matrix scanner that can detect and debounce keypress and release
events on a key matrix and either send codes or perform actions on keypress or
release. Keymaps are defined per application and may, for example, generate
@ -18,8 +18,12 @@ ASDF supports basic keyboard functionality and is configurable via a few
boolean variables, and via the key maps. The key maps are organized in
row,column format, with separate keymaps shift, capslock, and control-key modes.
Features:
--
## Downloads:
Download the latest release of the firmware [here](https://osiweb.github.io/unified_retro_keyboard)
## Features:
* modifiers: A set of modifier keys may be specified. When only a few modifiers
are used, this mechanism is a low-overhead alternative to a keymap overlay for
keyboard states that only change the key codes produced by a keypress, such as
@ -47,6 +51,7 @@ Features:
* (2): Apple 2 ASCII keyboard (upper/lower)
* (3): Apple 2 ASCII keyboard (standard all caps)
* (4): Sol-20 ASCII keyboard
* (5): Franklin Ace-100 keyboard (Thanks to Chris Ryu)
* Debounce and Repeat functions: The main keyscan logic implements key
debouncing. Multiple keys may be debounced simultaneously using a separate
@ -59,23 +64,131 @@ Features:
* ASCII output - supported via output_value function.
* Virtual Output layer: Indicator LEDs and other direct logic-level hardware controls: supported via
a virtual output layer. The keymaps (and certain functions such as shiftlock and capslock) may bind virtual outputs. The keymaps may then specify how the virtual outputs map to the available physical resources. This allows one keymap to place the capslock LED in one position, and another keymap may place the capslock LED elswhere. This simplifies support of multiple keyboards and keymaps.
* Virtual Output layer: Indicator LEDs and other direct logic-level hardware
controls: supported via a virtual output layer. The keymaps (and certain
functions such as shiftlock and capslock) may bind virtual outputs. The keymaps
may then specify how the virtual outputs map to the available physical
resources. This allows one keymap to place the capslock LED in one position,
and another keymap may place the capslock LED elswhere. This simplifies support
of multiple keyboards and keymaps.
Compiling and configuration
--
The source files are in the ./src directory. The final build files go in the ./build directory.
## Compiling and configuration
To build, enter the ./src directory. You should be able to build a binary and
hex file suitable for programming a microcontroller by typing "Make". You may
edit the Makefile to specify your target platform (default is Atmega328P ASCII
controller). You may also wish to edit your preferences in "asdf_config.h" to
specify repeat timings, optimize the debounce setting (if you have very bounce
keys), and specify the character output buffer size (if you are implementing
macros, etc.)
### Changing project name and version number.
- Edit the file "CMakeLists.txt"
- You will see a "project" section near the beginning of the file.
project("asdf"
VERSION 1.6.3
DESCRIPTION "A customizable keyboard matrix controller for retrocomputers"
LANGUAGES C)
- You can change the project name from "asdf" to whatever you like, and change the version number as you see fit. These values will be used to name the resulting hex files, and also to name the download links in the GitHub page, if you choose to create one.
project("my-keyboard"
VERSION 1.0
DESCRIPTION "My customized keyboard firmware"
LANGUAGES C)
### building using github actions:
If you have commit privileges to the repository, or if you have your own fork,
then push a commit to one of the following branches to trigger an automatic build:
- asdf-release
- asdf-build-test
This will generate a github page with downloadable hex files. You will find the
link to the github page in the "Actions" tab of the repository.
You will also need to activate GitHub pages. To do this:
- Click "Settings" at the top of this GitHub page, then along the menu bar on the left, select "Pages" in the "Code and Actions Section."
- In the "Build and deployment" section, select "Deploy from Branch"
- The "Branch" section will display a message that github pages is disabled. Select the branch "gh-pages" from the dropdown, and the "disabled" message will be replaced with a message that the site is being built from "gh-pages". Once you have triggered a build, you will see a message at the top of this page with a link to the live page.
-
### build using the make-build-dirs.sh script.
1) Run the make-targets.sh script
Options:
-x Before creating a build directgory or virtual env, remove
any pre-existing version
-t add an architecture directory
-a Add all valid architecture directories
-i Build each specified target and install to dist directory
-p Install pipenv virtual environment for python scripts
-c Clean all artifacts
-s Copy dist files to sphinx directory
Valid targets: atmega640, atmega1280, atmega2560
- To create build directories for all targets and install the python virtual
environment:
bash make-targets.sh -ap
- To create a a build directory for atmega1280, deleting any pre-existing directory:
bash make-targets.sh -xt atmega2560
- To remove and rebuild the python virtual environment:
bash make-targets.sh -xp
- To copy hex files to sphinx source tree (Requires the hex files
to be installed in ./dist either from make install in each target
directory, or 'bash make-targets.sh -ai')
bash make-targets.sh -s
- From a fresh checkout, build all targets and install hex files in
sphinx tree for the download links:
bash make-targets -pais
2) Enter the build directory for the desired architecture and build:
Only needed if working on single target. To make all targets at once,
use the make-targest script described in step 1.
Example: building the atmega2560 binary:
cd build-atmega2560
make
3) Build the sphinx documentation:
cd docs
pipenv run make html
### build manually (e.g., for development)
1) make and build directories for the desired architectures:
mkdir build-atmega328p build-atmega2560
3) enter each build directory and run cmake for the desired architecture.
cd build-atmega2560
cmake .. -DARCH=atmega2560 -DCMAKE_BUILD_TYPE=RELEASE
> make
4) to run unit tests, the process is the same as above, with "test" as the
target:
mkdir build-test
cd build-test
cmake .. -DARCH=test
cd src
ctest
## Porting
Porting
--
This firmware was written in modular, portable C99, to be compiled with GCC
(avr-gcc for the Atmega). The hardware-sepecific files are in Arch/*.[ch]. To
adapt the Atmega port for additional hardware, enter the ./src/Arch directory,

View File

@ -50,6 +50,74 @@ set(CMAKE_SYSTEM_PROCESSOR avr)
set(CMAKE_C_COMPILER ${AVR_CC})
set(CMAKE_CXX_COMPILER ${AVR_CXX})
#Flags used by the C compiler during DEBUG builds.
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
#Flags used by the C compiler during MINSIZEREL builds.
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
#Flags used by the C compiler during RELEASE builds.
set(CMAKE_C_FLAGS_RELEASE "-O1 -DNDEBUG")
#Flags used by the C compiler during RELWITHDEBINFO builds.
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O1 -g -DNDEBUG")
##########################################################################
# c_toolchain_flags
# - Adds a list of compiler-specific flags to the CFLAGS variable in the
# parent scope.
##########################################################################
function(c_toolchain_flags)
# fix array base indexing beginning in AVR-GCC 12:
list(APPEND TOOLCHAIN_FLAGS
-std=c99
# -Wa,-adhln
-Wall
-funsigned-char
-funsigned-bitfields
-ffunction-sections
-fdata-sections
-fpack-struct
-fshort-enums
-Wall
-Wextra
-Wpointer-arith
-Wcast-align
-Wwrite-strings
-Wswitch-default
-Wunreachable-code
-Winit-self
-Wmissing-field-initializers
-Wno-unknown-pragmas
-Wstrict-prototypes
-Wundef
-Wold-style-definition
)
if(CMAKE_C_COMPILER_VERSION GREATER_EQUAL "11.3")
message(STATUS "Appending page size fix for GCC >= 11.3")
list(APPEND TOOLCHAIN_FLAGS --param=min-pagesize=0)
endif()
set(CFLAGS ${TOOLCHAIN_FLAGS} PARENT_SCOPE)
endfunction(c_toolchain_flags)
##########################################################################
# Macros for setting optimization flag:
# - optimization_off: turn off optimization for RTOS
# - optimization_full: set optimization to desired level for app.
##########################################################################
macro(optimization_off)
set(CMAKE_CFLAGS_RELEASE "-O0" "-NDEBUG")
set(CMAKE_CFLAGS "-O0" "-NDEBUG")
endmacro(optimization_off)
macro(optimization_full)
set(CMAKE_CFLAGS_RELEASE "-O1" "-NDEBUG")
set(CMAKE_CFLAGS "-O1" "-NDEBUG")
endmacro(optimization_full)
##########################################################################
# Identification
##########################################################################
@ -100,11 +168,7 @@ endif(NOT AVR_MCU)
#default avr-size args
if(NOT AVR_SIZE_ARGS)
if(APPLE)
set(AVR_SIZE_ARGS -B)
else(APPLE)
set(AVR_SIZE_ARGS -C;--mcu=${AVR_MCU})
endif(APPLE)
set(AVR_SIZE_ARGS -B)
endif(NOT AVR_SIZE_ARGS)
# prepare base flags for upload tool
@ -151,6 +215,7 @@ else(WITH_MCU)
set(MCU_TYPE_FOR_FILENAME "")
endif(WITH_MCU)
##########################################################################
# add_avr_executable
# - IN_VAR: EXECUTABLE_NAME
@ -169,12 +234,22 @@ function(add_avr_executable EXECUTABLE_NAME)
endif(NOT ARGN)
# set file names
set(elf_file ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}.elf)
set(hex_file ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}.hex)
set(lst_file ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}.lst)
set(map_file ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}.map)
set(eeprom_image ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME}-eeprom.hex)
message(STATUS "elf name: ${elf_file}")
set(basename ${EXECUTABLE_NAME}${MCU_TYPE_FOR_FILENAME})
set(elf_file ${basename}.elf)
set(hex_file ${basename}.hex)
set(lst_file ${basename}.lst)
set(map_file ${basename}.map)
set(eeprom_image ${basename}-eeprom.hex)
message(STATUS "elf name: ${elf_file}")
message(STATUS "project target name: ${PROJECT_TARGET_NAME}")
set(sphinx_file ${CMAKE_CURRENT_BINARY_DIR}/toc_${PROJECT_TARGET_NAME}.rst)
configure_file(${DOC_DIR}/source/_templates/hexfile_link.in ${sphinx_file})
message(STATUS "sphinx file: ${sphinx_file}")
install(FILES ${sphinx_file} DESTINATION docs/source)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${basename}.hex DESTINATION dist)
# elf file
add_executable(${elf_file} EXCLUDE_FROM_ALL ${ARGN})

View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

View File

@ -0,0 +1,7 @@
.. _@ARCH@ Rev @CMAKE_PROJECT_VERSION@:
ASDF Rev @CMAKE_PROJECT_VERSION@ hex file (@ARCH@)
----------------------------------------------------------------------------------
:ASDF Firmware @CMAKE_PROJECT_VERSION@-@ARCH@:
:download:`@hex_file@`

View File

@ -0,0 +1,8 @@
Unified Retro Keyboard firmware (ASDF) rev @CMAKE_PROJECT_VERSION@
=======================================================================
.. toctree::
:caption: Downloads
:glob:
toc_*

View File

@ -0,0 +1,63 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import re
import toml
# -- Project information -----------------------------------------------------
project = "ASDF - Unified Retro Keyboard Firmware"
copyright = "2022 Osiweb.org"
author = "David F"
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autodoc", # Core library for html generation from docstrings
"sphinx_autodoc_typehints",
"sphinx.ext.viewcode",
"sphinx.ext.autosectionlabel",
"sphinx.ext.autosummary", # Create neat summary tables
]
autosummary_generate = True # Turn on sphinx.ext.autosummary
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [
"_static"
] # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

View File

@ -0,0 +1,62 @@
* EEPROM management
** Uses
*** Store current keyboard ID
*** Store status of various options
**** key repeat rates and delays
**** communications delays
**** serial baud rates
**** keyboard macros
**** keyboard specific options
***** all caps / upper+lower
***** handling of special keys
** Allocate on demand
** System block does not change as keyboards are changed
*** Items include:
**** current keyboard
*** All system block allocation must occur before any keyboard allocation may occur.
*** Once system EEPROM is allocated, system EEPROM is "locked"
*** If system EEPROM is locked, then EEPROM cannot be reallocated, although the parameters may be re-written.
*** provision to unlock EEPROM, for example, when firmware is updated, or during development
** Keyboard block is reset whenever the keyboard changes
*** Any parameters specific to a keyboard, such as macros, keymap-specific settings, etc. are stored here.
*** This section is erased when keymap changes, but not when a keymap is loaded from EEPROM at powerup.
* Architecture
** Device independent layer - allows diferent devices including on-chip EEPROM, off-chip EEPROM, and other technologies such as FRAM. An API that implements the following:
*** Read a byte/word from EEPROM
*** Write a byte/word to EEPROM
*** Erase a range of EEPROM
*** Return size of storage (in bytes)
** Allocation layer
*** Store an arbitrary length string to a numbers slot (0-ff)
*** retrieve an arbitrary length string from a numbered slot (0-ff)
*** delete a string an a numbered slot (0-ff). Probably accomplish by storing a 0-length string.
*** Initialize an arbitary portion of storage (including all storage)
** Architecture for allocation layer:
*** Pointer to first "free" block. This is a linked list of blocks.
*** Table of starting positions and lengths. Starting position will be 2 bytes, and will indicate a 1 or 2 byte boundary1, 2, or 4-byte words, determined by storage size. Number of elements in table will also be determined by storage size, up to max 255.
*** Initialize with a free block of all available storage
*** Allocate storage from beginning of free block.
*** The beginning of each block is a header including a "size" value (1 or 2 bytes) and a "link" address, 1, 2, or 4 bytes, same as the index table. For free blocks, the "size" is always a contiguous size. For allocated blocks, the size is the total size of all the blocks linked in a list.
*** To allocate:
***** Look up the first free block
***** If the string can fit in the size of the free block:
****** then store size in the size field
****** store "0" in the link
****** store the string next.
****** If there is any space left over in the free block, then create a new "free block" from the next few bytes, and add to the front of the "free" list.
***** If the string cannot fit in the size of the free block:
****** store the size in the size field
****** Leave the "link" address, which points to the next free block
****** Store the string text
****** jump to the next free block, and repeat the above for the remainder of the string.
****** keep repeating until the string can fit in a free block.
****** If there is no more free block, and not enough room to store the text, then store as much as possible, then stop.
*** To free:
***** Look up the string address in the index
***** Zero out the index entry for the string.
***** Look at the size of the string. If the next contiguous block is also free, then combine and store the size of the combined block at the beginning of the block.
****** repeat the above until next contiguous block is not free
***** Please free block at the beginning of the "free" list.

View File

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

View File

@ -1,115 +0,0 @@
#!/opt/local/bin/bash
CMAKE_TARGETS=""
VALID_TARGETS=""
add_valid_target() {
VALID_TARGETS+=" $1 "
}
add_valid_target test
add_valid_target atmega328p
add_valid_target atmega2560
build_arch() {
echo one: $1 two: $2 three: $3
echo star: "[$*]"
echo amp: "[$@]"
for target_arch in "$@"
do
if [[ ! -d "build-$target_arch" ]]
then
mkdir "build-$target_arch"
fi
if [[ -d "build-$target_arch" ]]
then
(cd "build-$target_arch" && cmake -DARCH=$target_arch ..)
fi
done
}
main() {
parse $@
echo "Valid: $VALID_TARGETS"
echo "Selected: $CMAKE_TARGETS"
run
}
run() {
echo "$CMAKE_TARGETS"
build_arch $CMAKE_TARGETS
}
syntax() {
echo "Usage:"
echo " $0 -t target [-t target] ..."
echo " $0 -a"
echo " $0 -h"
echo ""
echo "Options:"
echo " -t add an architecture directory"
echo " -h Display this help message"
echo " -a Add all valid architecture directories"
echo ""
echo "Valid targets: $VALID_TARGETS"
}
parse() {
local SYNTAX=""
local ALL=""
while getopts "t:ah" optname
do
case "$optname" in
h)
SYNTAX="yes"
;;
a)
ALL="yes"
;;
t)
# Test that target is valid and not already specified
if [[ " $VALID_TARGETS " == *" $OPTARG "* ]]
then
if [[ " $CMAKE_TARGETS " != *" $OPTARG "* ]]
then
CMAKE_TARGETS+=" $OPTARG "
fi
else
SYNTAX="yes"
fi
;;
esac
done
if [[ "$SYNTAX" == "yes" ]]; then
syntax && die
fi
if [[ "$ALL" == "yes" ]]
then
CMAKE_TARGETS="$VALID_TARGETS"
fi
if [[ -z "$CMAKE_TARGETS" ]]
then
die "No targets!"
fi
}
die() {
builtin echo $@
exit 1
}
main $@
exit 0

228
firmware/asdf/make-targets.sh Executable file
View File

@ -0,0 +1,228 @@
#!/bin/bash
GENERATOR="Unix Makefiles"
NUM_VALID_TARGETS=0
BUILD_TYPE=RELEASE
INSTALL_DIR="dist"
MAKE_TARGETS="all"
DOC_DIR=docs
LINKS_DIR="$DOC_DIR/source"
add_valid_target() {
VALID_TARGETS[$NUM_VALID_TARGETS]=$1
HW_SIGS[$NUM_VALID_TARGETS]=$2
((NUM_VALID_TARGETS++))
}
add_valid_target test
add_valid_target atmega328p
add_valid_target atmega168p
add_valid_target atmega88p
add_valid_target atmega2560
add_valid_target atmega1280
add_valid_target atmega640
check_valid_target() {
result="false"
for (( i = 0; i < NUM_VALID_TARGETS; i++ ))
do
if [[ ${VALID_TARGETS[$i]} == $1 ]]
then
result=$i
fi
done
echo $result
}
do_pipenv_clean() {
echo removing old python virtual environment...
pipenv --rm
}
do_pipenv_install() {
echo installing python virtual environment...
pipenv install
}
clean_arch() {
target_arch="$1"
echo "Removing pre-existing build directory: $target_arch..."
rm -rf "build-$target_arch"
echo "Removing any build artifacts"
rm -f $INSTALL_DIR/*"$1"*
echo "Removing any download links"
rm -f $LINKS_DIR/*$1*
}
build_arch() {
local target_arch="$1"
local hardware_sig="$2"
cmake -S . -B "build-$target_arch" -G "$GENERATOR" \
-DCMAKE_INSTALL_PREFIX="." -DARCH="$target_arch" \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
}
deploy_arch() {
local target_arch="$1"
if [[ -d "build-$target_arch" ]]
then
(cd "build-$target_arch" \
&& make install)
fi
}
clean_all() {
echo "- Removing install dir \"$INSTALL_DIR\"..."
rm -rvf "$INSTALL_DIR"
echo "- Removing download links from doc dir..."
rm -vf $DOC_DIR/source/toc_*
echo "- Removing hex files from doc dir..."
rm -vf $DOC_DIR/source/*.hex
echo "- Removing versioned index file from doc dir"
rm -vf "$DOC_DIR/source/index.rst"
}
syntax() {
echo "Usage:"
echo " $0 -t target [-t target] ..."
echo " $0 -a"
echo " $0 -h"
echo ""
echo "Options:"
echo " -h. Display this help message"
echo " -x Before creating a build directgory or virtual env, remove"
echo " any pre-existing version"
echo " -t add an architecture directory"
echo " -a Add all valid architecture directories"
echo " -i Build each specified target and install to dist directory"
echo " -p Install pipenv virtual environment for python scripts"
echo " -c Clean all artifacts"
echo " -s Copy dist files to sphinx directory"
echo "Valid targets: ${VALID_TARGETS[*]}"
}
parse() {
local SYNTAX=""
local ALL=""
local i
local valid_index
NUM_CMAKE_TARGETS=0
CLEAN_BEFORE_BUILD=""
DO_PIPENV_INSTALL=""
DEPLOY=""
CLEAN_ALL=""
COPY_DIST_TO_DOCS=""
while getopts "t:ahipxcs" optname
do
case "$optname" in
h)
SYNTAX="yes"
;;
a)
ALL="yes"
;;
t)
# Test that target is valid
valid_index=$(check_valid_target $OPTARG)
if [[ $valid_index != "false" ]]
then
CMAKE_TARGETS[$NUM_CMAKE_TARGETS]=$valid_index
((NUM_CMAKE_TARGETS++))
else
echo Unknown target \"$OPTARG\"
SYNTAX="yes"
fi
;;
p)
DO_PIPENV_INSTALL="yes"
;;
x)
CLEAN_BEFORE_BUILD="yes"
;;
i) DEPLOY="yes"
;;
s) COPY_DIST_TO_DOCS="yes"
;;
c) CLEAN_ALL="yes"
esac
done
if [[ "$SYNTAX" == "yes" ]]; then
syntax && die
fi
if [[ "$ALL" == "yes" ]]
then
for (( i=0; i<NUM_VALID_TARGETS; i++ ))
do
CMAKE_TARGETS[i]=$i
done
NUM_CMAKE_TARGETS=$NUM_VALID_TARGETS
fi
}
die() {
builtin echo $@
exit 1
}
main() {
local TARGET
local i
parse $@
if [[ "$DO_PIPENV_INSTALL" == "yes" ]]
then
if [[ "$CLEAN_BEFORE_BUILD" == "yes" ]]
then
do_pipenv_clean
fi
do_pipenv_install
fi
if [[ "$CLEAN_ALL" == "yes" ]]
then
clean_all
fi
echo Valid Targets: "${VALID_TARGETS[*]}"
for (( i=0; $i<$NUM_CMAKE_TARGETS; i++ ))
do
TARGET=${CMAKE_TARGETS[$i]}
if [[ "$CLEAN_BEFORE_BUILD" == "yes" ]]
then
clean_arch ${VALID_TARGETS[$TARGET]}
fi
build_arch ${VALID_TARGETS[$TARGET]} ${HW_SIGS[$TARGET]}
if [[ "$DEPLOY" == "yes" ]]
then
deploy_arch ${VALID_TARGETS[$TARGET]}
fi
done
if [[ $COPY_DIST_TO_DOCS == "yes" && -d "$INSTALL_DIR" ]]
then
cp -av "$INSTALL_DIR"/* docs/source
fi
}
main $@
exit 0

View File

@ -0,0 +1,33 @@
* Keymap architecture
** Keymap definition modules are in src/Keymaps
** Each keymap has its own keymap setup routine
*** void setup_mapname_keymap(void) - keymap setup function
**** register a keycode map for each modifier combination
***** The keycode maps are in flash (ROM)
**** set up virtual devices for the keymap
***** virtual device to physical device mapping
***** associated virtual device function on activate/deactivate
***** initial state
**** set up function hooks used by keymap
** Keymap definition API
*** mapping keys
#include "asdf_keymaps.h"
**** asdf_keymaps_add_map() - called from
Assigns a specified keymap matrix (ptr to FLASH) to a given keymap and modifier type.
*** adding virtual devices - called from keymap setup routine
**** asdf_virtual_init()
***** Clears the virtual device table for the keymap
***** initialize first entry in virtual device table to NULL
**** asdf_virtual_add_device()
***** 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
* DIP SWITCHES
Note that the DIP switches are keys in the key matrix, which is initialized to
the all unpressed state at startup. Since the keymap is initialized to 0, the
keymap is consistent with the presumed initial state of the DIP switches. If
the DIP switches are not set to Keymap 0, then their position will be detected
as keypresses, and the correct keymap will be set.

View File

@ -41,7 +41,6 @@
#include <stdint.h>
#include "asdf_config.h"
#include "asdf_keymap_defs.h"
// Tick is true every 1 ms.
static volatile uint8_t tick = 0;
@ -682,6 +681,25 @@ void asdf_arch_pulse_delay_long(void)
_delay_ms(ASDF_PULSE_DELAY_LONG_MS);
}
// PROCEDURE: asdf_arch_delay_ms
// INPUTS: (uint16) delay_ms - the delay in msec.
// OUTPUTS: none
//
// DESCRIPTION: Delays a specified number of milliseconds
//
// SIDE EFFECTS: see above.
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_delay_ms(uint16_t delay_ms)
{
for (uint16_t i=0; i < delay_ms; i++) {
_delay_ms(1);
}
}
// PROCEDURE: asdf_arch_init
// INPUTS: none
// OUTPUTS: none

View File

@ -349,7 +349,7 @@
#define TICK_COUNT 249
// Default key matrix row scanner
#define ASDF_ARCH_DEFAULT_SCANNER &asdf_arch_read_row
#define ASDF_ARCH_DEFAULT_ROW_SCANNER &asdf_arch_read_row
// Default keyboard output
#define ASDF_ARCH_DEFAULT_OUTPUT &asdf_arch_send_code
@ -475,6 +475,11 @@ void asdf_arch_pulse_delay_short(void);
// ASDF_PULSE_DELAY_LONG_MS
void asdf_arch_pulse_delay_long(void);
// PROCEDURE: asdf_arch_delay_ms
// INPUTS: (uint16) delay_ms - the delay in msec.
// OUTPUTS: none
// DESCRIPTION: Delays a specified number of milliseconds
void asdf_arch_delay_ms(uint16_t delay_ms);
// PROCEDURE: asdf_arch_tick
// INPUTS: none

View File

@ -39,8 +39,8 @@
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdint.h>
#include "asdf.h"
#include "asdf_config.h"
#include "asdf_keymap_defs.h"
static volatile uint8_t tick = 0;
@ -393,10 +393,10 @@ void asdf_arch_out1_open_lo_set(uint8_t value)
void asdf_arch_out2_set(uint8_t value)
{
if (value) {
clear_bit(&ASDF_OUT2_PORT, ASDF_OUT1_BIT);
clear_bit(&ASDF_OUT2_PORT, ASDF_OUT2_BIT);
}
else {
set_bit(&ASDF_OUT2_PORT, ASDF_OUT1_BIT);
set_bit(&ASDF_OUT2_PORT, ASDF_OUT2_BIT);
}
set_bit(&ASDF_OUT2_DDR, ASDF_OUT2_BIT);
}
@ -677,6 +677,25 @@ void asdf_arch_pulse_delay_long(void)
_delay_ms(ASDF_PULSE_DELAY_LONG_MS);
}
// PROCEDURE: asdf_arch_delay_ms
// INPUTS: (uint16) delay_ms - the delay in msec.
// OUTPUTS: none
//
// DESCRIPTION: Delays a specified number of milliseconds
//
// SIDE EFFECTS: see above.
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_delay_ms(uint16_t delay_ms)
{
for (uint16_t i=0; i < delay_ms; i++) {
_delay_ms(1);
}
}
// PROCEDURE: asdf_arch_init
// INPUTS: none
// OUTPUTS: none
@ -753,7 +772,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.
@ -768,7 +788,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

@ -254,7 +254,7 @@
// Default key matrix row scanner
#define ASDF_ARCH_DEFAULT_SCANNER asdf_arch_read_row
#define ASDF_ARCH_DEFAULT_ROW_SCANNER asdf_arch_read_row
// Default keyboard output
#define ASDF_ARCH_DEFAULT_OUTPUT asdf_arch_send_code
@ -376,6 +376,11 @@ void asdf_arch_pulse_delay_short(void);
// DESCRIPTION: Delays a fixed amount of time for keyboard output pulses specified by ASDF_PULSE_DELAY_LONG_MS
void asdf_arch_pulse_delay_long(void);
// PROCEDURE: asdf_arch_delay_ms
// INPUTS: (uint16) delay_ms - the delay in msec.
// OUTPUTS: none
// DESCRIPTION: Delays a specified number of milliseconds
void asdf_arch_delay_ms(uint16_t delay_ms);
// PROCEDURE: asdf_arch_tick
// INPUTS: none

View File

@ -35,10 +35,8 @@
#include <stdio.h>
#include <stdint.h>
#include "asdf_keymap_defs.h"
#include "asdf_config.h"
#include "asdf_physical.h"
#include "asdf_virtual.h"
#include "asdf_arch.h"
typedef enum {
@ -545,6 +543,23 @@ void asdf_arch_pulse_delay_long(void)
asdf_arch_pulse_delay();
}
// PROCEDURE: asdf_arch_delay_ms
// INPUTS: (uint16) delay_ms - the delay in msec.
// OUTPUTS: none
//
// DESCRIPTION: Delays a specified number of milliseconds
//
// SIDE EFFECTS: see above.
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_arch_delay_ms(uint16_t delay_ms)
{
asdf_arch_pulse_delay();
}
// PROCEDURE: asdf_arch_pulse_delay_short
// INPUTS: none
// OUTPUTS: none

View File

@ -28,11 +28,9 @@
#include <stdint.h>
#include "asdf.h"
#include "asdf_keymap_defs.h"
#include "asdf_config.h"
#include "asdf_physical.h"
#include "asdf_virtual.h"
#include "asdf_arch.h"
@ -58,7 +56,7 @@ typedef enum {
#define FLASH
#define FLASH_READ (a) (*(a))
#define FLASH_READ_MATRIX_ELEMENT(mat,row,col) (mat)[(row)][(col)]
#define ASDF_ARCH_DEFAULT_SCANNER asdf_arch_read_row
#define ASDF_ARCH_DEFAULT_ROW_SCANNER asdf_arch_read_row
#define ASDF_ARCH_DEFAULT_OUTPUT asdf_arch_send_code
// PROCEDURE: asdf_arch_pos_strobe
@ -199,6 +197,12 @@ asdf_cols_t asdf_arch_read_row(uint8_t row);
// be tested.
void asdf_arch_send_code(asdf_keycode_t);
// PROCEDURE: asdf_arch_delay_ms
// INPUTS: (uint16) delay_ms - the delay in msec.
// OUTPUTS: none
// DESCRIPTION: Delays a specified number of milliseconds
void asdf_arch_delay_ms(uint16_t delay_ms);
// PROCEDURE: asdf_arch_get_sent_code
// INPUTS: none
// OUTPUTS: returns type (asdf_keycode_t) in register and zeros the register.

View File

@ -1,71 +1,108 @@
set (KEYMAP "production")
message("C compiler: ${CMAKE_C_COMPILER}")
temporary_config_file(${ASDF_SRC_DIR}/Arch/asdf_arch_${ARCH}.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.h)
temporary_config_file(${ASDF_SRC_DIR}/Arch/asdf_arch_${ARCH}.c ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.c)
temporary_config_file(${ASDF_SRC_DIR}/Keymaps/asdf_all_keymap_defs_${KEYMAP}.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_defs.h)
function(create_keymap_setups keymaps keymap_table)
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\n case \\2: setup_\\1_keymap();break" 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_valid keymaps keymap_valid)
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\n case \\2:" 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_valid} "${temp_list}" PARENT_SCOPE)
endfunction(create_keymap_valid)
function(create_keymap_declarations keymaps keymap_decl)
list(TRANSFORM keymaps REPLACE "<\(.+\):\(.+\)>" "\n void setup_\\1_keymap(void)" 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}")
set(${keymap_report} "${temp_list2}" PARENT_SCOPE)
endfunction(create_keymap_report)
include(../keymap_list.cmake)
create_keymap_setups("${keymap_list}" keymap_table)
create_keymap_valid("${keymap_list}" keymap_valid)
create_keymap_report("${keymap_list}" keymap_report)
create_keymap_declarations("${keymap_list}" keymap_declarations)
message("**********************")
message("Keymap table: ${keymap_report}")
message("**********************\n\n")
set (PROJECT_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
configure_file(${PROJECT_SRC_DIR}/Arch/asdf_arch_${ARCH_FAMILY}.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.h COPYONLY)
configure_file(${PROJECT_SRC_DIR}/Arch/asdf_arch_${ARCH_FAMILY}.c ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.c COPYONLY)
configure_file(${PROJECT_SRC_DIR}/asdf_keymap_setup.c.in ${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_setup.c)
configure_file(${PROJECT_SRC_DIR}/asdf_keymap_setup.h.in ${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_setup.h)
list(APPEND C_FLAGS
-std=c99
-Wall
-funsigned-char
-funsigned-bitfields
-ffunction-sections
-fdata-sections
-fpack-struct
-fshort-enums
-O2
-Wall
-Wextra
-Wpointer-arith
-Wcast-align
-Wwrite-strings
-Wswitch-default
-Wunreachable-code
-Winit-self
-Wmissing-field-initializers
-Wno-unknown-pragmas
-Wstrict-prototypes
-Wundef
-Wold-style-definition
)
c_toolchain_flags()
list (APPEND SOURCES
asdf.c
${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.c
${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_setup.c
asdf_buffer.c
asdf_hook.c
asdf_keymap_setup.c
asdf_keymaps.c
asdf_modifiers.c
asdf_physical.c
asdf_repeat.c
asdf_virtual.c
asdf_print.c
Keymaps/asdf_keymap_classic.c
Keymaps/asdf_keymap_classic_caps.c
Keymaps/asdf_keymap_classic_add_map.c
Keymaps/asdf_keymap_apple2.c
Keymaps/asdf_keymap_apple2_caps.c
Keymaps/asdf_keymap_apple2_add_map.c
Keymaps/asdf_keymap_sol.c
Keymaps/asdf_keymap_ace1000.c
Keymaps/asdf_keymap_ace1000_add_map.c
main.c
)
# create a library for the keymap modules
#add_subdirectory(Keymaps)
# add the executable
if (COMMAND custom_add_executable)
custom_add_executable(${ASDF_TARGET_NAME}
custom_add_executable(${PROJECT_TARGET_NAME}
${SOURCES}
)
else()
add_executable(${ASDF_TARGET_NAME})
add_executable(${PROJECT_TARGET_NAME}
${SOURCES}
)
endif()
target_include_directories(${ASDF_EXECUTABLE_TARGET_NAME}
target_include_directories(${PROJECT_EXECUTABLE_TARGET_NAME}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Keymaps
)
target_compile_options(${ASDF_EXECUTABLE_TARGET_NAME}
target_compile_options(${PROJECT_EXECUTABLE_TARGET_NAME}
PRIVATE
${CFLAGS}
)
#target_link_libraries(${PROJECT_EXECUTABLE_TARGET_NAME}
# keymaps
# )

View 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
...

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

@ -0,0 +1,89 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_classic.c
//
// Implements the Franklin ACE 1000 replacement keyboard keymaps
// https://github.com/ryucats/Franklin-ACE-1000-Keyboard
//
// Copyright 2023 Chris RYU
// 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.h"
#include "asdf_keymaps.h"
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "asdf_print.h"
#include "asdf_keymap_ace1000.h"
#include "asdf_keymap_ace1000_add_map.h"
#include "asdf_keymap_apple2_add_map.h"
void ace1000_id_message(void) {
asdf_print("[Keymap: ace1000]\n");
}
// PROCEDURE:
// INPUTS:
// OUTPUTS:
//
// DESCRIPTION:
//
// SIDE EFFECTS:
//
// NOTES:
//
// SCOPE:
//
// COMPLEXITY:
//
void setup_ace1000_keymap(void)
{
asdf_set_print_delay(ASDF_ACE1000_PRINT_SPEED); //msec
ace1000_add_map(ACE1000_PLAIN_MAP, MOD_PLAIN_MAP);
ace1000_add_map(ACE1000_CAPS_MAP, MOD_CAPS_MAP);
ace1000_add_map(ACE1000_SHIFT_MAP, MOD_SHIFT_MAP);
ace1000_add_map(ACE1000_CTRL_MAP, MOD_CTRL_MAP);
asdf_hook_assign(ACE1000_ID_MESSAGE_HOOK, ace1000_id_message);
asdf_hook_assign(APPLESOFT_KEYBOARD_TEST_HOOK, ace1000_keyboard_test);
// Assign power LED to virtual power LED, and initialize to ON
asdf_virtual_assign(ACE1000_VIRTUAL_POWER_LED, ACE1000_POWER_LED, V_NOFUNC, ACE1000_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, ACE1000_CAPS_LED, V_NOFUNC, ACE1000_CAPS_LED_INIT_VALUE);
// assign RESET output to the virtual RESET output, configure to produce a short pulse when activated
asdf_virtual_assign(ACE1000_VIRTUAL_RESET, ACE1000_RESET_OUTPUT, V_PULSE_SHORT, !ACE1000_RESET_ACTIVE_VALUE);
// assign the CLRSCR output to the virtual CLRSCR output, configure to produce a long pulse when activated
asdf_virtual_assign(ACE1000_VIRTUAL_CLR_SCR, ACE1000_CLR_SCR_OUT, V_PULSE_LONG, !ACE1000_CLR_SCR_ACTIVE_VALUE);
// turn on caps lock
asdf_modifier_capslock_activate();
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,71 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_ace1000.h
//
// ASCII keymaps for the Franklin ACE 1000 replacement keyboard
// https://github.com/ryucats/Franklin-ACE-1000-Keyboard
//
// Copyright 2023 Chris RYU
// 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_ACE1000_H)
#define ASDF_KEYMAP_DEFS_ACE1000_H
#include "asdf_hook.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 ACE1000_NUM_ROWS 10 // DIP switches are row 8 (zero based)
#define ACE1000_NUM_COLS 8
#define ACE1000_ACTION_BREAK ACTION_NOTHING
#define ACE1000_VIRTUAL_RESET VOUT1
#define ACE1000_ACTION_RESET ACTION_VOUT1
#define ACE1000_RESET_OUTPUT PHYSICAL_OUT3_OPEN_HI
#define ACE1000_RESET_ACTIVE_VALUE 0
#define ACE1000_VIRTUAL_CLR_SCR VOUT2
#define ACE1000_ACTION_CLEAR ACTION_VOUT2
#define ACE1000_CLR_SCR_OUT PHYSICAL_OUT1_OPEN_LO
#define ACE1000_CLR_SCR_ACTIVE_VALUE 1
#define ACE1000_VIRTUAL_POWER_LED VLED1
#define ACE1000_POWER_LED PHYSICAL_LED1
#define ACE1000_POWER_LED_INIT_VALUE 1
#define ACE1000_CAPS_LED PHYSICAL_LED3
#define ACE1000_CAPS_LED_INIT_VALUE 0
#define ACE1000_ID_MESSAGE_HOOK ASDF_HOOK_USER_10
#define APPLESOFT_KEYBOARD_TEST_HOOK ASDF_HOOK_USER_9
#define ASDF_ACE1000_PRINT_SPEED 40
#endif /* !defined (ASDF_KEYMAP_DEFS_ACE1000_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,122 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_ace1000_add_map.c
//
// Keymap matrices used by the Franklin ACE 1000 replacement keyboard
// https://github.com/ryucats/Franklin-ACE-1000-Keyboard
//
// Copyright 2023 Chris RYU
// 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_arch.h"
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_print.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_ace1000.h"
#include "asdf_keymap_ace1000_add_map.h"
#include "asdf_keymap_defs_dipswitch.h"
// Key Matrix for the Franklin ACE 1000 replacement keyboard by Chris RYU
#define ASDF_ACE1000_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
typedef asdf_keycode_t ace1000_keycode_matrix_t[ACE1000_NUM_ROWS][ACE1000_NUM_COLS];
const FLASH ace1000_keycode_matrix_t ace1000_plain_matrix = {
[0] = { ACE_KEY_ESC, ACE_KEY_BREAK, ACE_KEY_PAUSE, ACTION_CTRL, ACE_KEY_TAB, ACTION_CAPS, ACTION_SHIFT, ACE_KEY_SPACE, },
[1] = { ACE_KEY_1, ACE_KEY_Q, ACE_KEY_A, ACE_KEY_Z, ACE_KEY_2, ACE_KEY_W, ACE_KEY_S, ACE_KEY_X, },
[2] = { ACE_KEY_3, ACE_KEY_E, ACE_KEY_D, ACE_KEY_C, ACE_KEY_4, ACE_KEY_R, ACE_KEY_F, ACE_KEY_V, },
[3] = { ACE_KEY_5, ACE_KEY_T, ACE_KEY_G, ACE_KEY_B, ACE_KEY_6, ACE_KEY_Y, ACE_KEY_H, ACE_KEY_N, },
[4] = { ACE_KEY_7, ACE_KEY_U, ACE_KEY_J, ACE_KEY_M, ACE_KEY_8, ACE_KEY_I, ACE_KEY_K, ACE_KEY_COMMA, },
[5] = { ACE_KEY_9, ACE_KEY_O, ACE_KEY_L, ACE_KEY_PERIOD, ACE_KEY_RIGHT, ACE_KEY_UNDERSCORE, ACE_KEY_PLUS, ACE_KEY_SPLAT, },
[6] = { ACE_KEY_0, ACE_KEY_P, ACE_KEY_SEMI, ACE_KEY_SLASH, ACE_KEY_7, ACE_KEY_4, ACE_KEY_1, ACE_KEY_GT, },
[7] = { ACE_KEY_MINUS, ACE_KEY_CURLY, ACE_KEY_QUOTE, ACTION_SHIFT, ACE_KEY_8, ACE_KEY_5, ACE_KEY_2, ACE_KEY_0, },
[9] = { ACE_KEY_SLASH, ACE_KEY_SQUARE, ACE_KEY_RETURN, ACE_KEY_LEFT, ACE_KEY_9, ACE_KEY_6, ACE_KEY_3, ACE_KEY_PERIOD, },
ASDF_ACE_DIP_SWITCHES,
};
const FLASH ace1000_keycode_matrix_t ace1000_shift_matrix = {
[0] = { ACE_KEY_SHIFT_ESC, ACE_KEY_SHIFT_BREAK, ACE_KEY_SHIFT_PAUSE, ACTION_CTRL, ACE_KEY_SHIFT_TAB, ACTION_CAPS, ACTION_SHIFT, ACE_KEY_SHIFT_SPACE, },
[1] = { ACE_KEY_SHIFT_1, ACE_KEY_SHIFT_Q, ACE_KEY_SHIFT_A, ACE_KEY_SHIFT_Z, ACE_KEY_SHIFT_2, ACE_KEY_SHIFT_W, ACE_KEY_SHIFT_S, ACE_KEY_SHIFT_X, },
[2] = { ACE_KEY_SHIFT_3, ACE_KEY_SHIFT_E, ACE_KEY_SHIFT_D, ACE_KEY_SHIFT_C, ACE_KEY_SHIFT_4, ACE_KEY_SHIFT_R, ACE_KEY_SHIFT_F, ACE_KEY_SHIFT_V, },
[3] = { ACE_KEY_SHIFT_5, ACE_KEY_SHIFT_T, ACE_KEY_SHIFT_G, ACE_KEY_SHIFT_B, ACE_KEY_SHIFT_6, ACE_KEY_SHIFT_Y, ACE_KEY_SHIFT_H, ACE_KEY_SHIFT_N, },
[4] = { ACE_KEY_SHIFT_7, ACE_KEY_SHIFT_U, ACE_KEY_SHIFT_J, ACE_KEY_SHIFT_M, ACE_KEY_SHIFT_8, ACE_KEY_SHIFT_I, ACE_KEY_SHIFT_K, ACE_KEY_SHIFT_COMMA, },
[5] = { ACE_KEY_SHIFT_9, ACE_KEY_SHIFT_O, ACE_KEY_SHIFT_L, ACE_KEY_SHIFT_PERIOD, ACE_KEY_SHIFT_RIGHT, ACE_KEY_SHIFT_UNDERSCORE, ACE_KEY_SHIFT_PLUS, ACE_KEY_SHIFT_SPLAT, },
[6] = { ACE_KEY_SHIFT_0, ACE_KEY_SHIFT_P, ACE_KEY_SHIFT_SEMI, ACE_KEY_SHIFT_SLASH, ACE_KEY_SHIFT_7, ACE_KEY_SHIFT_4, ACE_KEY_SHIFT_1, ACE_KEY_SHIFT_GT, },
[7] = { ACE_KEY_SHIFT_MINUS, ACE_KEY_SHIFT_CURLY, ACE_KEY_SHIFT_QUOTE, ACTION_SHIFT, ACE_KEY_SHIFT_8, ACE_KEY_SHIFT_5, ACE_KEY_SHIFT_2, ACE_KEY_SHIFT_0, },
[9] = { ACE_KEY_SHIFT_SLASH, ACE_KEY_SHIFT_SQUARE, ACE_KEY_RETURN, ACE_KEY_SHIFT_LEFT, ACE_KEY_SHIFT_9, ACE_KEY_SHIFT_6, ACE_KEY_SHIFT_3, ACE_KEY_SHIFT_PERIOD, },
ASDF_ACE_DIP_SWITCHES,
};
const FLASH ace1000_keycode_matrix_t ace1000_caps_matrix = {
[0] = { ACE_KEY_ESC, ACE_KEY_BREAK, ACE_KEY_PAUSE, ACTION_CTRL, ACE_KEY_TAB, ACTION_CAPS, ACTION_SHIFT, ACE_KEY_SPACE, },
[1] = { ACE_KEY_1, ACE_KEY_SHIFT_Q, ACE_KEY_SHIFT_A, ACE_KEY_SHIFT_Z, ACE_KEY_2, ACE_KEY_SHIFT_W, ACE_KEY_SHIFT_S, ACE_KEY_SHIFT_X, },
[2] = { ACE_KEY_3, ACE_KEY_SHIFT_E, ACE_KEY_SHIFT_D, ACE_KEY_SHIFT_C, ACE_KEY_4, ACE_KEY_SHIFT_R, ACE_KEY_SHIFT_F, ACE_KEY_SHIFT_V, },
[3] = { ACE_KEY_5, ACE_KEY_SHIFT_T, ACE_KEY_SHIFT_G, ACE_KEY_SHIFT_B, ACE_KEY_6, ACE_KEY_SHIFT_Y, ACE_KEY_SHIFT_H, ACE_KEY_SHIFT_N, },
[4] = { ACE_KEY_7, ACE_KEY_SHIFT_U, ACE_KEY_SHIFT_J, ACE_KEY_SHIFT_M, ACE_KEY_8, ACE_KEY_SHIFT_I, ACE_KEY_SHIFT_K, ACE_KEY_COMMA, },
[5] = { ACE_KEY_9, ACE_KEY_SHIFT_O, ACE_KEY_SHIFT_L, ACE_KEY_PERIOD, ACE_KEY_RIGHT, ACE_KEY_UNDERSCORE, ACE_KEY_PLUS, ACE_KEY_SPLAT, },
[6] = { ACE_KEY_0, ACE_KEY_SHIFT_P, ACE_KEY_SEMI, ACE_KEY_SLASH, ACE_KEY_7, ACE_KEY_4, ACE_KEY_1, ACE_KEY_GT, },
[7] = { ACE_KEY_MINUS, ACE_KEY_CURLY, ACE_KEY_QUOTE, ACTION_SHIFT, ACE_KEY_8, ACE_KEY_5, ACE_KEY_2, ACE_KEY_0, },
[9] = { ACE_KEY_SLASH, ACE_KEY_SQUARE, ACE_KEY_RETURN, ACE_KEY_LEFT, ACE_KEY_9, ACE_KEY_6, ACE_KEY_3, ACE_KEY_PERIOD, },
ASDF_ACE_DIP_SWITCHES,
};
const FLASH ace1000_keycode_matrix_t ace1000_ctrl_matrix = {
[0] = { ACE_KEY_ESC, ACE_KEY_BREAK, ACE_KEY_PAUSE, ACTION_CTRL, ACE_KEY_TAB, ACTION_CAPS, ACTION_SHIFT, ACE_KEY_SPACE, },
[1] = { ACE_KEY_CTRL_1, ACE_KEY_CTRL_Q, ACE_KEY_CTRL_A, ACE_KEY_CTRL_Z, ACE_KEY_CTRL_2, ACE_KEY_CTRL_W, ACE_KEY_CTRL_S, ACE_KEY_CTRL_X, },
[2] = { ACE_KEY_CTRL_3, ACE_KEY_CTRL_E, ACE_KEY_CTRL_D, ACE_KEY_CTRL_C, ACE_KEY_CTRL_4, ACE_KEY_CTRL_R, ACE_KEY_CTRL_F, ACE_KEY_CTRL_V, },
[3] = { ACE_KEY_CTRL_5, ACE_KEY_CTRL_T, ACE_KEY_CTRL_G, ACE_KEY_CTRL_B, ACE_KEY_CTRL_6, ACE_KEY_CTRL_Y, ACE_KEY_CTRL_H, ACE_KEY_CTRL_N, },
[4] = { ACE_KEY_CTRL_7, ACE_KEY_CTRL_U, ACE_KEY_CTRL_J, ACE_KEY_CTRL_M, ACE_KEY_CTRL_8, ACE_KEY_CTRL_I, ACE_KEY_CTRL_K, ACE_KEY_CTRL_COMMA, },
[5] = { ACE_KEY_CTRL_9, ACE_KEY_CTRL_O, ACE_KEY_CTRL_L, ACE_KEY_CTRL_PERIOD, ACE_KEY_CTRL_RIGHT, ACE_KEY_CTRL_UNDERSCORE, ACE_KEY_CTRL_PLUS, ACE_KEY_CTRL_SPLAT, },
[6] = { ACE_KEY_CTRL_0, ACE_KEY_CTRL_P, ACE_KEY_CTRL_SEMI, ACE_KEY_CTRL_SLASH, ACE_KEY_CTRL_7, ACE_KEY_CTRL_4, ACE_KEY_CTRL_1, ACE_KEY_CTRL_GT, },
[7] = { ACE_KEY_CTRL_MINUS, ACE_KEY_CTRL_CURLY, ACE_KEY_CTRL_QUOTE, ACTION_SHIFT, ACE_KEY_CTRL_8, ACE_KEY_CTRL_5, ACE_KEY_CTRL_2, ACE_KEY_CTRL_0, },
[9] = { ACE_KEY_CTRL_SLASH, ACE_KEY_CTRL_SQUARE, ACE_KEY_RETURN, ACE_KEY_CTRL_LEFT, ACE_KEY_CTRL_9, ACE_KEY_CTRL_6, ACE_KEY_CTRL_3, ACE_KEY_CTRL_PERIOD, },
ASDF_ACE_DIP_SWITCHES,
};
static const ace1000_keycode_matrix_t *ace1000_maps[] = {
[ACE1000_CAPS_MAP] = &ace1000_caps_matrix,
[ACE1000_PLAIN_MAP] = &ace1000_plain_matrix,
[ACE1000_SHIFT_MAP] = &ace1000_shift_matrix,
[ACE1000_CTRL_MAP] = &ace1000_ctrl_matrix,
};
void ace1000_add_map(const ace1000_map_index_t map_index,
modifier_index_t modifier_index)
{
asdf_keycode_t (*matrix)[ACE1000_NUM_COLS] =
(asdf_keycode_t (*)[ACE1000_NUM_COLS]) ace1000_maps[map_index];
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) ACE1000_NUM_ROWS,
(uint8_t) ACE1000_NUM_COLS);
}
void ace1000_keyboard_test(void)
{
asdf_print("10GETA$(0):A=ASC(A$(0)):A$(1)=\"CTL+\"+CHR$(A + 64):?\"'\";A$(A<32);\"' = \";A:IFA<>3GOTO10\r");
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,254 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_classic_add_map.h
//
// Keymap matrices and add_map() function for the Franklin ACE 1000 replacement keyboard
// https://github.com/ryucats/Franklin-ACE-1000-Keyboard
//
// Copyright 2023 Chris RYU
// 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_ACE1000_ADD_MAP_H)
#define ASDF_KEYMAP_ACE1000_ADD_MAP_H
#include "asdf_keymap_defs_dipswitch.h"
#include "asdf_modifiers.h"
typedef enum {
ACE1000_PLAIN_MAP,
ACE1000_CAPS_MAP,
ACE1000_SHIFT_MAP,
ACE1000_CTRL_MAP,
} ace1000_map_index_t;
// function prototypes
void ace1000_add_map(const ace1000_map_index_t map_index, modifier_index_t modifier_index);
void ace1000_keyboard_test(void);
#define ASDF_ACE_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
// Key value definitions
#define ACE_KEY_0 0x30
#define ACE_KEY_1 0x31
#define ACE_KEY_2 0x32
#define ACE_KEY_3 0x33
#define ACE_KEY_4 0x34
#define ACE_KEY_5 0x35
#define ACE_KEY_6 0x36
#define ACE_KEY_7 0x37
#define ACE_KEY_8 0x38
#define ACE_KEY_9 0x39
#define ACE_KEY_A 0x61
#define ACE_KEY_B 0x62
#define ACE_KEY_BREAK 0x03
#define ACE_KEY_C 0x63
#define ACE_KEY_COMMA 0x2c
#define ACE_KEY_CTRL_0 0x30
#define ACE_KEY_CTRL_1 0x31
#define ACE_KEY_CTRL_2 0x32
#define ACE_KEY_CTRL_3 0x33
#define ACE_KEY_CTRL_4 0x34
#define ACE_KEY_CTRL_5 0x35
#define ACE_KEY_CTRL_6 0x36
#define ACE_KEY_CTRL_7 0x37
#define ACE_KEY_CTRL_8 0x38
#define ACE_KEY_CTRL_9 0x39
#define ACE_KEY_CTRL_A 0x01
#define ACE_KEY_CTRL_B 0x02
#define ACE_KEY_CTRL_BREAK 0x03
#define ACE_KEY_CTRL_C 0x03
#define ACE_KEY_CTRL_COMMA 0x2c
#define ACE_KEY_CTRL_CURLY 0x7b
#define ACE_KEY_CTRL_D 0x04
#define ACE_KEY_CTRL_E 0x05
#define ACE_KEY_CTRL_ESC 0x1b
#define ACE_KEY_CTRL_F 0x06
#define ACE_KEY_CTRL_G 0x07
#define ACE_KEY_CTRL_H 0x08
#define ACE_KEY_CTRL_I 0x09
#define ACE_KEY_CTRL_J 0x0a
#define ACE_KEY_CTRL_K 0x0b
#define ACE_KEY_CTRL_L 0x0c
#define ACE_KEY_CTRL_LEFT 0x08
#define ACE_KEY_CTRL_M 0x0d
#define ACE_KEY_CTRL_N 0x0e
#define ACE_KEY_CTRL_NUM_0 0x30
#define ACE_KEY_CTRL_NUM_1 0x31
#define ACE_KEY_CTRL_NUM_2 0x32
#define ACE_KEY_CTRL_NUM_3 0x33
#define ACE_KEY_CTRL_NUM_4 0x34
#define ACE_KEY_CTRL_NUM_5 0x35
#define ACE_KEY_CTRL_NUM_6 0x36
#define ACE_KEY_CTRL_NUM_7 0x37
#define ACE_KEY_CTRL_NUM_8 0x38
#define ACE_KEY_CTRL_NUM_9 0x39
#define ACE_KEY_CTRL_GT 0x3e
#define ACE_KEY_CTRL_MINUS 0x2d
#define ACE_KEY_CTRL_SPLAT 0x2a
#define ACE_KEY_CTRL_NUM_PERIOD 0x2e
#define ACE_KEY_CTRL_NUM_PLUS 0x2b
#define ACE_KEY_CTRL_O 0x0f
#define ACE_KEY_CTRL_P 0x10
#define ACE_KEY_RETURN 0x0d
#define ACE_KEY_CTRL_PAUSE 0x13
#define ACE_KEY_CTRL_PERIOD 0x2e
#define ACE_KEY_CTRL_PLUS 0x3d
#define ACE_KEY_CTRL_Q 0x11
#define ACE_KEY_CTRL_SLASH 0x2f
#define ACE_KEY_CTRL_QUOTE 0x27
#define ACE_KEY_CTRL_R 0x12
#define ACE_KEY_CTRL_RIGHT 0x15
#define ACE_KEY_CTRL_S 0x13
#define ACE_KEY_CTRL_SEMI 0x3b
#define ACE_KEY_CTRL_SPACE 0x20
#define ACE_KEY_CTRL_SQUARE 0x1d
#define ACE_KEY_CTRL_T 0x14
#define ACE_KEY_CTRL_TAB 0x09
#define ACE_KEY_CTRL_U 0x15
#define ACE_KEY_CTRL_UNDERSCORE 0x3d
#define ACE_KEY_CTRL_V 0x16
#define ACE_KEY_CTRL_W 0x17
#define ACE_KEY_CTRL_X 0x18
#define ACE_KEY_CTRL_Y 0x19
#define ACE_KEY_CTRL_Z 0x1a
#define ACE_KEY_CURLY 0x7b
#define ACE_KEY_D 0x64
#define ACE_KEY_E 0x65
#define ACE_KEY_ESC 0x1b
#define ACE_KEY_F 0x66
#define ACE_KEY_G 0x67
#define ACE_KEY_H 0x68
#define ACE_KEY_I 0x69
#define ACE_KEY_J 0x6a
#define ACE_KEY_K 0x6b
#define ACE_KEY_L 0x6c
#define ACE_KEY_LEFT 0x08
#define ACE_KEY_M 0x6d
#define ACE_KEY_N 0x6e
#define ACE_KEY_NUM_0 0x30
#define ACE_KEY_NUM_1 0x31
#define ACE_KEY_NUM_2 0x32
#define ACE_KEY_NUM_3 0x33
#define ACE_KEY_NUM_4 0x34
#define ACE_KEY_NUM_5 0x35
#define ACE_KEY_NUM_6 0x36
#define ACE_KEY_NUM_7 0x37
#define ACE_KEY_NUM_8 0x38
#define ACE_KEY_NUM_9 0x39
#define ACE_KEY_GT 0x3e
#define ACE_KEY_MINUS 0x2d
#define ACE_KEY_SPLAT 0x2a
#define ACE_KEY_NUM_PERIOD 0x2e
#define ACE_KEY_NUM_PLUS 0x2b
#define ACE_KEY_O 0x6f
#define ACE_KEY_P 0x70
#define ACE_KEY_PAUSE 0x13
#define ACE_KEY_PERIOD 0x2e
#define ACE_KEY_PLUS 0x3d
#define ACE_KEY_Q 0x71
#define ACE_KEY_SLASH 0x2f
#define ACE_KEY_QUOTE 0x27
#define ACE_KEY_R 0x72
#define ACE_KEY_RIGHT 0x15
#define ACE_KEY_S 0x73
#define ACE_KEY_SEMI 0x3b
#define ACE_KEY_SHIFT_0 0x29
#define ACE_KEY_SHIFT_1 0x21
#define ACE_KEY_SHIFT_2 0x40
#define ACE_KEY_SHIFT_3 0x23
#define ACE_KEY_SHIFT_4 0x24
#define ACE_KEY_SHIFT_5 0x25
#define ACE_KEY_SHIFT_6 0x5e
#define ACE_KEY_SHIFT_7 0x26
#define ACE_KEY_SHIFT_8 0x2a
#define ACE_KEY_SHIFT_9 0x28
#define ACE_KEY_SHIFT_A 0x41
#define ACE_KEY_SHIFT_B 0x42
#define ACE_KEY_SHIFT_BREAK 0x03
#define ACE_KEY_SHIFT_C 0x43
#define ACE_KEY_SHIFT_COMMA 0x3c
#define ACE_KEY_SHIFT_CURLY 0x7d
#define ACE_KEY_SHIFT_D 0x44
#define ACE_KEY_SHIFT_E 0x45
#define ACE_KEY_SHIFT_ESC 0x1b
#define ACE_KEY_SHIFT_F 0x46
#define ACE_KEY_SHIFT_G 0x47
#define ACE_KEY_SHIFT_H 0x48
#define ACE_KEY_SHIFT_I 0x49
#define ACE_KEY_SHIFT_J 0x4a
#define ACE_KEY_SHIFT_K 0x4b
#define ACE_KEY_SHIFT_L 0x4c
#define ACE_KEY_SHIFT_LEFT 0x08
#define ACE_KEY_SHIFT_M 0x4d
#define ACE_KEY_SHIFT_N 0x4e
#define ACE_KEY_SHIFT_NUM_0 0x30
#define ACE_KEY_SHIFT_NUM_1 0x31
#define ACE_KEY_SHIFT_NUM_2 0x32
#define ACE_KEY_SHIFT_NUM_3 0x33
#define ACE_KEY_SHIFT_NUM_4 0x34
#define ACE_KEY_SHIFT_NUM_5 0x35
#define ACE_KEY_SHIFT_NUM_6 0x36
#define ACE_KEY_SHIFT_NUM_7 0x37
#define ACE_KEY_SHIFT_NUM_8 0x38
#define ACE_KEY_SHIFT_NUM_9 0x39
#define ACE_KEY_SHIFT_GT 0x3e
#define ACE_KEY_SHIFT_MINUS 0x2d
#define ACE_KEY_SHIFT_SPLAT 0x2a
#define ACE_KEY_SHIFT_NUM_PERIOD 0x2e
#define ACE_KEY_SHIFT_NUM_PLUS 0x2b
#define ACE_KEY_SHIFT_O 0x4f
#define ACE_KEY_SHIFT_P 0x50
#define ACE_KEY_SHIFT_PAUSE 0x13
#define ACE_KEY_SHIFT_PERIOD 0x3e
#define ACE_KEY_SHIFT_PLUS 0x2b
#define ACE_KEY_SHIFT_Q 0x51
#define ACE_KEY_SHIFT_SLASH 0x3f
#define ACE_KEY_SHIFT_QUOTE 0x22
#define ACE_KEY_SHIFT_R 0x52
#define ACE_KEY_SHIFT_RIGHT 0x15
#define ACE_KEY_SHIFT_S 0x53
#define ACE_KEY_SHIFT_SEMI 0x3a
#define ACE_KEY_SHIFT_SPACE 0x20
#define ACE_KEY_SHIFT_SQUARE 0x5d
#define ACE_KEY_SHIFT_T 0x54
#define ACE_KEY_SHIFT_TAB 0x09
#define ACE_KEY_SHIFT_U 0x55
#define ACE_KEY_SHIFT_UNDERSCORE 0x5f
#define ACE_KEY_SHIFT_V 0x56
#define ACE_KEY_SHIFT_W 0x57
#define ACE_KEY_SHIFT_X 0x58
#define ACE_KEY_SHIFT_Y 0x59
#define ACE_KEY_SHIFT_Z 0x5A
#define ACE_KEY_SPACE 0x20
#define ACE_KEY_SQUARE 0x5b
#define ACE_KEY_T 0x74
#define ACE_KEY_TAB 0x09
#define ACE_KEY_U 0x75
#define ACE_KEY_UNDERSCORE 0x2d
#define ACE_KEY_V 0x76
#define ACE_KEY_W 0x77
#define ACE_KEY_X 0x78
#define ACE_KEY_Y 0x79
#define ACE_KEY_Z 0x7a
#endif /* !defined (ASDF_KEYMAP_ACE1000_ADD_MAP_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,89 @@
// -*- 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_print.h"
#include "asdf_hook.h"
#include "asdf_keymaps.h"
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "asdf_keymap_apple2_add_map.h"
#include "asdf_keymap_apple2.h"
// PROCEDURE:
// INPUTS:
// OUTPUTS:
//
// DESCRIPTION:
//
// SIDE EFFECTS:
//
// NOTES:
//
// SCOPE:
//
// COMPLEXITY:
//
void apple2_id_message(void)
{
asdf_print("[Keymap: Apple 2 (u/l case)]");
}
void setup_apple2_keymap(void)
{
asdf_set_print_delay(APPLE2_PRINT_DELAY);
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_hook_assign(APPLESOFT_KEYBOARD_TEST, applesoft_keyboard_test);
asdf_hook_assign(APPLE2_ID_MESSAGE, apple2_id_message);
// 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.
asdf_virtual_assign(VCAPS_LED, APPLE_POWER_LED, V_NOFUNC, APPLE_POWER_LED_INIT_VALUE);
// Assign CAPS LED to off (disabled)
asdf_virtual_assign(APPLE_VIRTUAL_DISABLED_LED, APPLE_DISABLED_LED, V_NOFUNC, APPLE_DISABLED_INIT_VALUE);
// 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);
asdf_modifier_capslock_activate(); // For Apple 2, start with CAPS active
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,54 @@
// -*- 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
#include "asdf_hook.h"
#define APPLESOFT_KEYBOARD_TEST ASDF_HOOK_USER_3
#define APPLE2_ID_MESSAGE ASDF_HOOK_USER_10
#define APPLE2_ASCII_TEST ASDF_HOOK_USER_11
#define APPLE2_PRINT_DELAY 40 // msec
#endif /* !defined (ASDF_KEYMAP_DEFS_APPLE2_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,171 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_classic.c
//
// defines the keymap matrices used by the "classic" ADM 3A style keymap variants
//
// 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_arch.h"
#include "asdf.h"
#include "asdf_print.h"
#include "asdf_ascii.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_apple2_add_map.h"
// Key Matrix for combination of ASCII controller and Apple 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
typedef asdf_keycode_t apple_keycode_matrix_t[ASDF_APPLE2_NUM_ROWS][ASDF_APPLE2_NUM_COLS];
const FLASH apple_keycode_matrix_t apple_plain_matrix = {
[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
};
const FLASH apple_keycode_matrix_t apple_shift_matrix = {
[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_AT, ASCII_RT_PAREN, ASCII_LT_PAREN },
[7] = { APPLE_LEFT_ARROW, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' },
ASDF_APPLE2_DIP_SWITCHES
};
const FLASH apple_keycode_matrix_t apple_caps_shift_matrix = {
[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, '=',
'*', ACTION_NOTHING, ASCII_RT_PAREN, ASCII_LT_PAREN },
[7] = { APPLE_LEFT_ARROW, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' },
ASDF_APPLE2_DIP_SWITCHES
};
const FLASH apple_keycode_matrix_t apple_caps_matrix = {
[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
};
const FLASH apple_keycode_matrix_t apple_ctrl_matrix = {
[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, ASCII_BACKSLASH,
ASCII_SPACE, ASCII_CTRL_Z, ASCII_CTRL_A, ASCII_CTRL_Q },
[2] = { ACTION_NOTHING, ASCII_LT_SQUARE_BRACE, 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, ASCII_RT_SQUARE_BRACE },
[6] = { ACTION_NOTHING, ACTION_NOTHING, APPLE_ACTION_RESET, ASCII_UNDERSCORE,
ACTION_NOTHING, ACTION_FN_10, ASCII_RT_CURLY_BRACE, ASCII_LT_CURLY_BRACE },
[7] = { ASCII_DEL, ASCII_GRAVE_ACCENT, ASCII_CARET, ACTION_FN_5,
ACTION_FN_4, ACTION_FN_3, ASCII_TILDE, ASCII_VERT_BAR },
ASDF_APPLE2_DIP_SWITCHES
};
static const apple_keycode_matrix_t *apple_maps[] = {
[APPLE_CAPS_MAP] = &apple_caps_matrix,
[APPLE_PLAIN_MAP] = &apple_plain_matrix,
[APPLE_SHIFT_MAP] = &apple_shift_matrix,
[APPLE_CTRL_MAP] = &apple_ctrl_matrix,
[APPLE_CAPS_SHIFT_MAP] = &apple_caps_shift_matrix
};
void applesoft_keyboard_test(void)
{
asdf_print("10GETA$(0):A=ASC(A$(0)):A$(1)=\"CTL+\"+CHR$(A + 64):?\"'\";A$(A<32);\"' = \";A:IFA<>3GOTO10\r");
}
void apple_add_map(const apple_map_index_t map_index,
modifier_index_t modifier_index)
{
asdf_keycode_t (*matrix)[ASDF_APPLE2_NUM_COLS] =
(asdf_keycode_t (*)[ASDF_APPLE2_NUM_COLS]) apple_maps[map_index];
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) ASDF_APPLE2_NUM_ROWS,
(uint8_t) ASDF_APPLE2_NUM_COLS);
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,80 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_apple_add_map.h
//
// defines keymap matrices and add_map() function for apple2 layouts
//
// 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_APPLE_ADD_MAP_H)
#define ASDF_KEYMAP_APPLE_ADD_MAP_H
#include "asdf_keymap_defs_dipswitch.h"
#include "asdf_modifiers.h"
#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 0 // Toggles when caps lock is activated
#define APPLE_VIRTUAL_DISABLED_LED VLED2
#define APPLE_DISABLED_LED PHYSICAL_LED3
#define APPLE_DISABLED_INIT_VALUE 0
#define ASDF_APPLE2_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
#define APPLE_LEFT_ARROW ASCII_CTRL_H
#define APPLE_RIGHT_ARROW ASCII_CTRL_U
typedef enum {
APPLE_PLAIN_MAP,
APPLE_CAPS_MAP,
APPLE_SHIFT_MAP,
APPLE_CAPS_SHIFT_MAP,
APPLE_CTRL_MAP
} apple_map_index_t;
// function prototypes
void applesoft_keyboard_test(void);
void apple_add_map(const apple_map_index_t map_index, modifier_index_t modifier_index);
#endif /* !defined (ASDF_KEYMAP_APPLE_ADD_MAP_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,80 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_apple2_caps.c
//
// set up keymaps for ALL CAPS 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_print.h"
#include "asdf_keymaps.h"
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "asdf_keymap_apple2_add_map.h"
#include "asdf_keymap_apple2_caps.h"
void apple2_caps_id_message(void) {
asdf_print("[Keymap: Apple 2 CAPS]");
}
// PROCEDURE: setup_apple2_caps_keymap
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Set up keymaps for ALL CAPS apple 2 keyboard
//
// SIDE EFFECTS: See DESCRIPTION
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void setup_apple2_caps_keymap(void)
{
asdf_set_print_delay(APPLE2_PRINT_DELAY);
apple_add_map(APPLE_CAPS_MAP, MOD_PLAIN_MAP);
apple_add_map(APPLE_CAPS_MAP, MOD_CAPS_MAP);
apple_add_map(APPLE_CAPS_SHIFT_MAP, MOD_SHIFT_MAP);
apple_add_map(APPLE_CTRL_MAP, MOD_CTRL_MAP);
asdf_hook_assign(APPLESOFT_KEYBOARD_TEST, applesoft_keyboard_test);
asdf_hook_assign(APPLE2_CAPS_ID_MESSAGE, apple2_caps_id_message);
// Turn the POWER LED on and don't assign to any function
asdf_virtual_assign(APPLE_VIRTUAL_POWER_LED, APPLE_POWER_LED, V_NOFUNC, APPLE_POWER_LED_INIT_VALUE);
// Assign CAPS LED to off (disabled)
asdf_virtual_assign(APPLE_VIRTUAL_DISABLED_LED, APPLE_DISABLED_LED, V_NOFUNC, APPLE_DISABLED_INIT_VALUE);
// 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.

View File

@ -0,0 +1,51 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_apple2_caps.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_CAPS_H)
#define ASDF_KEYMAP_DEFS_APPLE2_CAPS_H
#define APPLESOFT_KEYBOARD_TEST ASDF_HOOK_USER_9
#define APPLE2_CAPS_ID_MESSAGE ASDF_HOOK_USER_10
#define APPLE2_PRINT_DELAY 40 // msec
#endif /* !defined (ASDF_KEYMAP_DEFS_APPLE2_CAPS_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View 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.

View File

@ -0,0 +1,84 @@
// -*- 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.h"
#include "asdf_keymaps.h"
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "asdf_print.h"
#include "asdf_keymap_classic.h"
#include "asdf_keymap_classic_add_map.h"
#include "asdf_keymap_apple2_add_map.h"
void classic_id_message(void) {
asdf_print("[Keymap: classic]\n");
}
// PROCEDURE:
// INPUTS:
// OUTPUTS:
//
// DESCRIPTION:
//
// SIDE EFFECTS:
//
// NOTES:
//
// SCOPE:
//
// COMPLEXITY:
//
void setup_classic_keymap(void)
{
asdf_set_print_delay(ASDF_CLASSIC_PRINT_SPEED); //msec
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_hook_assign(CLASSIC_ID_MESSAGE_HOOK, classic_id_message);
asdf_hook_assign(APPLESOFT_KEYBOARD_TEST_HOOK, applesoft_keyboard_test);
// 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);
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,69 @@
// -*- 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 "asdf_hook.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 CLASSIC_NUM_ROWS 9 // DIP switches are row 8 (zero based)
#define 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
#define CLASSIC_ID_MESSAGE_HOOK ASDF_HOOK_USER_10
#define APPLESOFT_KEYBOARD_TEST_HOOK ASDF_HOOK_USER_9
#define ASDF_CLASSIC_PRINT_SPEED 40
#endif /* !defined (ASDF_KEYMAP_DEFS_ASCII_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,156 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_classic.c
//
// defines the keymap matrices used by the "classic" ADM 3A style keymap variants
//
// 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_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"
#include "asdf_keymap_defs_dipswitch.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
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] = { 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 },
[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
};
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] = { 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', '>' },
[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
};
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] = { 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 },
[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
};
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] = { 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 },
[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
};
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_map_index_t map_index,
modifier_index_t modifier_index)
{
asdf_keycode_t (*matrix)[CLASSIC_NUM_COLS] =
(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);
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,50 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_classic_add_map.h
//
// defines keymap matrices and add_map() function for classic layouts
//
// 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_CLASSIC_ADD_MAP_H)
#define ASDF_KEYMAP_CLASSIC_ADD_MAP_H
#include "asdf_modifiers.h"
typedef enum {
CLASSIC_PLAIN_MAP,
CLASSIC_CAPS_MAP,
CLASSIC_SHIFT_MAP,
CLASSIC_CTRL_MAP,
} classic_map_index_t;
// 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) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,87 @@
// -*- 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.h"
#include "asdf_keymaps.h"
#include "asdf_print.h"
#include "asdf_virtual.h"
#include "asdf_modifiers.h"
#include "asdf_keymap_classic.h"
#include "asdf_keymap_classic_add_map.h"
#include "asdf_keymap_apple2_add_map.h"
void classic_caps_id_message(void) {
asdf_print("[Keymap: classic]\n");
}
// PROCEDURE:
// INPUTS:
// OUTPUTS:
//
// DESCRIPTION:
//
// SIDE EFFECTS:
//
// NOTES:
//
// SCOPE:
//
// COMPLEXITY:
//
void setup_classic_caps_keymap(void)
{
asdf_set_print_delay(ASDF_CLASSIC_PRINT_SPEED);
// 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_hook_assign(CLASSIC_ID_MESSAGE_HOOK, classic_caps_id_message);
asdf_hook_assign(APPLESOFT_KEYBOARD_TEST_HOOK, applesoft_keyboard_test);
// 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

@ -135,7 +135,7 @@
// 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
// Row 9 DIP switches 0-7
//
// Notes:
//

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

@ -31,6 +31,7 @@
[1] = ACTION_MAPSEL_1, \
[2] = ACTION_MAPSEL_2, \
[3] = ACTION_MAPSEL_3, \
[5] = ACTION_FN_11, \
[6] = ACTION_STROBE_POLARITY_SELECT, \
[7] = ACTION_AUTOREPEAT_SELECT, \
}

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

@ -0,0 +1,187 @@
// -*- 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/>.
//
#include "asdf_arch.h"
#include "asdf_keymap_sol.h"
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "asdf_keymaps.h"
#include "asdf_print.h"
#define SOL_PRINT_DELAY 40 // msec
#define SOL_ID_MESSAGE_HOOK ASDF_HOOK_USER_10
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)[ASDF_SOL_NUM_COLS],
modifier_index_t modifier_index)
{
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) ASDF_SOL_NUM_ROWS,
(uint8_t) ASDF_SOL_NUM_COLS);
}
static void sol_id_message(void)
{
asdf_print("[Keybd: Sol-20]");
}
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_set_print_delay(SOL_PRINT_DELAY);
// 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, SOL_KBD_TTLOUT_BREAK, 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();
asdf_hook_assign(SOL_ID_MESSAGE_HOOK, sol_id_message);
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,127 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymaps_sol.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_SOL_H)
#define ASDF_KEYMAP_SOL_H
#include "asdf.h"
#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_SOL_NUM_ROWS 13 // DIP switches are row 9
#define ASDF_SOL_NUM_COLS 8
// Key Matrix for combination of ASCII controller (ATMega328P version) and Classic ASCII matrix
//
// Col-> 0 1 2 3 4 5 6 7
// Row 0 Lt Ctrl ShiftLock A S D F G(alpha) H
// Row 1 J K L ;(semi) :(colon) DEL Repeat Rt Ctrl
// Row 2 UpperCase Lt Shift Z X C V B(alpha) N
// Row 3 M ,(comma) .(period) /(slash) Rt Shift ModeSelect
// Row 4 ESC 1 2 3 4 5 6(six) 7
// Row 5 8(eight) 9 0(zero) -(Dash) ^(Caret) [ \ ]
// Row 6 BREAK TAB Q W E R T Y
// Row 7 U I O(alpha) P @(at) Return LineFeed Load
// Row 9 LOCAL UpArrow LtArrow Spacebar RtArrow DnArrow Home Clear
// Row 10 NP-Minus NP-7 NP-Times NP-8 NP-Divide NP-9 (none) (none)
// Row 11 NP-4 NP-1 NP-5 NP-2 NP-6 NP-3 (none) (none)
// Row 12 NP-0 NP-period NP-Plus
//
// Row 8 DIP switches 0-7
//
// Physical Resource mapping:
// LED1: UPPER CASE
// LED2: LOCAL
// LED3: SHIFT LOCK
// OUT1: RESET
// OUT2: BREAK
// OUT3: LOCAL
// Notes:
//
// 1) To ensure consistent DIP switch operation within the keymap, a
// ASDF_SOL_DIP_SWITCHES macro is defined. Keeping the ACTION_MAPSEL0-3
// definitions in positions 0-3 ensures consistent map selection among all
// keymaps.
#define SOL_PRINT_DELAY 40 // msec
#define SOL_ID_MESSAGE_HOOK ASDF_HOOK_USER_10
#define SOL_NUM_ROWS 13
#define SOL_NUM_COLS 8
#define SOL_KBD_VRESET VOUT1
#define SOL_KBD_VBREAK VOUT2
#define SOL_KBD_VLOCAL VOUT3
#define SOL_KBD_LED_ON 1
#define SOL_KBD_LED_OFF 0
// The SOL manual (sec. 7.7.8) indicates shiftlock locks SHIFT on, and SHIFT
// returns to unshifted. For Toggle behavior, change to ACTION_SHIFTLOCK_TOGGLE.
#define SOL_KBD_SHIFTLOCK_ACTION ACTION_SHIFTLOCK_ON
// The weird C preprocessor expansion behavior requires one dereference for each
// expansion.
#define SOL_KBD_VIRTUAL_SUB1(SOL_VDEVICE) ACTION_ ## SOL_VDEVICE
#define SOL_KBD_VIRTUAL_SUB(SOL_VDEVICE) SOL_KBD_VIRTUAL_SUB1(SOL_VDEVICE)
#define SOL_KBD_LOCAL_ACTION SOL_KBD_VIRTUAL_SUB(SOL_KBD_VLOCAL)
#define SOL_KBD_RESET_ACTION SOL_KBD_VIRTUAL_SUB(SOL_KBD_VRESET)
#define SOL_KBD_BREAK_ACTION SOL_KBD_VIRTUAL_SUB(SOL_KBD_VBREAK)
#define SOL_ASCII_LOAD 0x8C
#define SOL_ASCII_MODE_SELECT 0x80
#define SOL_ASCII_UP_ARROW 0x97
#define SOL_ASCII_LT_ARROW 0x81
#define SOL_ASCII_RT_ARROW 0x93
#define SOL_ASCII_DN_ARROW 0x9a
#define SOL_ASCII_HOME 0x8e
#define SOL_ASCII_CLEAR 0x8b
#define SOL_KBD_TTL_HIGH 1
#define SOL_KBD_TTL_LOW 0
#define SOL_KBD_LED_UPPERCASE PHYSICAL_LED1
#define SOL_KBD_LED_LOCAL PHYSICAL_LED2
#define SOL_KBD_LED_SHIFTLOCK PHYSICAL_LED3
#define SOL_KBD_TTLOUT_RESET PHYSICAL_OUT3_OPEN_HI // Emulate open collector output.
#define SOL_KBD_TTLOUT_BREAK PHYSICAL_OUT2
#define SOL_KBD_TTLOUT_LOCAL PHYSICAL_OUT1
#define ASDF_SOL_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES
#endif /* !defined (ASDF_KEYMAP_SOL_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,14 @@
// PROCEDURE:
// INPUTS:
// OUTPUTS:
//
// DESCRIPTION:
//
// SIDE EFFECTS:
//
// NOTES:
//
// SCOPE:
//
// COMPLEXITY:
//

View File

@ -30,13 +30,13 @@
// 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 <stdio.h>
#include <stdint.h>
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_physical.h"
#include "asdf_virtual.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "asdf_repeat.h"
#include "asdf_modifiers.h"
#include "asdf_buffer.h"
@ -45,7 +45,7 @@
// The key scanner keeps track of the last stable (debounced) state of each key
// in the matrix, one bit per key, 8 bits per row.
static asdf_cols_t last_stable_key_state[ASDF_NUM_ROWS];
static asdf_cols_t last_stable_key_state[ASDF_MAX_ROWS];
// Each key is debounced separately, supporting true N-key rollover, allowing a
// new key to be pressed when the previously pressed key is still debouncing.
@ -56,7 +56,7 @@ static asdf_cols_t last_stable_key_state[ASDF_NUM_ROWS];
// key presses and releases, and special handling for modifier keys, perhaps
// including separate debounce logic in the handlers for toggle keys such as
// CAPS_LOCK.
static uint8_t debounce_counters[ASDF_NUM_ROWS][ASDF_NUM_COLS];
static uint8_t debounce_counters[ASDF_MAX_ROWS][ASDF_MAX_COLS];
// Stores the last key pressed
static asdf_keycode_t last_key;
@ -64,6 +64,14 @@ static asdf_keycode_t last_key;
// This is the handle for the char output buffer
static asdf_buffer_handle_t asdf_keycode_buffer;
// This is the handle for the message output buffer
static asdf_buffer_handle_t asdf_message_buffer;
// The delay time for strings sent via parallel port. This is needed because
// most keyboards have no handshaking, and we need to allow time for various
// environments to process the characters. Some, such as basic interpreters, are
// rather slow. So we we allow keyboard modules to modifiy this delay.
static uint16_t asdf_print_delay_ms;
// PROCEDURE: asdf_put_code
// INPUTS: (asdf_keycode_t) code: code to be buffered for output
@ -84,11 +92,13 @@ void asdf_put_code(asdf_keycode_t code)
asdf_buffer_put(asdf_keycode_buffer, code);
}
// PROCEDURE: asdf_next_code
// INPUTS: none
// OUTPUTS: (asdf_keycode_t) returns next value in buffer.
// PROCEDURE: asdf_putc
// INPUTS: (char) c: character to be buffered for output
// (FILE *) stream - only used to match prototype.
// OUTPUTS: none
//
// DESCRIPTION: Takes a keycode argument and buffers for output.
// DESCRIPTION: Takes a character generated by the system and buffers for
// output.
//
// SIDE EFFECTS: modifies buffer state.
//
@ -98,9 +108,68 @@ void asdf_put_code(asdf_keycode_t code)
//
// COMPLEXITY: 1
//
int asdf_putc(char c, FILE *stream)
{
// for messages, add CR to LF:
if ('\n' == c) {
asdf_putc('\r', stream);
}
asdf_buffer_put(asdf_message_buffer, (asdf_keycode_t) c);
return (int) c;
}
// PROCEDURE: asdf_next_code
// INPUTS: none
//
// OUTPUTS: (asdf_keycode_t) returns next value in buffer. If both buffers are
// empty, the code ASDF_INVALID_CODE is returned.
//
// DESCRIPTION: Checks the message buffer, and returns a character
// if present. Otherwise, return the next code in the keycode
// buffer.
//
// SIDE EFFECTS: modifies buffer state.
//
// NOTES: A delay is enforced for system messages, to reduce the risk of dropped
// characters with unbuffered polling hosts. No delay is needed for typed
// keycodes, as these are generated at human speeds.
//
// SCOPE: public
//
// COMPLEXITY: 2
//
asdf_keycode_t asdf_next_code(void)
{
return asdf_buffer_get(asdf_keycode_buffer);
asdf_keycode_t code = asdf_buffer_get(asdf_message_buffer);
if (ASDF_INVALID_CODE == code) {
code = asdf_buffer_get(asdf_keycode_buffer);
} else {
// for system message
asdf_arch_delay_ms(asdf_print_delay_ms);
}
return code;
}
// PROCEDURE: asdf_set_print_delay
// INPUTS: (uint8_t) delay_ms
//
// OUTPUTS: none
//
// DESCRIPTION: sets the delay to be used by the system print buffer
//
// SIDE EFFECTS: modifies character delay variable.
//
// NOTES: A delay is enforced for system messages, to reduce the risk of dropped
// characters with unbuffered polling hosts. No delay is needed for typed
// keycodes, as these are generated at human speeds.
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_set_print_delay(uint8_t delay_ms)
{
asdf_print_delay_ms = delay_ms;
}
// PROCEDURE: asdf_lookup_keycode
@ -238,15 +307,35 @@ static void asdf_activate_action(action_t keycode)
case ACTION_NOTHING:
case ACTION_HERE_IS:
case ACTION_FN_1:
asdf_hook_execute(ASDF_HOOK_USER_1);
break;
case ACTION_FN_2:
asdf_hook_execute(ASDF_HOOK_USER_2);
break;
case ACTION_FN_3:
asdf_hook_execute(ASDF_HOOK_USER_3);
break;
case ACTION_FN_4:
asdf_hook_execute(ASDF_HOOK_USER_4);
break;
case ACTION_FN_5:
asdf_hook_execute(ASDF_HOOK_USER_5);
break;
case ACTION_FN_6:
asdf_hook_execute(ASDF_HOOK_USER_6);
break;
case ACTION_FN_7:
asdf_hook_execute(ASDF_HOOK_USER_7);
break;
case ACTION_FN_8:
asdf_hook_execute(ASDF_HOOK_USER_8);
break;
case ACTION_FN_9:
asdf_hook_execute(ASDF_HOOK_USER_9);
break;
case ACTION_FN_10:
asdf_hook_execute(ASDF_HOOK_USER_10);
break;
default: break;
}
}
@ -374,42 +463,6 @@ static void asdf_deactivate_key(asdf_keycode_t keycode)
}
}
// PROCEDURE: asdf_init
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Reserve an output buffer to hold keycodes to be sent, and
// initialize the keyboard state and debounce counters
//
// SIDE EFFECTS: see DESCRIPTION
//
// SCOPE: public
//
// COMPLEXITY: 3
//
void asdf_init(void)
{
last_key = ACTION_NOTHING;
asdf_repeat_init(); // initialize the repeat counters
asdf_keymaps_init(); // initialize keymaps. This also initializes the modifier
// key states.
asdf_buffer_init(); // initialize the buffers
// reserve a buffer for the ASCII output:
asdf_keycode_buffer = asdf_buffer_new(ASDF_KEYCODE_BUFFER_SIZE);
// Initialize all the keys to the unpressed state, and initialze the debounce
// counters.
for (uint8_t row = 0; row < ASDF_NUM_ROWS; row++) {
last_stable_key_state[row] = 0;
for (uint8_t col = 0; col < ASDF_NUM_COLS; col++) {
debounce_counters[row][col] = ASDF_DEBOUNCE_TIME_MS;
}
}
}
// PROCEDURE: asdf_handle_key_press_or_release
// INPUTS: row, col: the row and column number of the key that has changed.
// OUTPUTS: none
@ -510,18 +563,16 @@ static void asdf_handle_key_held_pressed(uint8_t row, uint8_t col)
//
void asdf_keyscan(void)
{
asdf_cols_t (*row_reader)(uint8_t) = (asdf_cols_t(*)(uint8_t)) asdf_hook_get(ASDF_HOOK_SCANNER);
asdf_cols_t (*row_reader)(uint8_t) = (asdf_cols_t(*)(uint8_t)) asdf_hook_get(ASDF_HOOK_ROW_SCANNER);
asdf_hook_execute(ASDF_HOOK_EACH_SCAN);
for (uint8_t row = 0; row < ASDF_NUM_ROWS; row++) {
for (uint8_t row = 0; row < asdf_keymaps_num_rows(); row++) {
asdf_cols_t row_key_state = (*row_reader)(row);
asdf_cols_t changed = row_key_state ^ last_stable_key_state[row];
// loop over the bits until all changed or pressed keys in the row are handled.
for (uint8_t col = 0; (changed || row_key_state) && col < ASDF_NUM_COLS; col++) {
for (uint8_t col = 0; /*(changed || row_key_state) && */col < asdf_keymaps_num_cols(); col++) {
if (changed & 1) {
// key state is different from last stable state
asdf_handle_key_press_or_release(row, col, row_key_state & 1);
@ -535,5 +586,82 @@ void asdf_keyscan(void)
}
}
// PROCEDURE: asdf_apply_all_actions
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Scans the key matrix. For each row, read the columns, and for
// each bit, if an action is specified, then call the activate or deactivate
// function for that action, based on the key state. This is necessary to ensure
// that configuration settings, such as DIP switches and jumper settings, are
// properly handled when a keymap is changed.
// SIDE EFFECTS: See DESCRIPTION
//
// COMPLEXITY: 5
//
// SCOPE: private
//
void asdf_apply_all_actions(void)
{
asdf_cols_t (*row_reader)(uint8_t) = (asdf_cols_t(*)(uint8_t)) asdf_hook_get(ASDF_HOOK_ROW_SCANNER);
for (uint8_t row = 0; row < asdf_keymaps_num_rows(); row++) {
asdf_cols_t row_key_state = (*row_reader)(row);
// To avoid double actions, assign last stable key state to current state.
last_stable_key_state[row] = row_key_state;
// loop over the bits until all changed or pressed keys in the row are handled.
for (uint8_t col = 0; col < asdf_keymaps_num_cols(); col++) {
asdf_keycode_t code = asdf_lookup_keycode(row, col);
if (row_key_state & 1) {
asdf_activate_action(code);
} else {
asdf_deactivate_action(code);
}
row_key_state >>= 1;
}
}
}
// PROCEDURE: asdf_init
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Reserve an output buffer to hold keycodes to be sent, and
// initialize the keyboard state and debounce counters
//
// SIDE EFFECTS: see DESCRIPTION
//
// SCOPE: public
//
// COMPLEXITY: 3
//
void asdf_init(void)
{
last_key = ACTION_NOTHING;
asdf_buffer_init(); // initialize the buffers
asdf_repeat_init(); // initialize the repeat counters
asdf_keymaps_init(); // initialize keymaps. This also initializes the modifier
// key states.
// reserve a buffer for the ASCII output:
asdf_keycode_buffer = asdf_buffer_new(ASDF_KEYCODE_BUFFER_SIZE);
asdf_message_buffer = asdf_buffer_new(ASDF_MESSAGE_BUFFER_SIZE);
// Initialize all the keys to the unpressed state, and initialze the debounce
// counters.
for (uint8_t row = 0; row < ASDF_MAX_ROWS; row++) {
last_stable_key_state[row] = 0;
for (uint8_t col = 0; col < ASDF_MAX_COLS; col++) {
debounce_counters[row][col] = ASDF_DEBOUNCE_TIME_MS;
}
}
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -24,6 +24,9 @@
#if !defined(ASDF_H)
#define ASDF_H
#include <stdio.h>
#include <stdint.h>
// Define the code at which keyboard actions begin. Codes below this value are
// values to be transmitted to the host machine. Codes above this value are
// actions to be performed.
@ -32,8 +35,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
@ -78,6 +85,7 @@ typedef enum {
ACTION_FN_8,
ACTION_FN_9,
ACTION_FN_10,
ACTION_FN_11,
RESERVED_1,
RESERVED_2,
RESERVED_3,
@ -119,12 +127,36 @@ void asdf_keyscan(void);
// NOTES: If buffer is full, silently drop the code.
void asdf_put_code(asdf_keycode_t code);
// PROCEDURE: asdf_putc
// INPUTS: (char) c: character to be buffered for output
// (FILE*) stream: only for prototype matching
// OUTPUTS: none
// DESCRIPTION: Takes a character generated by the system and buffers for
// output.
// NOTES: If buffer is full, silently drop the code.
int asdf_putc(char c, FILE *stream);
// PROCEDURE: asdf_next_code
// INPUTS: none
// OUTPUTS: (asdf_keycode_t) returns next value in buffer.
// DESCRIPTION: Takes a keycode argument and buffers for output.
// OUTPUTS: (asdf_keycode_t) returns next value in buffer. If both buffers are
// empty, the code ASDF_INVALID_CODE is returned.
// DESCRIPTION: Checks the message buffer, and returns a character
// if present. Otherwise, return the next code in the keycode
// buffer.
// NOTES: A delay is enforced for system messages, to reduce the risk of dropped
// characters with unbuffered polling hosts. No delay is needed for typed
// keycodes, as these are generated at human speeds.
asdf_keycode_t asdf_next_code(void);
// PROCEDURE: asdf_set_print_delay
// INPUTS: (uint8_t) delay_ms
// OUTPUTS: none
// DESCRIPTION: sets the delay to be used by the system print buffer
// NOTES: A delay is enforced for system messages, to reduce the risk of dropped
// characters with unbuffered polling hosts. No delay is needed for typed
// keycodes, as these are generated at human speeds.
void asdf_set_print_delay(uint8_t delay_ms);
#endif // !defined (ASDF_H)

View File

@ -76,12 +76,15 @@ typedef enum {
ASCII_RT_SQUARE_BRACE = 0x5d,
ASCII_UNDERSCORE = 0x5f,
ASCII_BACKSLASH = 0x5c,
ASCII_CARET = 0x5e,
ASCII_GRAVE_ACCENT = 0x60,
ASCII_LT_CURLY_BRACE = 0x7b,
ASCII_RT_CURLY_BRACE = 0x7d,
ASCII_TILDE = 0x7e,
ASCII_VERT_BAR = 0x7c,
ASCII_DEL = 0x7f
ASCII_DEL = 0x7f,
ASCII_MAX_PRINTABLE = 0x7f,
ASCII_MIN_PRINTABLE = 0x20,
} ascii_defs_t;
#define ASCII_NULL 0

View File

@ -193,7 +193,7 @@ void asdf_buffer_put(asdf_buffer_handle_t handle, asdf_keycode_t code)
asdf_keycode_t asdf_buffer_get(asdf_buffer_handle_t handle)
{
asdf_keycode_t code = ASDF_INVALID_CODE;
if (buffers[handle].count) {
if (buffer_handle_valid(handle) && buffers[handle].count) {
code = buffers[handle].buf[buffers[handle].tail];
buffers[handle].tail = (buffers[handle].tail + 1) % buffers[handle].size;
buffers[handle].count--;

View File

@ -26,18 +26,16 @@
#if !defined(ASDF_BUFFER_H)
#define ASDF_BUFFER_H
// ASDF_BUFFER_POOL_SIZE is defined in asdf_config.h
#include "asdf_config.h"
// The total space available for all buffers used in the application
#define ASDF_BUFFER_POOL_SIZE ASDF_KEYCODE_BUFFER_SIZE
// Used to designate an invalid buffer.
#define ASDF_BUFFER_INVALID -1
// Setting the number of handles to 1 will work if only one buffer is requrired,
// and will save a few bytes of RAM. But the test code needs at least 2 buffer
// handles to test the module, so we leave it at 2.
#define ASDF_BUFFER_NUM_HANDLES 2
#define ASDF_BUFFER_NUM_HANDLES 4
// The buffer handle type should be able to handle the expected number of buffers.

View File

@ -47,9 +47,15 @@
#define ASDF_DEFAULT_SCREEN_CLEAR_POLARITY ASDF_POSITIVE_POLARITY
// Data structure sizes:
// size of the keycode output buffer.
#define ASDF_KEYCODE_BUFFER_SIZE 16
#define ASDF_MESSAGE_BUFFER_SIZE 128
#define ASDF_BUFFER_POOL_SIZE (ASDF_MESSAGE_BUFFER_SIZE + ASDF_KEYCODE_BUFFER_SIZE)
// key debounce period (in msec)
#define ASDF_DEBOUNCE_TIME_MS 10
@ -57,6 +63,11 @@
// Set to REPEAT_OFF for default no autorepeat by default.
#define ASDF_DEFAULT_REPEAT_STATE REPEAT_AUTO
// time to wait before sending consecutive message characters to the host, to
// ensure that messages are intact on hosts that poll the port without
// buffering. (in msec)
#define ASDF_MESSAGE_CHARACTER_DELAY 16 //msec
// time to hold down a key in milliseconds before autorepeat starts
#define ASDF_AUTOREPEAT_TIME_MS 525 // 525 msec.
@ -72,6 +83,9 @@
// DEFAULT value of keyboard outputs
#define ASDF_VIRTUAL_OUT_DEFAULT_VALUE 1 // High if not used.
// DEFAULT key scan routine
#define ASDF_DEFAULT_KEY_SCANNER asdf_keyscan
#endif /* !defined (CONFIG_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+

View File

@ -31,9 +31,9 @@
#include <stdint.h>
#include <stddef.h>
#include "asdf_config.h"
#include "asdf_arch.h"
#include "asdf_hook.h"
#include "asdf_keymap_defs.h"
// hooks_table[] contains all the function hooks. The entry for each ID contains
@ -133,11 +133,11 @@ asdf_hook_function_t asdf_hook_get(asdf_hook_id_t hook_id)
//
// NOTES:
//
// SCOPE: private
// SCOPE: public
//
// COMPLEXITY: 2
//
static void asdf_hook_assign(asdf_hook_id_t hook_id, asdf_hook_function_t func)
void asdf_hook_assign(asdf_hook_id_t hook_id, asdf_hook_function_t func)
{
if (asdf_hook_valid_id(hook_id)) {
hook_map[hook_id] = func;
@ -145,9 +145,7 @@ static void asdf_hook_assign(asdf_hook_id_t hook_id, asdf_hook_function_t func)
}
// PROCEDURE: asdf_hook_init
// INPUTS: (asdf_hook_initializer_t *) initializer_list - contains the hook
// initializer list for the selected keymap.
//
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Initializes function hooks for the selected keymap. If a
@ -162,27 +160,16 @@ static void asdf_hook_assign(asdf_hook_id_t hook_id, asdf_hook_function_t func)
//
// COMPLEXITY: 4
//
void asdf_hook_init(asdf_hook_initializer_t *const initializer_list)
void asdf_hook_init(void)
{
// initialize hooks to null function
for (uint8_t i = 0; i < ASDF_NUM_HOOKS; i++) {
hook_map[i] = &asdf_hook_null_func;
}
hook_map[ASDF_HOOK_SCANNER] = (asdf_hook_function_t) ASDF_ARCH_DEFAULT_SCANNER;
hook_map[ASDF_HOOK_ROW_SCANNER] = (asdf_hook_function_t) ASDF_ARCH_DEFAULT_ROW_SCANNER;
hook_map[ASDF_HOOK_OUTPUT] = (asdf_hook_function_t) ASDF_ARCH_DEFAULT_OUTPUT;
// run through the keymap specific setup
for (uint8_t i = 0; i < ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH; i++) {
asdf_hook_id_t id = initializer_list[i].hook_id;
if (ASDF_HOOK_KEYMAP_SETUP == id) {
initializer_list[i].hook_func();
}
else {
asdf_hook_assign(initializer_list[i].hook_id, initializer_list[i].hook_func);
}
}
hook_map[ASDF_HOOK_KEY_SCANNER] = (asdf_hook_function_t) ASDF_DEFAULT_KEY_SCANNER;
}
//-------|---------|---------+---------+---------+---------+---------+---------+

View File

@ -29,9 +29,21 @@
// keymap initializer commands.
typedef enum {
ASDF_HOOK_NULL,
ASDF_HOOK_SCANNER,
ASDF_HOOK_KEY_SCANNER,
ASDF_HOOK_ROW_SCANNER,
ASDF_HOOK_OUTPUT,
ASDF_HOOK_EACH_SCAN,
ASDF_HOOK_USER_1,
ASDF_HOOK_USER_2,
ASDF_HOOK_USER_3,
ASDF_HOOK_USER_4,
ASDF_HOOK_USER_5,
ASDF_HOOK_USER_6,
ASDF_HOOK_USER_7,
ASDF_HOOK_USER_8,
ASDF_HOOK_USER_9,
ASDF_HOOK_USER_10,
ASDF_HOOK_USER_11,
ASDF_NUM_HOOKS,
} asdf_hook_id_t;
@ -64,13 +76,21 @@ void asdf_hook_execute(asdf_hook_id_t hook_id);
asdf_hook_function_t asdf_hook_get(asdf_hook_id_t hook_id);
// PROCEDURE: asdf_hook_init
// INPUTS: (asdf_hook_initializer_t *) initializer_list - contains the hook
// initializer list for the selected keymap.
// INPUTS: none
// OUTPUTS: none
// DESCRIPTION: Initializes function hooks for the selected keymap. If a
// function is assigned to the "KEYMAP_SETUP" hook, then execute the function.
// There is no actual slot where KEYMAP_SETUP functions are stored.
void asdf_hook_init(asdf_hook_initializer_t *const initializer_list);
void asdf_hook_init(void);
// PROCEDURE: asdf_hook_assign
// INPUTS: (asdf_hook_id_t) hook_id: The hook for which to execute attache functions.
// (asdf_hook_function_t) func: function to be attached to the hook.
// OUTPUTS: none
// DESCRIPTION: If the hook ID is valid, map the function to the hook ID.
// Ignore if not valid.
void asdf_hook_assign(asdf_hook_id_t hook_id, asdf_hook_function_t func);
#endif /* !defined (ASDF_HOOKS_H) */

View File

@ -0,0 +1,92 @@
// -*- 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) {
default: @keymap_table@
}
}
// PROCEDURE: asdf_keymap_valid
//
// INPUTS: (uint8_t) index - index of the keymap setup function to check
// OUTPUTS: (uintu_t) returns TRUE (nonzero) if valid, FALSE (0) otherwise
//
// DESCRIPTION: This function returns TRUE if the index corresponds to
// a valid keymap.
//
// SIDE EFFECTS: none
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
uint8_t asdf_keymap_valid(uint8_t index) {
uint8_t valid = 0;
switch(index) { @keymap_valid@
valid = 1;
break;
default:
valid = 0;
break;
}
return valid;
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,47 @@
// -*- 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/>.
//
// 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);
// PROCEDURE: asdf_keymap_valid
// INPUTS: (uint8_t) index - index of the keymap setup function to check
// OUTPUTS: (uintu_t) returns TRUE (nonzero) if valid, FALSE (0) otherwise
// DESCRIPTION: This function returns TRUE if the index corresponds to
// a valid keymap.
uint8_t asdf_keymap_valid(uint8_t index);
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -21,97 +21,177 @@
// this program. If not, see <https://www.gnu.org/licenses/>.
#include <stdint.h>
#include <stddef.h>
#include "asdf_config.h"
#include "asdf.h"
#include "asdf_arch.h"
#include "asdf_physical.h"
#include "asdf_virtual.h"
#include "asdf_hook.h"
#include "asdf_repeat.h"
#include "asdf_keymap_setup.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "asdf_modifiers.h"
// ASDF_KEYMAP_DECLARATIONS is defined in asdf_keymap_defs.h, aggregated from
// all the included keymap definition files.
// The keymap array contains the keymap information for each modifier state
// This structure is populated using the asdf_keymaps_add_map() function.
static asdf_keycode_map_t keymaps[ASDF_MOD_NUM_MODIFIERS] = {};
// The current keymap index. This is stored so bitwise operators on the keymap index can be performed.
static uint8_t current_keyboard_index;
// PROCEDURE: asdf_keymaps_add_map
// INPUTS: (asdf_keycode_t *) - pointer to the keycode matrix to add in to map
// (uint8_t) modifier_index - the modifier value for the keycode matrix being added
// (uint8_t) rows - number of rows in the keymap
// (uint8_t) cols - number of columns in the keymap
//
// This is a terrible practice, but defining the declarations as a macro permits
// the keymap definitions to be incorporated in a fairly modular fashion, using
// the limited capabilities of the C preprocessor. One alternative is to use a
// program (in C or at the expense of additional build dependencies, in python
// or bash) to generate the keymap definitions and declarations from a
// definition file. But then the keymap declarations would not be private.
// constexpr in C++ may be an alternative option as well.
ASDF_KEYMAP_DECLARATIONS;
// The keymap arrays organized as follows:
// * Each keymap matrix is a NUM_ROWS x NUM_COLS mapping of key to code for a given modifier.
// * Each keymap contains a set of keymap matrices, one for each unique
// combination of modifier keys.
// * All the keymaps (NUM_KEYMAPS) are gathered in the keymap_matrixp[] array.
static keycode_matrix_t const *keymap_matrix[ASDF_NUM_KEYMAPS][ASDF_MOD_NUM_MODIFIERS] =
ASDF_KEYMAP_DEFS;
// Each keymap (representing a keyboard configuration) has an associated set of
// virtual device initializers that set up the I/O and LED lines for the
// keyboard, unique to each keymap. This builds the virtual device initializer
// array from the initializer definitions in the keymap definition files.
static const asdf_virtual_initializer_t keymap_initializer_list[ASDF_NUM_KEYMAPS]
[ASDF_KEYMAP_INITIALIZER_LENGTH] =
ASDF_KEYMAP_INITIALIZERS;
// Each keymap (representing a keyboard configuration) has an associated set of
// function hooks unique to the keyboard defined by the map. This builds the
// function hook initializer array from the definitions in the keymap definition
// files.
static const asdf_hook_initializer_t
keymap_hook_initializer_list[ASDF_NUM_KEYMAPS][ASDF_KEYMAP_HOOK_INITIALIZER_LENGTH] =
ASDF_KEYMAP_HOOK_INITIALIZERS;
// Index of the currently active keymap, initialized to zero in the init
// routine.
static uint8_t keymap_index;
// PROCEDURE: asdf_keymaps_select_keymap
// INPUTS: (uint8_t) index - index of the keymap number to select
// OUTPUTS: none
//
// DESCRIPTION: accepts a index value. If the requested keymap index is valid,
// then:
// 1) assign the value to the global (to the module) keymap_index variable
// 2) execute the architecture-dependent init routine, to undo any settings
// from the previous keymap
// 3) initialize the virtual outputs for the selected keymap.
// 4) initialize the modifier key states.
// DESCRIPTION: Called by keymap building modules. This routine adds a keymap to the current
// setup function into the keymap setup array.
//
// SIDE EFFECTS:
// - May change the module-global keymap_index variable.
// - Architecture is initialized to default configuration.
//
// NOTES: 1) If the requested index is not valid, then no action is performed.
// NOTES: If the keymap modifier index, num_rows, or num_cols are not valid then no
// action is performed.
//
// 2) Hooks are initialized after repeat apparratus and modifiers states
// are initialized, so that hooks can be used to modify default modifier
// states for a map.
// SCOPE: public
//
// COMPLEXITY: 1
void asdf_keymaps_add_map(const asdf_keycode_t *matrix,
modifier_index_t modifier_index,
uint8_t num_rows, uint8_t num_cols)
{
if ((modifier_index < ASDF_MOD_NUM_MODIFIERS)
&& (num_rows <= ASDF_MAX_ROWS)
&& (num_cols <= ASDF_MAX_COLS))
{
keymaps[modifier_index].matrix = (asdf_keycode_t *) matrix;
keymaps[modifier_index].rows = num_rows;
keymaps[modifier_index].cols = num_cols;
}
}
// PROCEDURE: asdf_keymaps_num_rows
// INPUTS: none
// OUTPUTS: uint8_t - returns number of rows in keymap for current modifier state
//
// DESCRIPTION: See OUTPUTS
//
// SIDE EFFECTS: none
//
// NOTES:
//
// SCOPE: publice
//
// COMPLEXITY: 1
//
uint8_t asdf_keymaps_num_rows(void)
{
return keymaps[asdf_modifier_index()].rows;
}
// PROCEDURE: asdf_keymaps_num_cols
// INPUTS: none
// OUTPUTS: uint8_t - returns number of columns in keymap for current modifier state
//
// DESCRIPTION: See OUTPUTS
//
// SIDE EFFECTS: none
//
// NOTES:
//
// SCOPE: publice
//
// COMPLEXITY: 1
//
uint8_t asdf_keymaps_num_cols(void)
{
return keymaps[asdf_modifier_index()].cols;
}
// PROCEDURE: asdf_keymaps_reset
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Reset keymaps to initial state:
// - Clear all keycode mapping matrices.
// - Clear all virtual devices
// - Reset all hooks to default state.
//
// SIDE EFFECTS: see DESCRIPTION
//
// SCOPE: private
//
// COMPLEXITY: 2
//
static void asdf_keymaps_reset(void)
{
// Clear all keycode mappings
for (uint8_t i = 0; i < ASDF_MOD_NUM_MODIFIERS; i++) {
asdf_keymaps_add_map((const asdf_keycode_t *) NULL, (modifier_index_t) i,
0, 0);
}
// Clear virtual devices
asdf_virtual_init();
// Reset hooks
asdf_hook_init();
}
// PROCEDURE: asdf_keymaps_switch
// INPUTS: (uint8_t) index - index of the keymap number to switch to
// OUTPUTS: none
//
// DESCRIPTION: accepts a index value.
// 1) assign the value to the global (to the module) current_keyboard_index variable
// 2) execute the architecture-dependent init routine, to undo any settings
// from the previous keymap
// 3) execute the keymap-specific setup routine.
//
// SIDE EFFECTS: See DESCRIPTION
//
// NOTES: If the requested index is not valid, then no action is performed.
//
// SCOPE: public
//
// COMPLEXITY: 2
//
void asdf_keymaps_select_keymap(uint8_t index)
void asdf_keymaps_switch(uint8_t index)
{
if (index < ASDF_NUM_KEYMAPS) {
keymap_index = index;
// we set the current keymap index in order to track the state of the DIP
// switches, but only switch to a valid map
if (asdf_keymap_valid(index)) {
current_keyboard_index = index;
asdf_arch_init();
asdf_keymaps_reset();
asdf_virtual_init((asdf_virtual_initializer_t *const) keymap_initializer_list[keymap_index]);
asdf_keymap_setup(index);
}
}
asdf_modifiers_init();
// PROCEDURE: asdf_keymaps_select
// INPUTS: (uint8_t) index - index of the keymap number to select
// OUTPUTS: none
//
// DESCRIPTION: accepts a index value. If the keyboard is different from the
// currently active keyboard, then attempt to switch to the new keyboard index
//
// SIDE EFFECTS: See DESCRIPTION
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 2
//
void asdf_keymaps_select(uint8_t index)
{
asdf_repeat_init();
asdf_hook_init((asdf_hook_initializer_t *const) keymap_hook_initializer_list[keymap_index]);
if (index != current_keyboard_index) {
asdf_keymaps_switch(index);
}
}
@ -119,23 +199,19 @@ void asdf_keymaps_select_keymap(uint8_t index)
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Selects the base keymap.
// DESCRIPTION: initialize the keymap list. Called at startup. This function
// switches to keyboard 0. The switch routine cleans up the keyboard data
// structures.
//
// SIDE EFFECTS: builds up the private map table.
// SIDE EFFECTS: See DESCRIPTION
//
// SCOPE: public
//
// NOTES: Note that the DIP switches are keys in the key matrix, which is
// initialized to the all unpressed state at startup. Since the keymap is
// initialized to 0, the keymap is consistent with the presumed initial state of
// the DIP switches. If the DIP switches are not set to Keymap 0, then their
// position will be detected as keypresses, and the correct keymap will be set.
// COMPLEXITY: 1
//
void asdf_keymaps_init(void)
{
asdf_keymaps_select_keymap(0);
asdf_keymaps_switch(0);
}
// PROCEDURE: asdf_keymaps_map_select_0_clear
@ -155,7 +231,7 @@ void asdf_keymaps_init(void)
//
void asdf_keymaps_map_select_0_clear(void)
{
asdf_keymaps_select_keymap(keymap_index & (~ASDF_KEYMAP_BIT_0));
asdf_keymaps_select(current_keyboard_index & (~ASDF_KEYMAP_BIT_0));
}
// PROCEDURE: asdf_keymaps_map_select_0_set
@ -175,7 +251,7 @@ void asdf_keymaps_map_select_0_clear(void)
//
void asdf_keymaps_map_select_0_set(void)
{
asdf_keymaps_select_keymap(keymap_index | ASDF_KEYMAP_BIT_0);
asdf_keymaps_select(current_keyboard_index | ASDF_KEYMAP_BIT_0);
}
// PROCEDURE: asdf_keymaps_map_select_1_clear
@ -195,7 +271,7 @@ void asdf_keymaps_map_select_0_set(void)
//
void asdf_keymaps_map_select_1_clear(void)
{
asdf_keymaps_select_keymap(keymap_index & (~ASDF_KEYMAP_BIT_1));
asdf_keymaps_select(current_keyboard_index & (~ASDF_KEYMAP_BIT_1));
}
// PROCEDURE: asdf_keymaps_map_select_1_set
@ -215,7 +291,7 @@ void asdf_keymaps_map_select_1_clear(void)
//
void asdf_keymaps_map_select_1_set(void)
{
asdf_keymaps_select_keymap(keymap_index | ASDF_KEYMAP_BIT_1);
asdf_keymaps_select(current_keyboard_index | ASDF_KEYMAP_BIT_1);
}
// PROCEDURE: asdf_keymaps_map_select_2_clear
@ -235,7 +311,7 @@ void asdf_keymaps_map_select_1_set(void)
//
void asdf_keymaps_map_select_2_clear(void)
{
asdf_keymaps_select_keymap(keymap_index & (~ASDF_KEYMAP_BIT_2));
asdf_keymaps_select(current_keyboard_index & (~ASDF_KEYMAP_BIT_2));
}
// PROCEDURE: asdf_keymaps_map_select_2_set
@ -255,7 +331,7 @@ void asdf_keymaps_map_select_2_clear(void)
//
void asdf_keymaps_map_select_2_set(void)
{
asdf_keymaps_select_keymap(keymap_index | ASDF_KEYMAP_BIT_2);
asdf_keymaps_select(current_keyboard_index | ASDF_KEYMAP_BIT_2);
}
// PROCEDURE: asdf_keymaps_map_select_3_clear
@ -275,7 +351,7 @@ void asdf_keymaps_map_select_2_set(void)
//
void asdf_keymaps_map_select_3_clear(void)
{
asdf_keymaps_select_keymap(keymap_index & (~ASDF_KEYMAP_BIT_3));
asdf_keymaps_select(current_keyboard_index & (~ASDF_KEYMAP_BIT_3));
}
// PROCEDURE: asdf_keymaps_map_select_3_set
@ -295,7 +371,7 @@ void asdf_keymaps_map_select_3_clear(void)
//
void asdf_keymaps_map_select_3_set(void)
{
asdf_keymaps_select_keymap(keymap_index | ASDF_KEYMAP_BIT_3);
asdf_keymaps_select(current_keyboard_index | ASDF_KEYMAP_BIT_3);
}
// PROCEDURE: asdf_keymaps_get_code
@ -318,9 +394,14 @@ void asdf_keymaps_map_select_3_set(void)
asdf_keycode_t asdf_keymaps_get_code(const uint8_t row, const uint8_t col,
const uint8_t modifier_index)
{
const keycode_matrix_t *matrix = keymap_matrix[keymap_index][modifier_index];
uint8_t num_cols = keymaps[current_keyboard_index].cols;
asdf_keycode_t keycode = 0;
return FLASH_READ_MATRIX_ELEMENT(*matrix, row, col);
if (keymaps[current_keyboard_index].cols && keymaps[current_keyboard_index].rows) {
asdf_keycode_t (*keycode_matrix)[num_cols] = (void *) (keymaps[modifier_index].matrix);
keycode = FLASH_READ_MATRIX_ELEMENT(keycode_matrix, row, col);
}
return keycode;
}
//-------|---------|---------+---------+---------+---------+---------+---------+

View File

@ -27,6 +27,11 @@
#if !defined(ASDF_KEYMAPS_H)
#define ASDF_KEYMAPS_H
#include "asdf.h"
#include "asdf_hook.h"
#include "asdf_virtual.h"
#include "asdf_physical.h"
#include "asdf_modifiers.h"
// Define the bit position of each keymap DIP switch. The DIP switch values at
// each bit position can be used to select the current keymap. This requires the
@ -37,13 +42,47 @@
#define ASDF_KEYMAP_BIT_2 4
#define ASDF_KEYMAP_BIT_3 8
// PROCEDURE: asdf_keymaps_select_keymap
// define the struct for each keymap matrix in the keymap array. One per
// modifier state. Each keymap can have it's own row and column count.
typedef struct {
asdf_keycode_t *matrix;
uint8_t rows;
uint8_t cols;
} asdf_keycode_map_t;
// PROCEDURE: asdf_keymaps_add_map
// INPUTS: (asdf_keycode_t *) matrix - pointer to the keycode matrix to add in to map
// (uint8_t) modifier_index - the modifier value for the keycode matrix being added
// (uint8_t) rows - number of rows in the keymap
// (uint8_t) cols - number of columns in the keymap
// OUTPUTS: none
// DESCRIPTION: Called by keymap building modules. This routine adds a keymap to the current
// setup function into the keymap setup array.
// NOTES: If the keymap modifier index, num_rows, or num_cols are not valid then no
// action is performed.
void asdf_keymaps_add_map(const asdf_keycode_t *matrix,
modifier_index_t modifier_index,
uint8_t num_rows, uint8_t num_cols);
// PROCEDURE: asdf_keymaps_num_rows
// INPUTS: none
// OUTPUTS: uint8_t - returns number of rows in keymap for current modifier state
// DESCRIPTION: See OUTPUTS
uint8_t asdf_keymaps_num_rows(void);
// PROCEDURE: asdf_keymaps_num_cols
// INPUTS: none
// OUTPUTS: uint8_t - returns number of columns in keymap for current modifier state
// DESCRIPTION: See OUTPUTS
uint8_t asdf_keymaps_num_cols(void);
// PROCEDURE: asdf_keymaps_select
// INPUTS: (uint8_t) index - index of the keymap number to select
// OUTPUTS: none
// DESCRIPTION: accepts a index value. If the requested keymap index is valid,
// then assign the value to the global (to the module) keymap_index variable. If
// requested index is not valid then do nothing.
void asdf_keymaps_select_keymap(uint8_t index);
void asdf_keymaps_select(uint8_t index);
// PROCEDURE: asdf_keymaps_map_select_0_clear
// INPUTS: none
@ -52,7 +91,6 @@ void asdf_keymaps_select_keymap(uint8_t index);
// keymap index.
void asdf_keymaps_map_select_0_clear(void);
// PROCEDURE: asdf_keymaps_map_select_0_set
// INPUTS: none
// OUTPUTS: none
@ -109,7 +147,28 @@ void asdf_keymaps_map_select_3_set(void);
// index, to avoid hard-coding constant index values.
void asdf_keymaps_init(void);
// PROCEDURE: asdf_keymaps_get_`code
// PROCEDURE: asdf_keymap_add_virtual_device
// INPUTS: (asdf_virtual_dev_t) virtual_dev: The virtual device being assigned
// (asdf_physical_dev_t) physical_dev: The physical device attached to the virtual device
// (asdf_virtual_function_t) function: the function associated with the virtual device
// (uint8_t) initial_value: The initial state of the virtual device
// OUTPUTS: none
// DESCRIPTION: Builds the virtual device initializer structure. Uses the
// arguments to build an entry in the virtual device initializer structure for
// the current keymap.
void asdf_keymap_add_virtual_device(asdf_virtual_dev_t virtual_dev,
asdf_physical_dev_t physical_dev,
asdf_virtual_function_t function, uint8_t initial_value);
// PROCEDURE: asdf_keymap_add_hook
// INPUTS: (asdf_hook_id_t) hook_id: type ID for the provided hook function
// (asdf_hook_function_t) function: the function associated with the hook.
// OUTPUTS: none
// DESCRIPTION: Builds the hook initializer table for the current keymap
void asdf_keymap_add_hook(asdf_hook_id_t hook_id, asdf_hook_function_t function);
// 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.

View File

@ -26,7 +26,6 @@
#include <stdint.h>
#include "asdf_physical.h"
#include "asdf_keymap_defs.h"
#include "asdf_config.h"
#include "asdf_arch.h"

View File

@ -25,6 +25,7 @@
#if !defined(ASDF_PHYSICAL_H)
#define ASDF_PHYSICAL_H
#include <stdint.h>
// The asdf_virtual_real_dev_t enumerates real outputs that can be assigned to
// virtual outputs via the asdf_virtual_assign() function. The name is a bit

View File

@ -0,0 +1,68 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// <asdf_print-filename>.c
//
// 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/>.
//
//
// Headers
//
#include <stdio.h>
#include <avr/io.h>
#include "asdf.h"
static FILE ascii_port = FDEV_SETUP_STREAM(asdf_putc, NULL,
_FDEV_SETUP_WRITE);
//
// Regular functions
//
// PROCEDURE: asdf_print
// INPUTS: (*char) fmt - format string
// va_arglist - list of args for fmt string
// OUTPUTS: none
//
// DESCRIPTION: output to ascii output port using vfprintf()
//
// SIDE EFFECTS: see DESCRIPTION
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
void asdf_print(char *fmt, ...)
{
va_list arg_ptr;
va_start(arg_ptr, fmt);
vfprintf(&ascii_port, fmt, arg_ptr);
va_end(arg_ptr);
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,37 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// asdf_print.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_PRINT_H)
#define ASDF_PRINT_H
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.
// PROCEDURE: asdf_print
// INPUTS: (*char) fmt - format string
// va_arglist - list of args for fmt string
// OUTPUTS: none
// DESCRIPTION: output to ascii output port using vfprintf()
// COMPLEXITY: 1
void asdf_print(const char *fmt, ...);
#endif /* !defined (ASDF_PRINT_H) */

View File

@ -30,7 +30,6 @@
#include <stdint.h>
#include "asdf_physical.h"
#include "asdf_virtual.h"
#include "asdf_keymap_defs.h"
#include "asdf_config.h"
#include "asdf_arch.h"
@ -177,14 +176,15 @@ static uint8_t valid_virtual_device(asdf_virtual_dev_t device)
//
// SIDE EFFECTS: see above.
//
// NOTES: if the virtual output is invalid, or the physical resource is invalid, or
// the physical resource is already assigned, then nothing happens.
// NOTES:
// if the virtual output is invalid, or the physical resource is invalid, or
// the physical resource is already assigned, then nothing happens.
//
// SCOPE: private
//
// COMPLEXITY: 3
//
static void asdf_virtual_assign(asdf_virtual_dev_t virtual_out, asdf_physical_dev_t physical_out,
void asdf_virtual_assign(asdf_virtual_dev_t virtual_out, asdf_physical_dev_t physical_out,
asdf_virtual_function_t function, uint8_t initial_value)
{
if (valid_virtual_device(virtual_out)) {
@ -199,8 +199,7 @@ static void asdf_virtual_assign(asdf_virtual_dev_t virtual_out, asdf_physical_de
}
// PROCEDURE: asdf_virtual_init
// INPUTS: (asdf_virtual_initializer_t *) initializer_list - contains the
// initializer list for the selected keymap.
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Initializes the LED and output mapping
@ -213,7 +212,7 @@ static void asdf_virtual_assign(asdf_virtual_dev_t virtual_out, asdf_physical_de
//
// COMPLEXITY: 4
//
void asdf_virtual_init(asdf_virtual_initializer_t *const initializer_list)
void asdf_virtual_init(void)
{
// initialize the physical resource table every time virtual output table is
// initialized.
@ -224,16 +223,22 @@ void asdf_virtual_init(asdf_virtual_initializer_t *const initializer_list)
virtual_device_table[i].function = V_NOFUNC;
virtual_device_table[i].physical_device = PHYSICAL_NO_OUT;
}
}
// run through the keymap specific setup
for (uint8_t i = 0; //
i < ASDF_KEYMAP_INITIALIZER_LENGTH && initializer_list[i].virtual_device != V_NULL; i++) {
asdf_virtual_assign(initializer_list[i].virtual_device, initializer_list[i].physical_device,
initializer_list[i].function, initializer_list[i].initial_value);
}
// Now set all the initial LED and output values
// PROCEDURE: asdf_virtual_sync
// INPUTS: none
// OUTPUTS: none
//
// DESCRIPTION: Synchronize the physical outputs with their controlling virtual devices.
//
// SIDE EFFECTS: see above
//
// SCOPE: public
//
// COMPLEXITY: 2
//
void asdf_virtual_sync(void)
{
for (uint8_t i = 0; i < ASDF_PHYSICAL_NUM_RESOURCES; i++) {
asdf_physical_assert((asdf_physical_dev_t) i);
}

View File

@ -25,6 +25,8 @@
#if !defined(ASDF_VIRTUAL_H)
#define ASDF_VIRTUAL_H
#include "asdf_physical.h"
// These are "virtual" output identifiers that can be mapped to the real outputs using
// keymap initializer commands.
typedef enum {
@ -78,12 +80,31 @@ void asdf_virtual_action(asdf_virtual_dev_t virtual_out, asdf_virtual_function_t
// function assigned to the virtual output at initialization.
void asdf_virtual_activate(asdf_virtual_dev_t virtual_out);
// PROCEDURE: asdf_virtual_assign
// INPUTS: (asdf_virtual_dev_t) virtual_out - virtual output to be paired with the physical resource
// (asdf_physical_dev_t) physical_out to be assigned to the virtual output.
// (asdf_virtual_function_t) - the function to be applied to the virtual
// device when activated by a keypress.
// (uint8_t) initial_value - the initial state of the physical resource.
// OUTPUTS: none
// DESCRIPTION: map the virtual output specified by new_vout to physical_out, if
// both arguments are valid. Ignore if not valid.
// NOTES: if the virtual output is invalid, or the physical resource is invalid,
// or the physical resource is already assigned, then nothing happens.
void asdf_virtual_assign(asdf_virtual_dev_t virtual_out, asdf_physical_dev_t physical_out,
asdf_virtual_function_t function, uint8_t initial_value);
// PROCEDURE: asdf_virtual_init
// INPUTS: initializers
// OUTPUTS: none
// DESCRIPTION: Initializes the LED and output mapping
void asdf_virtual_init(asdf_virtual_initializer_t *const initializer_list);
void asdf_virtual_init(void);
// PROCEDURE: asdf_virtual_sync
// INPUTS: none
// OUTPUTS: none
// DESCRIPTION: Synchronize the physical outputs with their controlling virtual devices.
void asdf_virtual_sync(void);
#endif /* !defined (ASDF_VIRTUAL_H) */

View File

@ -60,9 +60,6 @@
//
int main(void)
{
// initialize the hardware:
asdf_arch_init();
// initialize the keyboard logic:
asdf_init();
@ -71,10 +68,11 @@ int main(void)
if (asdf_arch_tick()) {
asdf_keycode_t code = asdf_next_code();
if (code != ASDF_INVALID_CODE) {
void (*output_function)(asdf_keycode_t) =
(void (*)(asdf_keycode_t)) asdf_hook_get(ASDF_HOOK_OUTPUT);
(*output_function)(code);
if (code < ASDF_INVALID_CODE) {
// This is inside the loop because the output function may change
void (*output_function)(asdf_keycode_t) =
(void (*)(asdf_keycode_t)) asdf_hook_get(ASDF_HOOK_OUTPUT);
(*output_function)(code);
}
asdf_keyscan();
}

View File

@ -1,4 +1,4 @@
temporary_config_file(${ASDF_SRC_DIR}/Keymaps/asdf_all_keymap_defs_test.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_keymap_defs.h)
configure_file(${PROJECT_SRC_DIR}/Arch/asdf_arch_test.h ${CMAKE_CURRENT_BINARY_DIR}/asdf_arch.h COPYONLY)
list(APPEND C_FLAGS
"-std=c99"
@ -15,32 +15,45 @@ list(APPEND C_FLAGS
"-Wstrict-prototypes"
"-Wundef"
"-Wold-style-definition"
"-g"
)
list(APPEND TEST_INCLUDES
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/unity
${ASDF_SRC_DIR}
${ASDF_SRC_DIR}/Arch
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SRC_DIR}
${PROJECT_SRC_DIR}/Arch
)
add_library(unity
STATIC
${CMAKE_CURRENT_SOURCE_DIR}/unity/unity.c
)
target_include_directories(unity
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/unity
)
add_library(asdf_core
STATIC
${ASDF_SRC_DIR}/asdf.c
${ASDF_SRC_DIR}/asdf_buffer.c
${ASDF_SRC_DIR}/asdf_hook.c
${ASDF_SRC_DIR}/asdf_keymaps.c
${ASDF_SRC_DIR}/asdf_modifiers.c
${ASDF_SRC_DIR}/asdf_physical.c
${ASDF_SRC_DIR}/asdf_repeat.c
${ASDF_SRC_DIR}/asdf_virtual.c
${ASDF_SRC_DIR}/Arch/asdf_arch_test.c
asdf_keymap_table.c
${PROJECT_SRC_DIR}/asdf.c
${PROJECT_SRC_DIR}/asdf_buffer.c
${PROJECT_SRC_DIR}/asdf_hook.c
${PROJECT_SRC_DIR}/asdf_keymaps.c
${PROJECT_SRC_DIR}/asdf_modifiers.c
${PROJECT_SRC_DIR}/asdf_physical.c
${PROJECT_SRC_DIR}/asdf_repeat.c
${PROJECT_SRC_DIR}/asdf_virtual.c
${PROJECT_SRC_DIR}/Arch/asdf_arch_test.c
)
target_include_directories(asdf_core
PRIVATE
${ASDF_SRC_DIR}
${ASDF_SRC_DIR}/Arch
${PROJECT_SRC_DIR}
${PROJECT_SRC_DIR}/Arch
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
@ -48,13 +61,15 @@ target_include_directories(asdf_core
add_library(test_helpers
STATIC
${CMAKE_CURRENT_SOURCE_DIR}/test_asdf_lib.c
${CMAKE_CURRENT_SOURCE_DIR}/test_asdf_keymap_defs.c
${CMAKE_CURRENT_SOURCE_DIR}/asdf_keymap_table.c
)
target_include_directories(test_helpers
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${ASDF_SRC_DIR}
${CMAKE_BINARY_DIR}
${PROJECT_SRC_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
@ -67,7 +82,6 @@ function(setup_test testname)
add_executable(${testname}
${testname}.c
unity/unity.c
)
target_compile_options(${testname}
@ -80,7 +94,7 @@ function(setup_test testname)
${TEST_INCLUDES}
)
target_link_libraries(${testname} asdf_core test_helpers)
target_link_libraries(${testname} unity asdf_core test_helpers)
add_test(
NAME ${testname}

View File

@ -0,0 +1,125 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_table.c
//
// initialize keymap setup function table
//
// *** This is a special versiof for testing.
// *** Not auto-generated.
//
// 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>
#include "asdf_keymap_table.h"
#include "test_asdf_keymap_defs.h"
// 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) {
default:
case ASDF_TEST_PLAIN_MAP_INDEX: setup_test_plain_map(); break;
case ASDF_TEST_CAPS_MAP_INDEX: setup_test_caps_map(); break;
case ASDF_TEST2_PLAIN_MAP_INDEX: setup_test2_plain_map(); break;
case ASDF_TEST2_CAPS_MAP_INDEX: setup_test2_caps_map();
break;
// keymap assignments for the virtual device tests
case SINGLE_TESTS_KEYMAP: setup_test_vdevs_single(); break;
case DOUBLE_ASSIGN_TEST_KEYMAP: setup_test_vdevs_double(); break;
case TRIPLE_TESTS_KEYMAP: setup_test_vdevs_triple(); break;
case VCAPS_TEST_KEYMAP: setup_test_vdevs_vcaps();
break;
// keymap assignments for the hook mechanism tests
case ASDF_TEST_DEFAULT_SCANNER_MAP: setup_test_hooks_alt_scanner(); break;
case ASDF_TEST_ALTERNATE_OUTPUT_MAP: setup_test_hooks_alt_output(); break;
case ASDF_TEST_EACH_SCAN_MAP: setup_test_hooks_each_scan(); break;
}
}
// PROCEDURE: asdf_keymap_valid
//
// INPUTS: (uint8_t) index - index of the keymap setup function to check
// OUTPUTS: (uintu_t) returns TRUE (nonzero) if valid, FALSE (0) otherwise
//
// DESCRIPTION: This function returns TRUE if the index corresponds to
// a valid keymap.
//
// SIDE EFFECTS: none
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
uint8_t asdf_keymap_valid(uint8_t index) {
uint8_t valid = 0;
switch(index) {
case ASDF_TEST_PLAIN_MAP_INDEX:
case ASDF_TEST_CAPS_MAP_INDEX:
case ASDF_TEST2_PLAIN_MAP_INDEX:
case ASDF_TEST2_CAPS_MAP_INDEX:
// keymap assignments for the virtual device tests
case SINGLE_TESTS_KEYMAP:
case DOUBLE_ASSIGN_TEST_KEYMAP:
case TRIPLE_TESTS_KEYMAP:
case VCAPS_TEST_KEYMAP:
// keymap assignments for the hook mechanism tests
case ASDF_TEST_DEFAULT_SCANNER_MAP:
case ASDF_TEST_ALTERNATE_OUTPUT_MAP:
case ASDF_TEST_EACH_SCAN_MAP:
valid = 1;
break;
default:
valid = 0;
break;
}
return valid;
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,51 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_table.c
//
// initialize keymap setup function table
//
// *** This is configured for testing.
// *** NOT auto-generated
//
// 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 11
// define the type for a keymap setup function. Keymaps are registerd by storing
// a keymap setup function in the keymap setup array.
// 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);
// PROCEDURE: asdf_keymap_valid
// INPUTS: (uint8_t) index - index of the keymap setup function to check
// OUTPUTS: (uintu_t) returns TRUE (nonzero) if valid, FALSE (0) otherwise
// DESCRIPTION: This function returns TRUE if the index corresponds to
// a valid keymap.
uint8_t asdf_keymap_valid(uint8_t index);
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,125 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_table.c
//
// initialize keymap setup function table
//
// *** This is a special versiof for testing.
// *** Not auto-generated.
//
// 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>
#include "asdf_keymap_table.h"
#include "test_asdf_keymap_defs.h"
// 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) {
default:
case ASDF_TEST_PLAIN_MAP_INDEX: setup_test_plain_map(); break;
case ASDF_TEST_CAPS_MAP_INDEX: setup_test_caps_map(); break;
case ASDF_TEST2_PLAIN_MAP_INDEX: setup_test2_plain_map(); break;
case ASDF_TEST2_CAPS_MAP_INDEX: setup_test2_caps_map();
break;
// keymap assignments for the virtual device tests
case SINGLE_TESTS_KEYMAP: setup_test_vdevs_single(); break;
case DOUBLE_ASSIGN_TEST_KEYMAP: setup_test_vdevs_double(); break;
case TRIPLE_TESTS_KEYMAP: setup_test_vdevs_triple(); break;
case VCAPS_TEST_KEYMAP: setup_test_vdevs_vcaps();
break;
// keymap assignments for the hook mechanism tests
case ASDF_TEST_DEFAULT_SCANNER_MAP: setup_test_hooks_alt_scanner(); break;
case ASDF_TEST_ALTERNATE_OUTPUT_MAP: setup_test_hooks_alt_output(); break;
case ASDF_TEST_EACH_SCAN_MAP: setup_test_hooks_each_scan(); break;
}
}
// PROCEDURE: asdf_keymap_valid
//
// INPUTS: (uint8_t) index - index of the keymap setup function to check
// OUTPUTS: (uintu_t) returns TRUE (nonzero) if valid, FALSE (0) otherwise
//
// DESCRIPTION: This function returns TRUE if the index corresponds to
// a valid keymap.
//
// SIDE EFFECTS: none
//
// NOTES:
//
// SCOPE: public
//
// COMPLEXITY: 1
//
uint8_t asdf_keymap_valid(uint8_t index) {
uint8_t valid = 0;
switch(index) {
case ASDF_TEST_PLAIN_MAP_INDEX:
case ASDF_TEST_CAPS_MAP_INDEX:
case ASDF_TEST2_PLAIN_MAP_INDEX:
case ASDF_TEST2_CAPS_MAP_INDEX:
// keymap assignments for the virtual device tests
case SINGLE_TESTS_KEYMAP:
case DOUBLE_ASSIGN_TEST_KEYMAP:
case TRIPLE_TESTS_KEYMAP:
case VCAPS_TEST_KEYMAP:
// keymap assignments for the hook mechanism tests
case ASDF_TEST_DEFAULT_SCANNER_MAP:
case ASDF_TEST_ALTERNATE_OUTPUT_MAP:
case ASDF_TEST_EACH_SCAN_MAP:
valid = 1;
break;
default:
valid = 0;
break;
}
return valid;
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,51 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// asdf_keymap_table.c
//
// initialize keymap setup function table
//
// *** This is configured for testing.
// *** NOT auto-generated
//
// 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 11
// define the type for a keymap setup function. Keymaps are registerd by storing
// a keymap setup function in the keymap setup array.
// 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);
// PROCEDURE: asdf_keymap_valid
// INPUTS: (uint8_t) index - index of the keymap setup function to check
// OUTPUTS: (uintu_t) returns TRUE (nonzero) if valid, FALSE (0) otherwise
// DESCRIPTION: This function returns TRUE if the index corresponds to
// a valid keymap.
uint8_t asdf_keymap_valid(uint8_t index);
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -11,6 +11,8 @@
#define HALF_BUFFER (ASDF_BUFFER_POOL_SIZE / 2)
static const char test_string[] = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static const int test_string_size = sizeof(test_string) - 1;
static const char * const more_strings[] = {
"abcdefghijkl",
"12345",
@ -30,6 +32,18 @@ void setUp(void)
void tearDown(void) {}
// function to generate pseudo-random sequence to fill buffer.
asdf_keycode_t random_code(asdf_keycode_t seed)
{
uint8_t msb = seed & 0x80;
seed <<= 1;
if (msb) {
seed ^= 0x88;
}
return seed;
}
// allocating first buffer returns handle 0
void test_allocating_first_buffer_returns_handle_0(void)
{
@ -123,16 +137,16 @@ void test_adding_and_retrieving_string_one_by_one(void)
}
}
// Filling the buffer first, then retrieving the characters from the buffer
// should return the same string.
void test_fill_buffer_then_retrieve_string(void)
{
for (int sent = 0; sent < MAX_BUFFER; sent++) {
asdf_buffer_put(handle, (asdf_keycode_t) test_string[sent]);
asdf_buffer_put(handle, (asdf_keycode_t) test_string[sent % test_string_size]);
}
for (int received = 0; received < MAX_BUFFER; received++) {
int32_t code = (int32_t) asdf_buffer_get(handle);
TEST_ASSERT_EQUAL_INT32((int32_t) test_string[received],code);
TEST_ASSERT_EQUAL_INT32((int32_t) test_string[received % test_string_size],code);
}
// assert that next code request returns invalid code:
TEST_ASSERT_EQUAL_INT32(ASDF_INVALID_CODE, (int32_t) asdf_buffer_get(handle));
@ -143,15 +157,20 @@ void test_fill_buffer_then_retrieve_string(void)
// characters back, quietly dropping the overflow.
void test_overfilling_buffer_and_retrieve_drops_overflow(void)
{
const asdf_keycode_t seed = 0x3b;
asdf_keycode_t next_random_code;
// send the entire test string to overflow the buffer.
for (int i = 0; i < (int) sizeof(test_string); i++) {
asdf_buffer_put(handle, (asdf_keycode_t) test_string[i]);
for (int i = 0, next_rand_code = seed; i < MAX_BUFFER * 2; i++) {
next_rand_code = random_code(next_rand_code);
asdf_buffer_put(handle, next_rand_code);
}
// read until invalid character is received, testing that each character is
// correct.
for (int i = 0; i < MAX_BUFFER; i++) {
for (int i = 0, next_rand_code = seed; i < MAX_BUFFER; i++) {
asdf_keycode_t code = asdf_buffer_get(handle);
TEST_ASSERT_EQUAL_INT32((int32_t) test_string[i], (int32_t) code);
next_rand_code = random_code(next_rand_code);
TEST_ASSERT_EQUAL_INT32((int32_t) next_rand_code, (int32_t) code);
}
// the next code request returns invalid code:

View File

@ -4,15 +4,15 @@
#include "unity.h"
#include "asdf.h"
#include "asdf_arch.h"
#include "asdf_arch_test.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "asdf_buffer.h"
#include "asdf_repeat.h"
#include "asdf_hook.h"
#include "test_asdf_lib.h"
#include "test_asdf_keymap_defs.h"
//ASDF_TEST_DECLARATIONS;
@ -29,6 +29,8 @@ void setUp(void)
test_hook_clear();
asdf_keymaps_init();
asdf_init();
asdf_keymaps_select(ASDF_TEST_DEFAULT_SCANNER_MAP);
}
void tearDown(void) {}
@ -38,7 +40,7 @@ typedef asdf_cols_t (*scanner_func_t)(uint8_t);
void test_default_scan_hook_is_default_scanner(void)
{
scanner_func_t testfunc = (scanner_func_t) asdf_hook_get(ASDF_HOOK_SCANNER);
scanner_func_t testfunc = (scanner_func_t) asdf_hook_get(ASDF_HOOK_ROW_SCANNER);
asdf_cols_t testval = 0;
// make sure the pointer points to the correct function
@ -49,11 +51,11 @@ void test_default_scan_hook_is_default_scanner(void)
TEST_ASSERT_EQUAL_INT((int) asdf_arch_read_row(100), (int) testval);
}
// test_alternate_scan_hook
// test_alternate_scan_hook
void test_alternate_scan_hook(void)
{
asdf_keymaps_select_keymap(ASDF_TEST_ALTERNATE_SCANNER_MAP);
scanner_func_t testfunc = (scanner_func_t) asdf_hook_get(ASDF_HOOK_SCANNER);
asdf_keymaps_select(ASDF_TEST_ALTERNATE_SCANNER_MAP);
scanner_func_t testfunc = (scanner_func_t) asdf_hook_get(ASDF_HOOK_ROW_SCANNER);
asdf_cols_t testval = 0;
// make sure the pointer points to the correct function
@ -70,7 +72,7 @@ void test_each_scan_hook_is_executed_each_scan(void)
{
test_hook_clear();
asdf_keymaps_select_keymap(ASDF_TEST_EACH_SCAN_MAP);
asdf_keymaps_select(ASDF_TEST_EACH_SCAN_MAP);
TEST_ASSERT_EQUAL_INT(0, test_hook_readback());
for (int i = 0; i < NUM_SCAN_TEST_REPS; i++) {
asdf_keyscan();
@ -78,25 +80,6 @@ void test_each_scan_hook_is_executed_each_scan(void)
TEST_ASSERT_EQUAL_INT(NUM_SCAN_TEST_REPS, test_hook_readback());
}
// Check that setup hooks are executed immediately
void test_setup_hook_is_executed_immediately(void)
{
test_hook_clear();
asdf_keymaps_select_keymap(0);
uint32_t expected = TEST_HOOK_VAL1 | TEST_HOOK_VAL2;
TEST_ASSERT_EQUAL_INT(expected, test_hook_readback());
}
// Check that setup hooks are executed properly after selecting nonzero map
void test_setup_hook_is_executed_immediately_when_selecting_nonzero_map(void)
{
test_hook_clear();
asdf_keymaps_select_keymap(1);
uint32_t expected = TEST_HOOK_VAL3 | TEST_HOOK_VAL4;
TEST_ASSERT_EQUAL_INT(expected, test_hook_readback());
}
int main(void)
@ -104,8 +87,6 @@ int main(void)
UNITY_BEGIN();
RUN_TEST(test_default_scan_hook_is_default_scanner);
RUN_TEST(test_alternate_scan_hook);
RUN_TEST(test_setup_hook_is_executed_immediately);
RUN_TEST(test_setup_hook_is_executed_immediately_when_selecting_nonzero_map);
RUN_TEST(test_each_scan_hook_is_executed_each_scan);
return UNITY_END();
}

View File

@ -0,0 +1,170 @@
// -*- mode: C; tab-width: 2 ; indent-tabs-mode: nil -*-
//
// Unified Keyboard Project
// ASDF keyboard firmware
//
// test_asdf_keymap_defs.c
//
// Contains keymap definitions for unit tests
//
// 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 "test_asdf_keymap_defs.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "asdf_keymaps.h"
#include "test_asdf_lib.h"
#include "asdf_keymap_table.h"
static const asdf_keycode_t test_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_PLAIN_MAP;
static const asdf_keycode_t test_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_SHIFT_MAP;
static const asdf_keycode_t test_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_CAPS_MAP;
static const asdf_keycode_t test_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_CTRL_MAP;
static const asdf_keycode_t test2_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_PLAIN_MAP;
static const asdf_keycode_t test2_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_SHIFT_MAP;
static const asdf_keycode_t test2_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_CAPS_MAP;
static const asdf_keycode_t test2_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_CTRL_MAP;
void test_keymaps_add_map(const asdf_keycode_t (*matrix)[TEST_NUM_COLS],
modifier_index_t modifier_index)
{
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) TEST_NUM_ROWS,
(uint8_t) TEST_NUM_COLS);
}
void setup_test_plain_map(void)
{
test_keymaps_add_map(test_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map(test_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test_caps_map(void)
{
test_keymaps_add_map(test_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map(test_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test2_plain_map(void)
{
test_keymaps_add_map(test2_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map(test2_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test2_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test2_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test2_caps_map(void)
{
test_keymaps_add_map(test2_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map(test2_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test2_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test2_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test_vdevs_single(void)
{
setup_test_plain_map();
asdf_virtual_init();
/* single assignment */
asdf_virtual_assign(VOUT1, PHYSICAL_OUT1, V_NOFUNC, 0);
/* single toggle */
asdf_virtual_assign(VOUT2, PHYSICAL_OUT2, V_TOGGLE, 0);
/* single pulse */
asdf_virtual_assign(VOUT3, PHYSICAL_OUT3, V_PULSE_SHORT, 0);
asdf_virtual_sync();
}
void setup_test_vdevs_double(void)
{
setup_test_plain_map();
asdf_virtual_init();
/* first of double assignment attempt */
asdf_virtual_assign(VOUT4, PHYSICAL_LED1, V_NOFUNC, 0);
/* second of double assignment attempt */
asdf_virtual_assign(VOUT5, PHYSICAL_LED1, V_NOFUNC, 1);
asdf_virtual_sync();
}
void setup_test_vdevs_triple(void)
{
setup_test_caps_map();
asdf_virtual_init();
/* Triple assignment */
asdf_virtual_assign(VOUT1, PHYSICAL_OUT1, V_TOGGLE, 0);
asdf_virtual_assign(VOUT1, PHYSICAL_OUT2, V_TOGGLE, 1);
asdf_virtual_assign(VOUT1, PHYSICAL_OUT3, V_TOGGLE, 0);
asdf_virtual_sync();
}
void setup_test_vdevs_vcaps(void)
{
setup_test2_plain_map();
asdf_virtual_init();
asdf_virtual_assign(VCAPS_LED, PHYSICAL_LED1, V_NOFUNC, 0);
asdf_virtual_assign(VSHIFT_LED, PHYSICAL_LED2, V_NOFUNC, 0);
asdf_virtual_assign(VOUT2, PHYSICAL_OUT3, V_NOFUNC, 0);
asdf_virtual_assign(VOUT2, ASDF_PHYSICAL_NUM_RESOURCES, V_NOFUNC, 0);
asdf_virtual_sync();
}
void setup_test_hooks_alt_scanner(void)
{
setup_test2_plain_map();
asdf_hook_init();
}
void setup_test_hooks_alt_output(void)
{
setup_test2_plain_map();
asdf_hook_init();
asdf_hook_assign(ASDF_HOOK_OUTPUT, (void (*)(void)) &test_hook_output);
asdf_hook_assign(ASDF_HOOK_ROW_SCANNER, (void (*)(void)) &test_hook_read_row);
}
void setup_test_hooks_each_scan(void)
{
setup_test2_caps_map();
asdf_hook_init();
asdf_hook_assign(ASDF_HOOK_EACH_SCAN, &test_hook_each_scan);
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,240 @@
// -*- 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/>.
// 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(TEST_ASDF_KEYMAP_DEFS_H)
#define TEST_ASDF_KEYMAP_DEFS_H
// The first value in each row serves two purposes:
//
// 1) Indicate a valid row of codes if the value is nonzero.
// 2) Indicate the physical row number corresponding to the keymap row.
//
// Multiple keymaps may be combined, some of which use more rows than other
// keymaps. The keymap with the most rows determines how many rows are allocated
// for each keymap. Since each keymap only initializes the rows it uses, then
// the shorter keymaps may have multiple uninitialized rows that should not be
// scanned. The C99 standard guarantees that all elements no explicitly
// initialized shall be initialized to 0 (C99 Standard 6.7.8.21). Therefore,
// keymap rows starting with a 0 are not valid and are not scanned.
//
// Some hardware may contain blank physical rows To avoid having unused empty
// rows, the first column of each row indicates the physical row. For example, 8
// rows of switches (0-7), and a bank of DIP switches on row 15. In this case,
// only 9 rows need be allocated.
#define TEST_NUM_ROWS 9
#define TEST_NUM_COLS 8
#define PLAIN_MATRIX_1 RESERVED_1
#define CAPS_MATRIX_1 RESERVED_2
#define SHIFT_MATRIX_1 RESERVED_3
#define CTRL_MATRIX_1 RESERVED_4
#define PLAIN_MATRIX_2 RESERVED_5
#define CAPS_MATRIX_2 RESERVED_6
#define SHIFT_MATRIX_2 RESERVED_7
#define CTRL_MATRIX_2 RESERVED_8
#define ASDF_TEST_MAP_DIP_SWITCHES \
[TEST_NUM_ROWS-1] = { ACTION_MAPSEL_0, ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3 }
#define ASDF_TEST_PLAIN_MAP \
{ \
{ PLAIN_MATRIX_1, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_CAPS, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
{ ACTION_NOTHING, 'p', ';', '/', ASCII_SPACE, 'z', 'a', 'q' }, \
{ ACTION_NOTHING, ASCII_COMMA, 'm', 'n', 'b', 'v', 'c', 'x' }, \
{ ACTION_NOTHING, 'k', 'j', 'h', 'g', 'f', 'd', 's' }, \
{ ACTION_NOTHING, 'i', 'u', 'y', 't', 'r', 'e', 'w' }, \
/**/ { ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'o', \
'l', ASCII_PERIOD }, \
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', '0', '9', '8' }, \
{ ACTION_NOTHING, '7', '6', '5', '4', '3', '2', '1' }, ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST_CAPS_MAP \
{ \
{ CAPS_MATRIX_1, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
{ ACTION_NOTHING, 'P', ';', '/', ASCII_SPACE, 'Z', 'A', 'Q' }, \
{ ACTION_NOTHING, ASCII_COMMA, 'M', 'N', 'B', 'V', 'C', 'X' }, \
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
{ ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
/**/ { ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'O', \
'L', ASCII_PERIOD }, \
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', '0', '9', '8' }, \
{ ACTION_NOTHING, '7', '6', '5', '4', '3', '2', '1' }, ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST_SHIFT_MAP \
{ \
\
{ SHIFT_MATRIX_1, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_VERT_BAR }, \
{ ACTION_NOTHING, 'P', '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' }, \
{ ACTION_NOTHING, '>', 'M', 'N', 'B', 'V', 'C', 'X' }, \
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
{ ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
{ ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'O', 'L', '<' }, \
{ ASCII_TILDE, ASCII_RT_CURLY_BRACE, ASCII_LT_CURLY_BRACE, '=', '*', \
'0', ASCII_RT_PAREN, ASCII_LT_PAREN }, \
{ ACTION_NOTHING, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' }, \
ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST_CTRL_MAP \
{ \
{ CTRL_MATRIX_1, 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_NOTHING, ASCII_COMMA, ASCII_CTRL_M, ASCII_CTRL_N, \
ASCII_CTRL_B, ASCII_CTRL_V, ASCII_CTRL_C, ASCII_CTRL_X }, \
{ ACTION_NOTHING, ASCII_CTRL_K, ASCII_CTRL_J, ASCII_CTRL_H, \
ASCII_CTRL_G, ASCII_CTRL_F, ASCII_CTRL_D, ASCII_CTRL_S }, \
{ ACTION_NOTHING, 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_SHIFTLOCK_ON, ASCII_CR, \
ASCII_LF, ASCII_CTRL_O, ASCII_CTRL_L, ACTION_NOTHING }, \
{ ACTION_NOTHING, 0x1d, ASCII_ESC, ACTION_NOTHING, \
ACTION_NOTHING, ACTION_FN_1, 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 }, \
ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST2_PLAIN_MAP \
{ \
{ PLAIN_MATRIX_2, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_CAPS, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
{ ACTION_NOTHING, 'p', ';', '/', ASCII_SPACE, 'z', 'a', 'q' }, \
{ ACTION_NOTHING, ASCII_COMMA, 'm', 'n', 'b', 'v', 'c', 'x' }, \
{ ACTION_NOTHING, 'k', 'j', 'h', 'g', 'f', 'd', 's' }, \
{ ACTION_NOTHING, 'i', 'u', 'y', 't', 'r', 'e', 'w' }, \
/**/ { ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'o', \
'l', ASCII_PERIOD }, \
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', '0', '9', '8' }, \
{ ACTION_NOTHING, '7', '6', '5', '4', '3', '2', '1' }, ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST2_CAPS_MAP \
{ \
{ CAPS_MATRIX_2, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_BACKSLASH }, \
{ ACTION_NOTHING, 'P', ';', '/', ASCII_SPACE, 'Z', 'A', 'Q' }, \
{ ACTION_NOTHING, ASCII_COMMA, 'M', 'N', 'B', 'V', 'C', 'X' }, \
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
{ ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
/**/ { ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'O', \
'L', ASCII_PERIOD }, \
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', '0', '9', '8' }, \
{ ACTION_NOTHING, '7', '6', '5', '4', '3', '2', '1' }, ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST2_SHIFT_MAP \
{ \
\
{ SHIFT_MATRIX_2, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, \
ACTION_NOTHING, ASCII_ESC, ACTION_CTRL, ASCII_VERT_BAR }, \
{ ACTION_NOTHING, 'P', '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' }, \
{ ACTION_NOTHING, '>', 'M', 'N', 'B', 'V', 'C', 'X' }, \
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' }, \
{ ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' }, \
{ ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'O', 'L', '<' }, \
{ ASCII_TILDE, ASCII_RT_CURLY_BRACE, ASCII_LT_CURLY_BRACE, '=', '*', \
'0', ASCII_RT_PAREN, ASCII_LT_PAREN }, \
{ ACTION_NOTHING, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' }, \
ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST2_CTRL_MAP \
{ \
{ CTRL_MATRIX_2, 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_NOTHING, ASCII_COMMA, ASCII_CTRL_M, ASCII_CTRL_N, \
ASCII_CTRL_B, ASCII_CTRL_V, ASCII_CTRL_C, ASCII_CTRL_X }, \
{ ACTION_NOTHING, ASCII_CTRL_K, ASCII_CTRL_J, ASCII_CTRL_H, \
ASCII_CTRL_G, ASCII_CTRL_F, ASCII_CTRL_D, ASCII_CTRL_S }, \
{ ACTION_NOTHING, 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_SHIFTLOCK_ON, ASCII_CR, \
ASCII_LF, ASCII_CTRL_O, ASCII_CTRL_L, ACTION_NOTHING }, \
{ ACTION_NOTHING, 0x1d, ASCII_ESC, ACTION_NOTHING, \
ACTION_NOTHING, ACTION_FN_1, 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 }, \
ASDF_TEST_MAP_DIP_SWITCHES \
}
#define ASDF_TEST_PLAIN_MAP_INDEX 0
#define ASDF_TEST_CAPS_MAP_INDEX 1
#define ASDF_TEST2_PLAIN_MAP_INDEX 2
#define ASDF_TEST2_CAPS_MAP_INDEX 3
// keymap assignments for the virtual device tests
#define SINGLE_TESTS_KEYMAP 4
#define DOUBLE_ASSIGN_TEST_KEYMAP 5
#define TRIPLE_TESTS_KEYMAP 6
#define VCAPS_TEST_KEYMAP 7
#define VSHIFT_TEST_KEYMAP VCAPS_TEST_KEYMAP
// keymap assignments for the hook mechanism tests
#define ASDF_TEST_DEFAULT_SCANNER_MAP 8
#define ASDF_TEST_ALTERNATE_SCANNER_MAP 9
#define ASDF_TEST_ALTERNATE_OUTPUT_MAP 9
#define ASDF_TEST_EACH_SCAN_MAP 10
void setup_test_plain_map(void);
void setup_test_caps_map(void);
void setup_test2_plain_map(void);
void setup_test2_caps_map(void);
void setup_test_vdevs_single(void);
void setup_test_vdevs_double(void);
void setup_test_vdevs_triple(void);
void setup_test_vdevs_vcaps(void);
void setup_test_hooks_alt_scanner(void);
void setup_test_hooks_alt_output(void);
void setup_test_hooks_each_scan(void);
#endif /* !defined (TEST_ASDF_KEYMAP_DEFS_H) */
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -5,14 +5,34 @@
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "asdf_keymap_table.h"
#include "test_asdf_keymap_defs.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "test_asdf_lib.h"
#define TESTALPHA 'a'
#define TESTNUM '2'
#define TESTKEYMAP_TAG PLAIN_MATRIX_1
#define NUM_DIPSWITCHES 4
static const FLASH asdf_keycode_t test_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_PLAIN_MAP;
static const FLASH asdf_keycode_t test_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_SHIFT_MAP;
static const FLASH asdf_keycode_t test_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_CAPS_MAP;
static const FLASH asdf_keycode_t test_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_CTRL_MAP;
static const FLASH asdf_keycode_t test2_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_PLAIN_MAP;
static const FLASH asdf_keycode_t test2_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_SHIFT_MAP;
static const FLASH asdf_keycode_t test2_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_CAPS_MAP;
static const FLASH asdf_keycode_t test2_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_CTRL_MAP;
// row: row number
// col: column number
// keymap_name: id of the file defining the matrix to be used.
@ -21,7 +41,7 @@
// modifier_name: name of the modifier to be accessed within the map.
#define TESTMAP(row, col, keymap_name, defnum, mapindex, modifier_name) \
do { \
asdf_keymaps_select_keymap(ASDF_##mapindex##_MAP_INDEX); \
asdf_keymaps_select(ASDF_##mapindex##_MAP_INDEX); \
asdf_keycode_t expected = keymap_name##_##modifier_name##_matrix[(row)][(col)]; \
asdf_keycode_t result = asdf_keymaps_get_code((row), (col), MOD_##modifier_name##_MAP); \
asdf_keycode_t map_id = asdf_keymaps_get_code(0, 0, MOD_##modifier_name##_MAP); \
@ -75,8 +95,6 @@ typedef struct {
// used to place the codes are functioning and are being properly used.
ASDF_KEYMAP_DECLARATIONS;
// keymap coordinates for special functions
static coord_t alpha_sample;
static coord_t num_sample;
@ -87,8 +105,8 @@ coord_t *find_code(asdf_keycode_t code)
uint32_t done = 0;
static coord_t location = { .row = -1, .col = -1 };
for (uint32_t row = 0; !done && (row < ASDF_NUM_ROWS); row++) {
for (uint32_t col = 0; !done && (col < ASDF_NUM_COLS); col++) {
for (uint32_t row = 0; !done && (row < TEST_NUM_ROWS); row++) {
for (uint32_t col = 0; !done && (col < TEST_NUM_COLS); col++) {
if (test_PLAIN_matrix[row][col] == code) {
done = 1;
location.row = row;
@ -105,6 +123,7 @@ void setUp(void)
coord_t *temp;
asdf_keymaps_init();
asdf_keymaps_select(ASDF_TEST_PLAIN_MAP_INDEX);
temp = find_code(TESTALPHA);
alpha_sample = *temp;
@ -114,6 +133,7 @@ void setUp(void)
temp = find_code(TESTKEYMAP_TAG);
keymap_tag = *temp;
}
void tearDown(void) {}
@ -142,22 +162,7 @@ void complicated_set_keymap(uint8_t mapnum)
// dummy function, to resolve reference in keymap hook initialization.
asdf_cols_t asdf_arch_read_row(uint8_t row)
{
return (asdf_cols_t) (row+1);
}
// the next two test check the preprocessor mechanism for allocating space for
// the largest defined keymap
// check to see that the largest number of columns is detected.
void test_num_cols_is_max_cols(void)
{
TEST_ASSERT_EQUAL_INT32(max(ASDF_TEST_NUM_COLS, ASDF_TEST2_NUM_COLS), ASDF_NUM_COLS);
}
// check to see that the largest number of rows is detected.
void test_num_rows_is_max_rows(void)
{
TEST_ASSERT_EQUAL_INT32(max(ASDF_TEST_NUM_ROWS, ASDF_TEST2_NUM_ROWS), ASDF_NUM_ROWS);
return (asdf_cols_t)(row + 1);
}
void test_chars_are_in_map(void)
@ -168,6 +173,9 @@ void test_chars_are_in_map(void)
void keymap0_plain_gives_plain_values(void)
{
asdf_keymaps_select(ASDF_TEST_PLAIN_MAP_INDEX);
TEST0PLAIN(alpha_sample.row, alpha_sample.col);
TEST0PLAIN(num_sample.row, num_sample.col);
}
@ -221,10 +229,10 @@ void keymap1_capsmap_plain_maps_to_caps(void)
void dip_switch_codes_are_in_last_row_test1_map(void)
{
coord_t dip_switches[NUM_DIPSWITCHES] = { { .row = ASDF_LAST_ROW, .col = 0 },
{ .row = ASDF_LAST_ROW, .col = 1 },
{ .row = ASDF_LAST_ROW, .col = 2 },
{ .row = ASDF_LAST_ROW, .col = 3 } };
coord_t dip_switches[NUM_DIPSWITCHES] = { { .row = (TEST_NUM_ROWS - 1), .col = 0 },
{ .row = (TEST_NUM_ROWS - 1), .col = 1 },
{ .row = (TEST_NUM_ROWS - 1), .col = 2 },
{ .row = (TEST_NUM_ROWS - 1), .col = 3 } };
for (uint8_t i = 0; i < NUM_DIPSWITCHES; i++) {
asdf_keycode_t code =
asdf_keymaps_get_code(dip_switches[i].row, dip_switches[i].col, ASDF_TEST_PLAIN_MAP_INDEX);
@ -234,10 +242,10 @@ void dip_switch_codes_are_in_last_row_test1_map(void)
void dip_switch_codes_are_in_last_row_test2_map(void)
{
coord_t dip_switches[NUM_DIPSWITCHES] = { { .row = ASDF_LAST_ROW, .col = 0 },
{ .row = ASDF_LAST_ROW, .col = 1 },
{ .row = ASDF_LAST_ROW, .col = 2 },
{ .row = ASDF_LAST_ROW, .col = 3 } };
coord_t dip_switches[NUM_DIPSWITCHES] = { { .row = (TEST_NUM_ROWS - 1), .col = 0 },
{ .row = (TEST_NUM_ROWS - 1), .col = 1 },
{ .row = (TEST_NUM_ROWS - 1), .col = 2 },
{ .row = (TEST_NUM_ROWS - 1), .col = 3 } };
for (uint8_t i = 0; i < NUM_DIPSWITCHES; i++) {
asdf_keycode_t code =
asdf_keymaps_get_code(dip_switches[i].row, dip_switches[i].col, ASDF_TEST2_PLAIN_MAP_INDEX);
@ -247,20 +255,14 @@ void dip_switch_codes_are_in_last_row_test2_map(void)
void dip_switch_properly_sets_bits(void)
{
char message[80];
sprintf(message, "Map 0 is %d.", PLAIN_MATRIX_1);
TEST_MESSAGE(message);
for (uint8_t i = 0; i < ASDF_NUM_KEYMAPS; i++) {
asdf_keycode_t expected;
asdf_keycode_t result;
asdf_keymaps_select_keymap(i);
asdf_keymaps_select(i);
expected = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
// set all keymap bits to '0'
asdf_keymaps_select_keymap(0);
asdf_keymaps_select(0);
complicated_set_keymap(i);
result = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
@ -273,12 +275,7 @@ void dip_switch_properly_clears_bits(void)
{
uint8_t mask = 0;
uint8_t next = 1;
char message[80];
sprintf(message, "Map 0 is %d.", PLAIN_MATRIX_1);
TEST_MESSAGE(message);
// calculate word with most 1's less than (or equal to) ASDF_NUM_KEYMAPS
while (next < ASDF_NUM_KEYMAPS) {
mask = next;
@ -287,11 +284,11 @@ void dip_switch_properly_clears_bits(void)
for (uint8_t i = 0; i < ASDF_NUM_KEYMAPS; i++) {
asdf_keycode_t expected;
asdf_keycode_t result;
asdf_keymaps_select_keymap(i);
asdf_keymaps_select(i);
expected = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
// set as many keymap bits to '1' as possible.
asdf_keymaps_select_keymap(mask);
asdf_keymaps_select(mask);
complicated_set_keymap(i);
result = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(expected, result);
@ -304,32 +301,29 @@ void dip_switch_invalid_keymap_has_no_effect(void)
asdf_keycode_t map_id;
// First, assert that changing to matrix 2 works:
asdf_keymaps_select_keymap(ASDF_TEST2_PLAIN_MAP_INDEX);
asdf_keymaps_select(ASDF_TEST2_PLAIN_MAP_INDEX);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_2, map_id);
// assert that resetting keymap to 0 works:
asdf_keymaps_select_keymap(0);
asdf_keymaps_select(0);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_1, map_id);
// selecting one above the highest keymap should have no effect
asdf_keymaps_select_keymap(ASDF_NUM_KEYMAPS);
asdf_keymaps_select(ASDF_NUM_KEYMAPS);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_1, map_id);
// selecting one above the highest keymap should have no effect
// selecting the highest possible keymap should have no effect
asdf_keymaps_select(UINT8_MAX);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
asdf_keymaps_select_keymap(UINT8_MAX);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_1, map_id);
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_num_rows_is_max_rows);
RUN_TEST(test_num_cols_is_max_cols);
RUN_TEST(test_chars_are_in_map);
RUN_TEST(keymap0_plain_gives_plain_values);
RUN_TEST(keymap0_shift_gives_shift_values);

View File

@ -0,0 +1,68 @@
#include<stdint.h>
#include "asdf.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "test_asdf_lib.h"
#include "asdf_arch.h"
static uint32_t key_matrix[ASDF_NUM_ROWS] = {};
ASDF_KEYMAP_DECLARATIONS;
coord_t *find_code(asdf_keycode_t code)
{
uint32_t done = 0;
static coord_t location = { .row = -1, .col = -1 };
for (uint32_t row = 0; !done && (row < ASDF_NUM_ROWS); row++) {
for (uint32_t col = 0; !done && (col < ASDF_NUM_COLS); col++) {
if (test_PLAIN_matrix[row][col] == code) {
done = 1;
location.row = row;
location.col = col;
}
}
}
return &location;
}
void keyscan_delay(int32_t ticks)
{
for (; ticks; ticks--) {
asdf_keyscan();
}
}
void press_no_debounce(asdf_keycode_t code)
{
coord_t *location = find_code(code);
key_matrix[location->row] |= (1 << location->col);
}
void release_no_debounce(asdf_keycode_t code)
{
coord_t *location = find_code(code);
key_matrix[location->row] &= ~(1 << location->col);
}
void press(asdf_keycode_t code)
{
press_no_debounce(code);
keyscan_delay(ASDF_DEBOUNCE_TIME_MS);
}
void release(asdf_keycode_t code)
{
release_no_debounce(code);
keyscan_delay(ASDF_DEBOUNCE_TIME_MS);
}
asdf_cols_t asdf_arch_read_row(uint8_t row)
{
return key_matrix[row];
}

View File

@ -0,0 +1,23 @@
#if !defined(TEST_ASDF_LIB_H)
#include "asdf_keymaps.h"
// struct to define keymap row,col pairs
typedef struct {
int32_t row;
int32_t col;
} coord_t;
void keyscan_delay(int32_t ticks);
void press_no_debounce(asdf_keycode_t code);
void release_no_debounce(asdf_keycode_t code);
void press(asdf_keycode_t code);
void release(asdf_keycode_t code);
asdf_cols_t asdf_arch_read_row(uint8_t row);
coord_t *find_code(asdf_keycode_t code);
#define TEST_ASDF_LIB_H
#endif // if !defined(TEST_ASDF_LIB_H)

View File

@ -1,7 +1,8 @@
#include<stdint.h>
#include "asdf.h"
#include "asdf_virtual.h"
#include "asdf_physical.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "asdf_arch.h"
#include "asdf_hook.h"
#include "test_asdf_lib.h"

View File

@ -1,4 +1,5 @@
#if !defined(TEST_ASDF_LIB_H)
#define TEST_ASDF_LIB_H
#define TEST_HOOK_VAL1 1
#define TEST_HOOK_VAL2 2
@ -19,5 +20,4 @@ uint8_t test_hook_read_row(uint8_t val);
void test_hook_output(uint8_t val);
#define TEST_ASDF_LIB_H
#endif // if !defined(TEST_ASDF_LIB_H)

View File

@ -1,21 +1,22 @@
#include <stdint.h>
#include <stdarg.h>
#include "asdf_arch.h"
#include "asdf_arch_test.h"
#include "unity.h"
#include "asdf.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "asdf_config.h"
#include "test_asdf_lib.h"
#include "test_asdf_keymap_defs.h"
void setUp(void)
{
asdf_arch_init();
asdf_keymaps_init();
asdf_keymaps_select(SINGLE_TESTS_KEYMAP);
}
void tearDown(void) {}
@ -26,13 +27,6 @@ asdf_cols_t asdf_arch_read_row(uint8_t row)
return (asdf_cols_t) row;
}
// check to see that the longest keymap initializer sequence initia is detected.
void test_inizializer_length_is_max_length(void)
{
TEST_ASSERT_EQUAL_INT32(max(ASDF_TEST_KEYMAP_INITIALIZER_LENGTH,
ASDF_TEST2_KEYMAP_INITIALIZER_LENGTH), ASDF_KEYMAP_INITIALIZER_LENGTH);
}
void test_single_virtual_output_is_initialized(void)
{
// initially on keymap 0. Test to see that OUT1 has been initialized to 0.
@ -104,7 +98,7 @@ void test_pulse_low_virtual_output(void)
// output.
void test_toggle_triple_output(void)
{
asdf_keymaps_select_keymap(TRIPLE_TESTS_KEYMAP);
asdf_keymaps_select(TRIPLE_TESTS_KEYMAP);
// check that initial values have been set:
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_OUT1));
@ -126,7 +120,7 @@ void test_toggle_triple_output(void)
// output high and low
void test_set_triple_output(void)
{
asdf_keymaps_select_keymap(TRIPLE_TESTS_KEYMAP);
asdf_keymaps_select(TRIPLE_TESTS_KEYMAP);
// check that initial values have been set:
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_OUT1));
@ -148,7 +142,7 @@ void test_set_triple_output(void)
// output high and low
void test_pulse_triple_output(void)
{
asdf_keymaps_select_keymap(TRIPLE_TESTS_KEYMAP);
asdf_keymaps_select(TRIPLE_TESTS_KEYMAP);
// check that initial values have been set:
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_OUT1));
TEST_ASSERT_EQUAL_INT32(1, asdf_arch_check_output(PHYSICAL_OUT2));
@ -179,7 +173,7 @@ void test_pulse_triple_output(void)
// output high and low
void test_activate_triple_output(void)
{
asdf_keymaps_select_keymap(TRIPLE_TESTS_KEYMAP);
asdf_keymaps_select(TRIPLE_TESTS_KEYMAP);
// check that initial values have been set:
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_OUT1));
TEST_ASSERT_EQUAL_INT32(1, asdf_arch_check_output(PHYSICAL_OUT2));
@ -238,7 +232,7 @@ uint8_t *single_zero_array(asdf_physical_dev_t set_element)
void test_virtual_capslock_indicator(void)
{
asdf_keymaps_select_keymap(VCAPS_TEST_KEYMAP);
asdf_keymaps_select(VCAPS_TEST_KEYMAP);
// CAPS LED output should be initialized to zero:
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_LED1));
@ -258,7 +252,7 @@ void test_virtual_capslock_indicator(void)
void test_virtual_shiftlock_indicator(void)
{
asdf_keymaps_select_keymap(VSHIFT_TEST_KEYMAP);
asdf_keymaps_select(VSHIFT_TEST_KEYMAP);
// CAPS LED output should be initialized to zero:
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_LED2));
@ -279,7 +273,7 @@ void test_virtual_shiftlock_indicator(void)
void test_cant_assign_real_output_twice(void)
{
asdf_keymaps_select_keymap(DOUBLE_ASSIGN_TEST_KEYMAP);
asdf_keymaps_select(DOUBLE_ASSIGN_TEST_KEYMAP);
// initial value should be set to 0:
TEST_ASSERT_EQUAL_INT32(0, asdf_arch_check_output(PHYSICAL_LED1));
@ -301,7 +295,6 @@ void test_cant_assign_real_output_twice(void)
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_inizializer_length_is_max_length);
RUN_TEST(test_single_virtual_output_is_initialized);
RUN_TEST(test_uninitialized_virtual_out_is_default);
RUN_TEST(test_set_virtual_output);

View File

@ -0,0 +1,174 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// test_keymapdefs.c
//
// 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.
#define PLAIN_MATRIX_1 RESERVED_1
#define CAPS_MATRIX_1 RESERVED_2
#define SHIFT_MATRIX_1 RESERVED_3
#define CTRL_MATRIX_1 RESERVED_4
#define ASDF_TEST_PLAIN_MAP_INDEX 0
#define ASDF_TEST_CAPS_MAP_INDEX 1
#define SINGLE_TESTS_KEYMAP ASDF_TEST_PLAIN_MAP_INDEX
#define DOUBLE_ASSIGN_TEST_KEYMAP ASDF_TEST_PLAIN_MAP_INDEX
#define TRIPLE_TESTS_KEYMAP ASDF_TEST_CAPS_MAP_INDEX
#define ASDF_TEST_KEYMAP_INITIALIZER_LENGTH 5
#define ASDF_TEST_MAP_DIP_SWITCHES \
[ASDF_LAST_ROW] = { ACTION_MAPSEL_0, ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3 }
static const FLASH keycode_matrix_t test_PLAIN_matrix = {
{ PLAIN_MATRIX_1, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, ACTION_CAPS, ASCII_ESC, ACTION_CTRL,
ASCII_BACKSLASH },
{ ACTION_NOTHING, 'p', ';', '/', ASCII_SPACE, 'z', 'a', 'q' },
{ ACTION_NOTHING, ASCII_COMMA, 'm', 'n', 'b', 'v', 'c', 'x' },
{ ACTION_NOTHING, 'k', 'j', 'h', 'g', 'f', 'd', 's' },
{ ACTION_NOTHING, 'i', 'u', 'y', 't', 'r', 'e', 'w' },
{ ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'o', 'l',
ASCII_PERIOD },
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', '0', '9', '8' },
{ ACTION_NOTHING, '7', '6', '5', '4', '3', '2', '1' },
ASDF_TEST_MAP_DIP_SWITCHES,
};
static const FLASH keycode_matrix_t test_CAPS_matrix = {
{ CAPS_MATRIX_1, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, ACTION_NOTHING, ASCII_ESC,
ACTION_CTRL, ASCII_BACKSLASH },
{ ACTION_NOTHING, 'P', ';', '/', ASCII_SPACE, 'Z', 'A', 'Q' },
{ ACTION_NOTHING, ASCII_COMMA, 'M', 'N', 'B', 'V', 'C', 'X' },
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' },
{ ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' },
{ ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'O', 'L',
ASCII_PERIOD },
{ ASCII_TILDE, ASCII_RT_SQUARE_BRACE, ASCII_LT_SQUARE_BRACE, '-', ':', '0', '9', '8' },
{ ACTION_NOTHING, '7', '6', '5', '4', '3', '2', '1' },
ASDF_TEST_MAP_DIP_SWITCHES
};
static const FLASH keycode_matrix_t test_SHIFT_matrix = {
{ SHIFT_MATRIX_1, ACTION_SHIFT, ACTION_SHIFT, ACTION_NOTHING, ACTION_NOTHING, ASCII_ESC,
ACTION_CTRL, ASCII_VERT_BAR },
{ ACTION_NOTHING, 'P', '+', '?', ASCII_SPACE, 'Z', 'A', 'Q' },
{ ACTION_NOTHING, '>', 'M', 'N', 'B', 'V', 'C', 'X' },
{ ACTION_NOTHING, 'K', 'J', 'H', 'G', 'F', 'D', 'S' },
{ ACTION_NOTHING, 'I', 'U', 'Y', 'T', 'R', 'E', 'W' },
{ ACTION_REPEAT, ACTION_HERE_IS, ACTION_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, 'O', 'L', '<' },
{ ASCII_TILDE, ASCII_RT_CURLY_BRACE, ASCII_LT_CURLY_BRACE, '=', '*', '0', ASCII_RT_PAREN,
ASCII_LT_PAREN },
{ ACTION_NOTHING, ASCII_SINGLE_QUOTE, '&', '%', '$', '#', ASCII_DOUBLE_QUOTE, '!' },
ASDF_TEST_MAP_DIP_SWITCHES
};
static const FLASH keycode_matrix_t test_CTRL_matrix = {
{ CTRL_MATRIX_1, 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_NOTHING, ASCII_COMMA, ASCII_CTRL_M, ASCII_CTRL_N, ASCII_CTRL_B, ASCII_CTRL_V,
ASCII_CTRL_C, ASCII_CTRL_X },
{ ACTION_NOTHING, ASCII_CTRL_K, ASCII_CTRL_J, ASCII_CTRL_H, ASCII_CTRL_G, ASCII_CTRL_F,
ASCII_CTRL_D, ASCII_CTRL_S },
{ ACTION_NOTHING, 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_SHIFTLOCK_ON, ASCII_CR, ASCII_LF, ASCII_CTRL_O,
ASCII_CTRL_L, ACTION_NOTHING },
{ ACTION_NOTHING, 0x1d, ASCII_ESC, ACTION_NOTHING, ACTION_NOTHING, ACTION_FN_1, 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 },
ASDF_TEST_MAP_DIP_SWITCHES
};
static void build_test_map_matrices(void)
{
asdf_keymap_add_keymap(&test_PLAIN_matrix, MOD_PLAIN_MAP);
asdf_keymap_add_keymap(&test_SHIFT_matrix, MOD_SHIFT_MAP);
asdf_keymap_add_keymap(&test_CAPS_matrix, MOD_CAPS_MAP);
asdf_keymap_add_keymap(&test_CTRL_matrix, MOD_CTRL_MAP);
}
static void build_test_caps_map_matrices(void)
{
asdf_keymap_add_keymap(&test_CAPS_matrix, MOD_PLAIN_MAP);
asdf_keymap_add_keymap(&test_SHIFT_matrix, MOD_SHIFT_MAP);
asdf_keymap_add_keymap(&test_CAPS_matrix, MOD_CAPS_MAP);
asdf_keymap_add_keymap(&test_CTRL_matrix, MOD_CTRL_MAP);
}
static void build_test_map_virtual_init(void)
{
/* Single assignment */ \
asdf_keymap_add_virtual_device(VOUT1, PHYSICAL_OUT1, V_NOFUNC, 0);
/* single toggle */ \
asdf_keymap_add_virtual_device(VOUT2, PHYSICAL_OUT2, V_TOGGLE, 0);
/* single pulse */
asdf_keymap_add_virtual_device(VOUT3, PHYSICAL_OUT3, V_PULSE_SHORT, 0);
/* first of double assignment attempt */
asdf_keymap_add_virtual_device(VOUT4, PHYSICAL_LED1, V_NOFUNC, 0);
/* second of double assignment attempt */
asdf_keymap_add_virtual_device(VOUT5, PHYSICAL_LED1, V_NOFUNC, 1);
}
static void build_test_caps__map_virtual_init(void)
{
/* Triple assignment */
asdf_keymap_add_virtual_device(VOUT1, PHYSICAL_OUT1, V_TOGGLE, 0);
asdf_keymap_add_virtual_device(VOUT1, PHYSICAL_OUT2, V_TOGGLE, 1);
asdf_keymap_add_virtual_device(VOUT1, PHYSICAL_OUT3, V_TOGGLE, 0);
}
static void build_test_map_hooks(void)
{
asdf_keymap_add_hook(ASDF_HOOK_KEYMAP_SETUP, &test_hook_1);
asdf_keymap_add_hook(ASDF_HOOK_KEYMAP_SETUP, &test_hook_2);
}
static void build_test_caps_map_hooks(void)
{
asdf_keymap_add_hook(ASDF_HOOK_KEYMAP_SETUP, &test_hook_3);
asdf_keymap_add_hook(ASDF_HOOK_KEYMAP_SETUP, &test_hook_4);
}
void build_test_keymap(void)
{
asdf_keymaps_build_keymap(ASDF_TEST_PLAIN_MAP_INDEX);
build_test_map_matrices();
build_test_map1_virtual_init();
build_test_map1_hooks();
asdf_keymaps_build_keymap(ASDF_TEST_CAPS_MAP_INDEX);
build_test_caps_map_matrices();
build_test_caps__map_virtual_init();
build_test_caps_map_hooks();
}
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,46 @@
// -*- mode: C; tab-width: 4 ; indent-tabs-mode: nil -*-
//
// Unfified Keyboard Project
// ASDF keyboard firmware
//
// test_keymapdefs.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/>.
// 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) TEST_KEYMAPDEFS_H
#define PLAIN_MATRIX_1 RESERVED_1
#define CAPS_MATRIX_1 RESERVED_2
#define SHIFT_MATRIX_1 RESERVED_3
#define CTRL_MATRIX_1 RESERVED_4
#define SINGLE_TESTS_KEYMAP ASDF_TEST_PLAIN_MAP_INDEX
#define DOUBLE_ASSIGN_TEST_KEYMAP ASDF_TEST_PLAIN_MAP_INDEX
#define TRIPLE_TESTS_KEYMAP ASDF_TEST_CAPS_MAP_INDEX
#define ASDF_TEST_MAP_DIP_SWITCHES \
[ASDF_LAST_ROW] = { ACTION_MAPSEL_0, ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3 }
#endif // TEST_KEYMAPDEFS_H
//-------|---------|---------+---------+---------+---------+---------+---------+
// Above line is 80 columns, and should display completely in the editor.

View File

@ -0,0 +1,505 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "unity.h"
#include "asdf.h"
#include "asdf_arch.h"
#include "asdf_ascii.h"
#include "asdf_modifiers.h"
#include "asdf_keymaps.h"
#include "asdf_keymap_defs.h"
#include "asdf_buffer.h"
#include "asdf_repeat.h"
#define A 'a'
#define B 'b'
#define TEST_STRING "abcdefghijklmnop"
#define NUM_REPEATS (ASDF_KEYCODE_BUFFER_SIZE - 2)
#define TESTMAP(row, col, mapname, mapname2) \
do { \
asdf_keycode_t expected = mapname##_matrix[(row)][(col)]; \
asdf_keycode_t result = asdf_keymaps_get_code((row), (col), MOD_##mapname2##_MAP); \
TEST_ASSERT_EQUAL_INT(expected, result); \
} while (0);
#define TESTPLAIN(row, col, n) TESTMAP((row), (col), PLAIN, n)
#define TESTSHIFT(row, col, n) TESTMAP((row), (col), SHIFT, n)
#define TESTCAPS(row, col, n) TESTMAP((row), (col), CAPS, n)
#define TESTCTRL(row, col, n) TESTMAP((row), (col), CTRL, n)
const char test_string[] = TEST_STRING;
const asdf_keycode_t key_a = A;
const asdf_keycode_t key_b = B;
typedef struct {
int32_t row;
int32_t col;
} coord_t;
ASDF_TEST_DECLARATIONS;
static uint32_t key_matrix[ASDF_NUM_ROWS];
void setUp(void)
{
asdf_buffer_init();
asdf_init();
// initialize simulated key matrix
for (uint32_t i = 0; i < ASDF_NUM_ROWS; i++) {
key_matrix[i] = 0;
}
}
void tearDown(void) {}
coord_t *find_code(asdf_keycode_t code)
{
uint32_t done = 0;
static coord_t location = { .row = -1, .col = -1 };
for (uint32_t row = 0; !done && (row < ASDF_NUM_ROWS); row++) {
for (uint32_t col = 0; !done && (col < ASDF_NUM_COLS); col++) {
if (test_PLAIN_matrix[row][col] == code) {
done = 1;
location.row = row;
location.col = col;
}
}
}
return &location;
}
asdf_keycode_t shifted(asdf_keycode_t code)
<{
coord_t *location = find_code(code);
return test_SHIFT_matrix[location->row][location->col];
}
asdf_keycode_t caps(asdf_keycode_t code)
{
coord_t *xy = find_code(code);
return test_CAPS_matrix[xy->row][xy->col];
}
asdf_keycode_t ctrl(asdf_keycode_t code)
{
coord_t *xy = find_code(code);
return test_CTRL_matrix[xy->row][xy->col];
}
void keyscan_delay(int32_t ticks)
{
for (; ticks; ticks--) {
asdf_keyscan();
}
}
void press_no_debounce(asdf_keycode_t code)
{
coord_t *location = find_code(code);
key_matrix[location->row] |= (1 << location->col);
}
void release_no_debounce(asdf_keycode_t code)
{
coord_t *location = find_code(code);
key_matrix[location->row] &= ~(1 << location->col);
}
void press(asdf_keycode_t code)
{
press_no_debounce(code);
keyscan_delay(ASDF_DEBOUNCE_TIME_MS);
}
void release(asdf_keycode_t code)
{
release_no_debounce(code);
keyscan_delay(ASDF_DEBOUNCE_TIME_MS);
}
asdf_cols_t asdf_arch_read_row(uint8_t row)
{
return key_matrix[row];
}
// No repsonse to a keypress before it is debounced.
void pressing_a_gives_nothing_before_debounce(void)
{
press_no_debounce(key_a);
// no keypress after only ASDF_DEBOUNCE_TIME_MS -1 ticks (not yet debounced):
keyscan_delay(ASDF_DEBOUNCE_TIME_MS - 1);
TEST_ASSERT_EQUAL_INT32(ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing 'A' gives 'a'
void pressing_a_gives_a(void)
{
press_no_debounce(key_a);
// no keypress after only ASDF_DEBOUNCE_TIME_MS -1 ticks (not yet debounced):
keyscan_delay(ASDF_DEBOUNCE_TIME_MS - 1);
TEST_ASSERT_EQUAL_INT32(ASDF_INVALID_CODE, (int32_t) asdf_next_code());
// allow the key to finish debounce
keyscan_delay(1);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (int32_t) asdf_next_code());
// no more codes in the buffer.
TEST_ASSERT_EQUAL_INT32(ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing SHIFT+A gives 'A'
void pressing_shift_a_gives_shifted_a(void)
{
press(ACTION_SHIFT);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) shifted(key_a), (int32_t) asdf_next_code());
}
// pressing CAPS+A gives 'A'
void pressing_caps_a_gives_caps_a(void)
{
press(ACTION_CAPS);
release(ACTION_CAPS);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) caps(key_a), (int32_t) asdf_next_code());
}
// pressing CTRL+A gives 0x01 (Ctrl-A)
void pressing_ctrl_a_gives_ctrl_a(void)
{
press(ACTION_CTRL);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) ctrl(key_a), (int32_t) asdf_next_code());
}
// pressing REPT+A repeats 'a'
void pressing_rept_a_repeats_a(void)
{
press(ACTION_REPEAT);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
}
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing REPT+SHIFT+A repeats 'A'
void pressing_shift_rept_a_repeats_shifted_a(void)
{
press(ACTION_REPEAT);
press(ACTION_SHIFT);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) shifted(key_a), (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) shifted(key_a), (uint32_t) asdf_next_code());
}
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing REPT+CAPS+A repeats 'A'
void pressing_caps_rept_a_repeats_caps_a(void)
{
press(ACTION_REPEAT);
press(ACTION_CAPS);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) caps(key_a), (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) caps(key_a), (uint32_t) asdf_next_code());
}
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing REPT+CTRL+A repeats CTRL-A
void pressing_ctrl_rept_a_repeats_ctrl_a(void)
{
press(ACTION_REPEAT);
press(ACTION_CTRL);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) ctrl(key_a), (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
for (int i = 0; i < NUM_REPEATS + 1; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) ctrl(key_a), (uint32_t) asdf_next_code());
}
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing and holding 'A' autorepeats 'A'
void holding_a_autorepeats_a(void)
{
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(ASDF_AUTOREPEAT_TIME_MS);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing and holding 'A' autorepeats 'A'
void holding_a_autorepeats_slow_then_fast(void)
{
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(ASDF_AUTOREPEAT_TIME_MS);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
}
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing and holding 'A' and 'B' within less than debounce interval
// eventually returns 'A' then 'B'
void pressing_a_then_b_before_debounce_gives_a_then_b(void)
{
press_no_debounce(key_a);
// press B very quickly after a
keyscan_delay(1);
press(key_b);
// first get back A
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// next get back B
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
// and then verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing and holding a series of keys (up to buffer size) in rapid
// succession, allowing each key to debounce, before sending the next, sends all
// the keys in order. (n-key rollover)
void test_key_sequence_nkro(void)
{
for (int i = 0; i < (int32_t) strlen(test_string); i++) {
press((asdf_keycode_t) test_string[i]);
}
for (int i = 0; i < (int32_t) strlen(test_string); i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) test_string[i], (int32_t) asdf_next_code());
}
// and then verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// pressing and holding a series of keys (up to buffer size) in rapid succession
// without waiting for prior keys to debounce, eventually debounces and sends
// all the keys in order. (n-key rollover)
void test_key_sequence_nkro_simultaneous_debounce(void)
{
for (int i = 0; i < (int32_t) strlen(test_string); i++) {
press_no_debounce((asdf_keycode_t) test_string[i]);
keyscan_delay(1);
}
// several keys are already debounced, but now make sure they all are:
keyscan_delay(ASDF_DEBOUNCE_TIME_MS);
for (int i = 0; i < (int32_t) strlen(test_string); i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) test_string[i], (int32_t) asdf_next_code());
}
// and then verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// holding 'A' then pressing 'B' before autorepeat interval and holding 'B' gives 'A', then repeats
// 'B'
void holding_a_briefly_then_holding_b_gives_a_and_repeats_b(void)
{
press(key_a);
keyscan_delay(ASDF_AUTOREPEAT_TIME_MS / 2);
press(key_b);
// hold "a" and "b" for autorepeat delay:
keyscan_delay(ASDF_AUTOREPEAT_TIME_MS);
// hold "a" and "b" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
// should get "a" back, then "b"
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
// now get back NUM_REEPEATS repetitions of "b"
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
}
// and then verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// holding 'B' while repeating 'A' starts autorepeat delay, then starts repeating 'B'
void holding_a_then_holding_b_autorepeats_a_then_autorepeats_b(void)
{
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// hold "a" for AUTOREPEAT delay
keyscan_delay(ASDF_AUTOREPEAT_TIME_MS);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
// empty the buffer to make room for 'B'
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
}
// now press "b" while "a" is autorepeating:
press(key_b);
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
// hold "a" for autorepeat delay
keyscan_delay(ASDF_AUTOREPEAT_TIME_MS);
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
// empty the buffer to make room for 'B'
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
}
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
// Pressing and holding 'A' then holding 'B' with repeat key held repeats 'A' then 'B'
void repeating_with_a_then_adding_b_repeats_a_then_repeats_b(void)
{
press(ACTION_REPEAT);
press(key_a);
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
// empty the buffer to make room for 'B'
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) key_a, (uint32_t) asdf_next_code());
}
// now press "b" while "a" is autorepeating:
press(key_b);
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
// hold "a" for NUM_REPEATS repeat cycles:
keyscan_delay(NUM_REPEATS * ASDF_REPEAT_TIME_MS);
// empty the buffer to make room for 'B'
for (int i = 0; i < NUM_REPEATS; i++) {
TEST_ASSERT_EQUAL_INT32((int32_t) key_b, (uint32_t) asdf_next_code());
}
// and verify there are no more codes in buffer:
TEST_ASSERT_EQUAL_INT32((int32_t) ASDF_INVALID_CODE, (int32_t) asdf_next_code());
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(pressing_a_gives_nothing_before_debounce);
RUN_TEST(pressing_a_gives_a);
RUN_TEST(pressing_shift_a_gives_shifted_a);
RUN_TEST(pressing_caps_a_gives_caps_a);
RUN_TEST(pressing_ctrl_a_gives_ctrl_a);
RUN_TEST(pressing_rept_a_repeats_a);
RUN_TEST(pressing_shift_rept_a_repeats_shifted_a);
RUN_TEST(pressing_caps_rept_a_repeats_caps_a);
RUN_TEST(holding_a_autorepeats_a);
RUN_TEST(holding_a_autorepeats_slow_then_fast);
RUN_TEST(pressing_a_then_b_before_debounce_gives_a_then_b);
RUN_TEST(test_key_sequence_nkro);
RUN_TEST(test_key_sequence_nkro_simultaneous_debounce);
RUN_TEST(holding_a_briefly_then_holding_b_gives_a_and_repeats_b);
RUN_TEST(holding_a_then_holding_b_autorepeats_a_then_autorepeats_b);
RUN_TEST(repeating_with_a_then_adding_b_repeats_a_then_repeats_b);
return UNITY_END();
}

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,8 @@ $Descr USLedger 17000 11000
encoding utf-8
Sheet 1 1
Title "Unified Retro Keyboard Apple 2 Encoder"
Date "2020-12-22"
Rev "4.2"
Date "2021-08-08"
Rev "4.3"
Comp "OSIWeb.org"
Comment1 "Main Keyboard Interface"
Comment2 ""
@ -1082,7 +1082,7 @@ U 1 1 5E301C34
P 10150 3500
F 0 "D9" H 11000 3500 50 0000 C CNN
F 1 "1N4148" H 10090 3610 50 0000 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 3325 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 3325 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 3500 50 0001 C CNN
F 4 "YES" H 10150 3500 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 3500 50 0001 C CNN "Fitted"
@ -1100,7 +1100,7 @@ U 1 1 5E36B862
P 9950 3600
F 0 "D1" H 11000 3600 50 0000 C CNN
F 1 "1N4148" H 9748 3640 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 3425 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 3425 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 3600 50 0001 C CNN
F 4 "YES" H 9950 3600 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 3600 50 0001 C CNN "Fitted"
@ -1118,7 +1118,7 @@ U 1 1 5E3942E4
P 10150 3700
F 0 "D10" H 11000 3700 50 0000 C CNN
F 1 "1N4148" H 9948 3740 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 3525 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 3525 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 3700 50 0001 C CNN
F 4 "YES" H 10150 3700 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 3700 50 0001 C CNN "Fitted"
@ -1136,7 +1136,7 @@ U 1 1 5E357678
P 9950 3800
F 0 "D2" H 11000 3800 50 0000 C CNN
F 1 "1N4148" H 9748 3840 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 3625 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 3625 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 3800 50 0001 C CNN
F 4 "YES" H 9950 3800 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 3800 50 0001 C CNN "Fitted"
@ -1154,7 +1154,7 @@ U 1 1 5E37FC86
P 10150 3900
F 0 "D11" H 11000 3900 50 0000 C CNN
F 1 "1N4148" H 9948 3940 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 3725 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 3725 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 3900 50 0001 C CNN
F 4 "YES" H 10150 3900 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 3900 50 0001 C CNN "Fitted"
@ -1172,7 +1172,7 @@ U 1 1 5E34160D
P 9950 4000
F 0 "D3" H 11000 4000 50 0000 C CNN
F 1 "1N4148" H 9748 4040 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 3825 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 3825 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 4000 50 0001 C CNN
F 4 "YES" H 9950 4000 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 4000 50 0001 C CNN "Fitted"
@ -1190,7 +1190,7 @@ U 1 1 5E32CB02
P 10150 4100
F 0 "D12" H 11000 4100 50 0000 C CNN
F 1 "1N4148" H 9948 4140 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 3925 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 3925 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 4100 50 0001 C CNN
F 4 "YES" H 10150 4100 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 4100 50 0001 C CNN "Fitted"
@ -1208,7 +1208,7 @@ U 1 1 5E316F0B
P 9950 4200
F 0 "D4" H 11000 4200 50 0000 C CNN
F 1 "1N4148" H 9748 4240 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 4025 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 4025 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 4200 50 0001 C CNN
F 4 "YES" H 9950 4200 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 4200 50 0001 C CNN "Fitted"
@ -1304,7 +1304,7 @@ U 1 1 5F1EFED9
P 10150 4500
F 0 "D13" H 11000 4500 50 0000 C CNN
F 1 "1N4148" H 10090 4610 50 0000 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 4325 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 4325 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 4500 50 0001 C CNN
F 4 "YES" H 10150 4500 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 4500 50 0001 C CNN "Fitted"
@ -1322,7 +1322,7 @@ U 1 1 5F1EFEDF
P 9950 4600
F 0 "D5" H 11000 4600 50 0000 C CNN
F 1 "1N4148" H 9748 4640 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 4425 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 4425 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 4600 50 0001 C CNN
F 4 "YES" H 9950 4600 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 4600 50 0001 C CNN "Fitted"
@ -1340,7 +1340,7 @@ U 1 1 5F1EFEE5
P 10150 4700
F 0 "D14" H 11000 4700 50 0000 C CNN
F 1 "1N4148" H 9948 4740 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 4525 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 4525 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 4700 50 0001 C CNN
F 4 "YES" H 10150 4700 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 4700 50 0001 C CNN "Fitted"
@ -1358,7 +1358,7 @@ U 1 1 5F1EFEEB
P 9950 4800
F 0 "D6" H 11000 4800 50 0000 C CNN
F 1 "1N4148" H 9748 4840 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 4625 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 4625 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 4800 50 0001 C CNN
F 4 "YES" H 9950 4800 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 4800 50 0001 C CNN "Fitted"
@ -1376,7 +1376,7 @@ U 1 1 5F1EFEF1
P 10150 4900
F 0 "D15" H 11000 4900 50 0000 C CNN
F 1 "1N4148" H 9948 4940 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 4725 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 4725 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 4900 50 0001 C CNN
F 4 "YES" H 10150 4900 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 4900 50 0001 C CNN "Fitted"
@ -1394,7 +1394,7 @@ U 1 1 5F1EFEF7
P 9950 5000
F 0 "D7" H 11000 5000 50 0000 C CNN
F 1 "1N4148" H 9748 5040 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 4825 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 4825 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 5000 50 0001 C CNN
F 4 "YES" H 9950 5000 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 5000 50 0001 C CNN "Fitted"
@ -1412,7 +1412,7 @@ U 1 1 5F1EFEFD
P 10150 5100
F 0 "D16" H 11000 5100 50 0000 C CNN
F 1 "1N4148" H 9948 5140 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 10150 4925 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 10150 4925 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 10150 5100 50 0001 C CNN
F 4 "YES" H 10150 5100 50 0001 C CNN "Substitution OK"
F 5 "NO" H 10150 5100 50 0001 C CNN "Fitted"
@ -1430,7 +1430,7 @@ U 1 1 5F1EFF03
P 9950 5200
F 0 "D8" H 11000 5200 50 0000 C CNN
F 1 "1N4148" H 9748 5240 50 0001 C CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 9950 5025 50 0001 C CNN
F 2 "unikbd:D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" H 9950 5025 50 0001 C CNN
F 3 "https://assets.nexperia.com/documents/data-sheet/1N4148_1N4448.pdf" H 9950 5200 50 0001 C CNN
F 4 "YES" H 9950 5200 50 0001 C CNN "Substitution OK"
F 5 "NO" H 9950 5200 50 0001 C CNN "Fitted"

View File

@ -0,0 +1,785 @@
(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)
(symbol "MNT McMaster Bolt, #4-40, 1/2{dblquote} Long, stainless steel" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board no)
(property "Reference" "BOLT" (at 0 3.048 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "#4-40, 1/2\"" (at -27.94 -34.798 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
(property "Footprint" "" (at 0.9652 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (at -26.162 -29.464 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Value" "#4-40, 1/2\"" (at 6.096 4.826 0)
(effects (font (size 1.27 1.27)))
)
(property "Tolerance" "If applicable" (at -22.098 -39.624 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer" "McMaster Carr" (at -26.162 -18.288 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer Link" "https://www.mcmaster.com/catalog/129/3390/91772A110" (at -23.368 -24.892 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS Document Link" "RoHs Link" (at -23.114 -64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer PN" "91772A110" (at -23.876 -21.844 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS" "n/a" (at -26.416 -61.976 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Allow Substitution" "No" (at -26.67 -67.818 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Fitted" "Yes" (at -25.654 -72.644 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Tracking" "No" (at -26.162 -70.104 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "BOM Comment" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Type" "Spacer" (at -4.572 -36.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Type" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Variant" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Number of Pins" "If applicable" (at -22.098 -42.164 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Storage)" "If applicable" (at -22.098 -44.196 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Operating)" "If applicable" (at -21.844 -46.736 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Soldering)" "If applicable" (at -21.844 -49.53 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp Coeff." "If applicable" (at -21.844 -52.07 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Power Rating" "If applicable" (at -21.844 -54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Material" "stainless steel" (at -21.844 -56.896 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Class" "If applicable" (at -21.844 -59.182 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Standards Version" "1.1" (at -25.654 -75.692 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Sim.Enable" "0" (at -10.16 -7.62 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "spacer mounting #4" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Bolt, #4-40, 1/2\" Long, stainless steel" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "C_*" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "MNT McMaster Bolt, #4-40, 1/2{dblquote} Long, stainless steel_1_1"
(polyline
(pts
(xy 0.6604 -1.5748)
(xy 1.143 -1.4478)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -1.3208)
(xy 1.143 -1.1938)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -1.0668)
(xy 1.143 -0.9398)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.7874)
(xy 1.143 -0.6604)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.5334)
(xy 1.143 -0.4064)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.2794)
(xy 1.143 -0.1524)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.0508)
(xy 0.6604 -1.905)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 1.143 -0.0508)
(xy 1.143 -1.905)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 1.8034 0.0254)
(xy 0.1016 0.0254)
)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0.661 -1.9052) (mid 0.8844 -2.013) (end 1.1182 -1.9306)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.1054 -1.867) (mid 0.8819 -1.7592) (end 0.6482 -1.8416)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.7399 0.089) (mid 0.9144 0.4309) (end 0.0889 0.089)
(stroke (width 0) (type default))
(fill (type none))
)
)
)
(symbol "MNT McMaster Bolt, #4-40, 7/16{dblquote} Long, stainless steel" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board no)
(property "Reference" "BOLT" (at 0 3.048 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "#4-40, 7/16\"" (at -27.94 -34.798 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
(property "Footprint" "" (at 0.9652 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (at -26.162 -29.464 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Value" "#4-40, 7/16\"" (at 6.096 4.826 0)
(effects (font (size 1.27 1.27)))
)
(property "Tolerance" "If applicable" (at -22.098 -39.624 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer" "McMaster Carr" (at -26.162 -18.288 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer Link" "https://www.mcmaster.com/catalog/129/3390/91772A109" (at -23.368 -24.892 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS Document Link" "RoHs Link" (at -23.114 -64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer PN" "91772A109" (at -23.876 -21.844 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS" "n/a" (at -26.416 -61.976 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Allow Substitution" "No" (at -26.67 -67.818 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Fitted" "Yes" (at -25.654 -72.644 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Tracking" "No" (at -26.162 -70.104 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "BOM Comment" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Type" "Spacer" (at -4.572 -36.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Type" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Variant" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Number of Pins" "If applicable" (at -22.098 -42.164 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Storage)" "If applicable" (at -22.098 -44.196 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Operating)" "If applicable" (at -21.844 -46.736 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Soldering)" "If applicable" (at -21.844 -49.53 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp Coeff." "If applicable" (at -21.844 -52.07 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Power Rating" "If applicable" (at -21.844 -54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Material" "stainless steel" (at -21.844 -56.896 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Class" "If applicable" (at -21.844 -59.182 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Standards Version" "1.1" (at -25.654 -75.692 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Sim.Enable" "0" (at -2.54 -5.08 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "spacer mounting #4" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Bolt, #4-40, 7/16\" Long, stainless steel" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "C_*" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "MNT McMaster Bolt, #4-40, 7/16{dblquote} Long, stainless steel_1_1"
(polyline
(pts
(xy 0.6604 -1.5748)
(xy 1.143 -1.4478)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -1.3208)
(xy 1.143 -1.1938)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -1.0668)
(xy 1.143 -0.9398)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.7874)
(xy 1.143 -0.6604)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.5334)
(xy 1.143 -0.4064)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.2794)
(xy 1.143 -0.1524)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6604 -0.0508)
(xy 0.6604 -1.905)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 1.143 -0.0508)
(xy 1.143 -1.905)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 1.8034 0.0254)
(xy 0.1016 0.0254)
)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0.661 -1.9052) (mid 0.8844 -2.013) (end 1.1182 -1.9306)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.1054 -1.867) (mid 0.8819 -1.7592) (end 0.6482 -1.8416)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.7399 0.089) (mid 0.9144 0.4309) (end 0.0889 0.089)
(stroke (width 0) (type default))
(fill (type none))
)
)
)
(symbol "MNT McMaster Lockwasher, #4-40, internal teeth, stainless steel" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board no)
(property "Reference" "WASHER" (at 0 3.048 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "Lockwasher, #4-40" (at -27.94 -34.798 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
(property "Footprint" "" (at 0.9652 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (at -26.162 -29.464 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Value" "Lockwasher, #4-40" (at 6.096 4.826 0)
(effects (font (size 1.27 1.27)))
)
(property "Tolerance" "If applicable" (at -22.098 -39.624 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer" "McMaster Carr" (at -26.162 -18.288 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer Link" "https://www.mcmaster.com/catalog/129/3636/95584A200" (at -23.368 -24.892 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS Document Link" "RoHs Link" (at -23.114 -64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer PN" "95584A200" (at -23.876 -21.844 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS" "n/a" (at -26.416 -61.976 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Allow Substitution" "No" (at -26.67 -67.818 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Fitted" "Yes" (at -25.654 -72.644 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Tracking" "No" (at -26.162 -70.104 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "BOM Comment" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Type" "Spacer" (at -4.572 -36.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Type" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Variant" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Number of Pins" "If applicable" (at -22.098 -42.164 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Storage)" "If applicable" (at -22.098 -44.196 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Operating)" "If applicable" (at -21.844 -46.736 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Soldering)" "If applicable" (at -21.844 -49.53 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp Coeff." "If applicable" (at -21.844 -52.07 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Power Rating" "If applicable" (at -21.844 -54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Material" "stainless steel" (at -21.844 -56.896 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Class" "If applicable" (at -21.844 -59.182 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Standards Version" "1.1" (at -25.654 -75.692 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Sim.Enable" "0" (at -5.08 -5.08 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "lockwasher mounting #4" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Lockwasher, #4-40, internal teeth, stainless steel" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "C_*" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "MNT McMaster Lockwasher, #4-40, internal teeth, stainless steel_0_1"
(polyline
(pts
(xy 1.9812 1.2192)
(xy 1.9812 1.8542)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 2.1336 2.0574)
(xy 2.1336 1.3462)
)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0 0) (mid 0.5957 -1.4363) (end 2.032 -2.032)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0.6858 0) (mid 1.0389 -0.9795) (end 1.9812 -1.4224)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.9558 1.2192) (mid 1.0752 0.907) (end 0.6731 0.0635)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.9558 1.8542) (mid 0.6103 1.3702) (end -0.0018 0.078)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 2.0338 -2.0338) (mid 3.4701 -1.4381) (end 4.0658 -0.0018)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 2.0447 -1.4097) (mid 3.0242 -1.0566) (end 3.4671 -0.1143)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 3.4671 -0.0635) (mid 3.114 0.916) (end 2.1717 1.3589)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 4.0658 0.0526) (mid 3.4908 1.4342) (end 2.1082 2.0066)
(stroke (width 0) (type default))
(fill (type none))
)
)
)
(symbol "MNT McMaster Nut, #4-40, stainless steel" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board no)
(property "Reference" "NUT" (at 0 3.048 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "#4-40" (at -27.94 -34.798 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
(property "Footprint" "" (at 0.9652 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (at -26.162 -29.464 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Value" "#4-40" (at 6.096 4.826 0)
(effects (font (size 1.27 1.27)))
)
(property "Tolerance" "If applicable" (at -22.098 -39.624 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer" "McMaster Carr" (at -26.162 -18.288 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer Link" "https://www.mcmaster.com/catalog/129/3582/91841A005" (at -23.368 -24.892 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS Document Link" "RoHs Link" (at -23.114 -64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer PN" "91841A005" (at -23.876 -21.844 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS" "n/a" (at -26.416 -61.976 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Allow Substitution" "No" (at -26.67 -67.818 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Fitted" "Yes" (at -25.654 -72.644 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Tracking" "No" (at -26.162 -70.104 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "BOM Comment" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Type" "Spacer" (at -4.572 -36.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Type" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Variant" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Number of Pins" "If applicable" (at -22.098 -42.164 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Storage)" "If applicable" (at -22.098 -44.196 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Operating)" "If applicable" (at -21.844 -46.736 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Soldering)" "If applicable" (at -21.844 -49.53 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp Coeff." "If applicable" (at -21.844 -52.07 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Power Rating" "If applicable" (at -21.844 -54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Material" "stainless steel" (at -21.844 -56.896 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Class" "If applicable" (at -21.844 -59.182 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Standards Version" "1.1" (at -25.654 -75.692 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Sim.Enable" "0" (at 10.16 -2.54 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "nut mounting #4" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Nut, #4-40, stainless steel" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "C_*" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "MNT McMaster Nut, #4-40, stainless steel_0_1"
(polyline
(pts
(xy 0 1.905)
(xy 1.27 1.905)
(xy 2.54 0)
(xy 1.27 -1.905)
(xy -1.27 -1.905)
(xy -2.54 0)
(xy -1.27 1.905)
(xy 0 1.905)
)
(stroke (width 0) (type default))
(fill (type none))
)
(circle (center 0 0) (radius 1.0074)
(stroke (width 0) (type default))
(fill (type none))
)
)
)
(symbol "MNT McMaster Spacer, #4, 3/16{dblquote} OD, 1/8{dblquote} Long, white nylon" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board no)
(property "Reference" "SPACER" (at 0 3.048 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "Standard Template" (at -27.94 -34.798 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
(property "Footprint" "" (at 0.9652 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (at -26.162 -29.464 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Value" "3/16\" OD, 1/8\" Long, #4, nylon" (at 6.096 4.826 0)
(effects (font (size 1.27 1.27)))
)
(property "Tolerance" "If applicable" (at -22.098 -39.624 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer" "McMaster Carr" (at -26.162 -18.288 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer Link" "https://www.mcmaster.com/catalog/129/3669/94639A702" (at -23.368 -24.892 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS Document Link" "RoHs Link" (at -23.114 -64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer PN" "94639A702" (at -23.876 -21.844 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "RoHS" "n/a" (at -26.416 -61.976 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Allow Substitution" "No" (at -26.67 -67.818 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Fitted" "Yes" (at -25.654 -72.644 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Tracking" "No" (at -26.162 -70.104 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "BOM Comment" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Component Type" "Spacer" (at -4.572 -36.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Type" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Package Variant" "" (at 0.0762 -0.0254 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Number of Pins" "If applicable" (at -22.098 -42.164 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Storage)" "If applicable" (at -22.098 -44.196 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Operating)" "If applicable" (at -21.844 -46.736 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp (Soldering)" "If applicable" (at -21.844 -49.53 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Temp Coeff." "If applicable" (at -21.844 -52.07 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Power Rating" "If applicable" (at -21.844 -54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Material" "nylon" (at -21.844 -56.896 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Class" "If applicable" (at -21.844 -59.182 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Standards Version" "1.1" (at -25.654 -75.692 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Sim.Enable" "0" (at -12.7 -12.7 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "spacer mounting #4" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Spacer, #4, 3/16\" OD, 1/8\" Long, white nylon" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "C_*" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "MNT McMaster Spacer, #4, 3/16{dblquote} OD, 1/8{dblquote} Long, white nylon_1_1"
(polyline
(pts
(xy 0.0508 0)
(xy 0.0508 -1.8542)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0.6858 -1.8542)
(xy 0.6858 -0.0254)
)
(stroke (width 0) (type dot))
(fill (type none))
)
(polyline
(pts
(xy 1.1176 -1.8796)
(xy 1.1176 -0.0508)
)
(stroke (width 0) (type dot))
(fill (type none))
)
(polyline
(pts
(xy 1.7272 -0.0508)
(xy 1.7272 -1.905)
)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0.0762 -1.905) (mid 0.9017 -2.2469) (end 1.7272 -1.905)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0.0762 -0.0254) (mid 0.9017 -0.3673) (end 1.7272 -0.0254)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0.6604 -0.0254) (mid 0.8837 -0.1328) (end 1.1176 -0.0508)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 0.661 -1.9052) (mid 0.8844 -2.013) (end 1.1182 -1.9306)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.1048 0.0128) (mid 0.8815 0.1201) (end 0.6476 0.0382)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.1054 -1.867) (mid 0.8819 -1.7592) (end 0.6482 -1.8416)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.7145 -1.8922) (mid 0.889 -1.5503) (end 0.0635 -1.8922)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 1.7145 -0.0126) (mid 0.889 0.3293) (end 0.0635 -0.0126)
(stroke (width 0) (type default))
(fill (type none))
)
)
)
)

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,57 @@
(module D_DO-35_SOD27_P7.62mm_Horizontal_bypassed (layer F.Cu) (tedit 5EBC782E)
(footprint "D_DO-35_SOD27_P7.62mm_Horizontal_bypassed" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 5EBC782E)
(descr "Diode, DO-35_SOD27 series, Axial, Horizontal, pin pitch=7.62mm, , length*diameter=4*2mm^2, , http://www.diodes.com/_files/packages/DO-35.pdf")
(tags "Diode DO-35_SOD27 series Axial Horizontal pin pitch 7.62mm length 4mm diameter 2mm")
(fp_text reference REF** (at 3.81 -2.12) (layer F.SilkS)
(tags "net tie diode jumper")
(attr through_hole)
(fp_text reference "REF**" (at 3.81 -2.12) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp d08ab517-137d-4194-9e87-91361ec16cb4)
)
(fp_text value D_DO-35_SOD27_P7.62mm_Horizontal (at 3.81 2.12) (layer F.Fab)
(fp_text value "D_DO-35_SOD27_P7.62mm_Horizontal" (at 3.81 2.12) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 5e060016-e6c0-463b-ae22-ada48d81bc6b)
)
(fp_text user K (at 0 -1.8) (layer F.SilkS)
(fp_text user "K" (at 0 -1.8) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 489fc5b8-041c-49c7-9533-fd894fba6a3d)
)
(fp_text user K (at 0 -1.8) (layer F.Fab)
(fp_text user "K" (at 0 -1.8) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 1da2d060-9d22-487a-9e55-a63ecab0db6a)
)
(fp_text user %R (at 4.11 0) (layer F.Fab)
(fp_text user "${REFERENCE}" (at 4.11 0) (layer "F.Fab")
(effects (font (size 0.8 0.8) (thickness 0.12)))
(tstamp 728804c3-90a5-447d-9c05-619d3e81ff51)
)
(fp_line (start 8.67 -1.25) (end -1.05 -1.25) (layer F.CrtYd) (width 0.05))
(fp_line (start 8.67 1.25) (end 8.67 -1.25) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.05 1.25) (end 8.67 1.25) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.05 -1.25) (end -1.05 1.25) (layer F.CrtYd) (width 0.05))
(fp_line (start 2.29 -1.12) (end 2.29 1.12) (layer F.SilkS) (width 0.12))
(fp_line (start 2.53 -1.12) (end 2.53 1.12) (layer F.SilkS) (width 0.12))
(fp_line (start 2.41 -1.12) (end 2.41 1.12) (layer F.SilkS) (width 0.12))
(fp_line (start 6.58 0) (end 5.93 0) (layer F.SilkS) (width 0.12))
(fp_line (start 1.04 0) (end 1.69 0) (layer F.SilkS) (width 0.12))
(fp_line (start 5.93 -1.12) (end 1.69 -1.12) (layer F.SilkS) (width 0.12))
(fp_line (start 5.93 1.12) (end 5.93 -1.12) (layer F.SilkS) (width 0.12))
(fp_line (start 1.69 1.12) (end 5.93 1.12) (layer F.SilkS) (width 0.12))
(fp_line (start 1.69 -1.12) (end 1.69 1.12) (layer F.SilkS) (width 0.12))
(fp_line (start 2.31 -1) (end 2.31 1) (layer F.Fab) (width 0.1))
(fp_line (start 2.51 -1) (end 2.51 1) (layer F.Fab) (width 0.1))
(fp_line (start 2.41 -1) (end 2.41 1) (layer F.Fab) (width 0.1))
(fp_line (start 7.62 0) (end 5.81 0) (layer F.Fab) (width 0.1))
(fp_line (start 0 0) (end 1.81 0) (layer F.Fab) (width 0.1))
(fp_line (start 5.81 -1) (end 1.81 -1) (layer F.Fab) (width 0.1))
(fp_line (start 5.81 1) (end 5.81 -1) (layer F.Fab) (width 0.1))
(fp_line (start 1.81 1) (end 5.81 1) (layer F.Fab) (width 0.1))
(fp_line (start 1.81 -1) (end 1.81 1) (layer F.Fab) (width 0.1))
(fp_poly (pts (xy 7.239 0.127) (xy 0.381 0.127) (xy 0.381 0) (xy 7.239 0)) (layer F.Cu) (width 0.0508))
(pad 2 thru_hole oval (at 7.62 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask))
(pad 1 thru_hole rect (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask))
(fp_poly (pts
(xy 7.112 0.127)
(xy 0.508 0.127)
(xy 0.508 0)
(xy 7.112 0)
) (layer "F.Cu") (width 0.0508) (fill solid) (tstamp 80c61bb9-37b5-4c80-807f-0e1c3664ddb4))
(fp_line (start 5.93 1.12) (end 5.93 -1.12) (layer "F.SilkS") (width 0.12) (tstamp 009dd38e-cd0a-4e4b-8376-e17850b40394))
(fp_line (start 1.69 -1.12) (end 1.69 1.12) (layer "F.SilkS") (width 0.12) (tstamp 2a85165b-8689-4651-b5b6-6e1774db45ef))
(fp_line (start 2.53 -1.12) (end 2.53 1.12) (layer "F.SilkS") (width 0.12) (tstamp a5430a80-d784-41d8-83de-e2f7822875c0))
(fp_line (start 2.29 -1.12) (end 2.29 1.12) (layer "F.SilkS") (width 0.12) (tstamp b05645bc-98a8-4a66-a19b-cd3656d6b1b2))
(fp_line (start 6.58 0) (end 5.93 0) (layer "F.SilkS") (width 0.12) (tstamp b84bf7e1-4132-4add-8770-3bb3b007eecb))
(fp_line (start 2.41 -1.12) (end 2.41 1.12) (layer "F.SilkS") (width 0.12) (tstamp d2ec4eda-d1de-4e61-8f90-8e48e063480e))
(fp_line (start 1.69 1.12) (end 5.93 1.12) (layer "F.SilkS") (width 0.12) (tstamp d550ca27-957a-4a94-b532-e8fad6d6c940))
(fp_line (start 5.93 -1.12) (end 1.69 -1.12) (layer "F.SilkS") (width 0.12) (tstamp dabd3fc4-d062-4dac-8108-1c578c07b096))
(fp_line (start 1.04 0) (end 1.69 0) (layer "F.SilkS") (width 0.12) (tstamp e025baa7-b570-40a0-a637-3cf1ecd6e628))
(fp_line (start 8.67 -1.25) (end -1.05 -1.25) (layer "F.CrtYd") (width 0.05) (tstamp 1a458631-594f-425f-aa02-07aa67b58536))
(fp_line (start -1.05 -1.25) (end -1.05 1.25) (layer "F.CrtYd") (width 0.05) (tstamp 661a58f1-0459-44ad-8bd7-8469570636df))
(fp_line (start -1.05 1.25) (end 8.67 1.25) (layer "F.CrtYd") (width 0.05) (tstamp 8672d9d5-76f6-47e1-8f0c-601ab662de5f))
(fp_line (start 8.67 1.25) (end 8.67 -1.25) (layer "F.CrtYd") (width 0.05) (tstamp d9535cea-fada-43d6-9b66-6654a06c1456))
(fp_line (start 2.41 -1) (end 2.41 1) (layer "F.Fab") (width 0.1) (tstamp 0f65d06a-076d-4874-9188-171988003480))
(fp_line (start 1.81 1) (end 5.81 1) (layer "F.Fab") (width 0.1) (tstamp 3ae64378-0d07-479c-89ae-33112f849b31))
(fp_line (start 2.31 -1) (end 2.31 1) (layer "F.Fab") (width 0.1) (tstamp 4b644ed8-033d-433e-8ae3-739a5a16af29))
(fp_line (start 0 0) (end 1.81 0) (layer "F.Fab") (width 0.1) (tstamp 5c56dd6f-2d56-46e6-b269-df74fb784508))
(fp_line (start 5.81 -1) (end 1.81 -1) (layer "F.Fab") (width 0.1) (tstamp 5d7ca193-a5ec-4bd0-99b7-4f5a36b38598))
(fp_line (start 2.51 -1) (end 2.51 1) (layer "F.Fab") (width 0.1) (tstamp 80596ef4-98bc-4b89-9bbd-de4481e05ff4))
(fp_line (start 5.81 1) (end 5.81 -1) (layer "F.Fab") (width 0.1) (tstamp 9106e56e-223e-4392-904e-7644cabb99ad))
(fp_line (start 7.62 0) (end 5.81 0) (layer "F.Fab") (width 0.1) (tstamp bb5ff6ec-07f4-4a70-a0b3-1bb277a055b1))
(fp_line (start 1.81 -1) (end 1.81 1) (layer "F.Fab") (width 0.1) (tstamp f4d157a0-bcca-4ea3-a672-640ab334f7dc))
(pad "1" thru_hole rect (at 0 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) (tstamp 4e2c38ea-6642-4bc0-8ae3-4561e1bd1734))
(pad "2" thru_hole oval (at 7.62 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask) (tstamp 9594575e-2758-42b9-905a-924e1341e2bf))
)

View File

@ -0,0 +1,13 @@
(module Futaba-MD-4PCS-aligner_tool (layer F.Cu) (tedit 5FF914FC)
(fp_text reference REF** (at -3.937 -8.3058) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value MD-4PCS-aligner (at 0.1524 8.9408) (layer B.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -7.8232 0) (end -9.525 0) (layer Edge.Cuts) (width 0.1016))
(fp_line (start 7.8232 0) (end 9.525 0) (layer Edge.Cuts) (width 0.1016))
(fp_arc (start 0 0) (end 7.8232 0) (angle -180) (layer Edge.Cuts) (width 0.1016))
(pad "" np_thru_hole circle (at -6.985 -6.985) (size 1.6256 1.6256) (drill 1.6256) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 6.985 -6.985) (size 1.6256 1.6256) (drill 1.6256) (layers *.Cu *.Mask))
)

View File

@ -1,31 +1,40 @@
(module Key_MX (layer F.Cu) (tedit 5FEE0FFF)
(fp_text reference SW_** (at -5.7912 -8.6106) (layer F.SilkS)
(footprint "Key_MX" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 5FEE0FFF)
(attr through_hole)
(fp_text reference "SW_**" (at -5.7912 -8.6106) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 4b917266-b616-4b34-b81a-54ed0ba2cc45)
)
(fp_text value Key_MX (at -5.334 8.6614) (layer F.SilkS)
(fp_text value "Key_MX" (at -5.334 8.6614) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp fded6696-7d51-4dd5-8ea2-90f4b4eea8db)
)
(fp_line (start 1.27 -5.08) (end 0.7366 -4.6736) (layer F.Cu) (width 0.3048))
(fp_line (start 1.651 -5.08) (end 1.27 -5.08) (layer F.Cu) (width 0.3048))
(fp_line (start -2.54 1.27) (end 0 3.81) (layer F.Cu) (width 0.3048))
(fp_line (start -2.54 0) (end -2.54 1.27) (layer F.Cu) (width 0.3048))
(fp_line (start -3.81 -2.54) (end -2.54 0) (layer F.Cu) (width 0.3048))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(pad 4 thru_hole circle (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874) (layer "F.CrtYd") (width 0.12) (tstamp 2a6d0c3c-f5d2-49c8-a5d7-8e4c346deef1))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874) (layer "F.CrtYd") (width 0.12) (tstamp 7787030c-1f3e-482b-94d0-35e959f33ad4))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874) (layer "F.CrtYd") (width 0.12) (tstamp b5acfe42-7ec2-4b59-8af6-0a75a8353d47))
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874) (layer "F.CrtYd") (width 0.12) (tstamp ca918f73-1d40-4cc8-a02a-3cf113953dd5))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(solder_mask_margin 0.0762) (tstamp 7b85e4ed-78c5-4ee2-8bda-0e2cdc7d855b))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(solder_mask_margin 0.0762) (tstamp 994defad-7352-4f5b-adbb-4935eaff1c63))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad 3 thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(pad 1 thru_hole circle (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask))
(pad 2 thru_hole circle (at 0 3.8989) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask))
(model ${PROJECT_PATH}/cherry_mx.wrl
(at (xyz 0 0 0))
(solder_mask_margin 0.0762) (tstamp bf0770ca-f766-4af6-8464-833c391420fc))
(pad "1" thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask) (tstamp 1975c8c2-144e-448a-a812-9b2433471950))
(pad "1" thru_hole custom (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0.0508 0.0381) (end 2.6162 -0.9779) (width 0.2))
) (tstamp aeda8d04-e983-4be2-b06d-f5f00510885e))
(pad "2" thru_hole circle (at 0 3.8989) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask) (tstamp 6fe4676a-4801-4b83-afbe-c228f5746fad))
(pad "2" thru_hole custom (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 -0.0254) (end 0.9398 4.0132) (width 0.2))
(gr_line (start 0.9398 4.0132) (end 3.8354 6.3373) (width 0.2))
) (tstamp fe3bd807-98a2-44e9-9eb1-1ffca908639e))
(model "${PROJECT_PATH}/cherry_mx.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)

View File

@ -1,33 +1,49 @@
(module Key_MX_2u (layer F.Cu) (tedit 60186230)
(fp_text reference REF** (at -5.969 -8.763) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(footprint "Key_MX_2u" (version 20221018) (generator pcbnew)
(layer "F.Cu")
(attr through_hole)
(fp_text reference "REF**" (at -5.969 -8.763) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp ef580378-1c67-483e-b6a4-196c840de987)
)
(fp_text value Key_MX_2u (at 0 -0.5) (layer F.Fab) hide
(effects (font (size 1 1) (thickness 0.15)))
(fp_text value "Key_MX_2u" (at 0 -0.5) (layer "F.Fab") hide
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 882d61db-a3a1-483d-8bae-6904ccf5577f)
)
(fp_line (start -3.81 -2.54) (end -2.54 0) (layer F.Cu) (width 0.3048))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 1.651 -5.08) (end 1.27 -5.08) (layer F.Cu) (width 0.3048))
(fp_line (start -2.54 1.27) (end 0 3.81) (layer F.Cu) (width 0.3048))
(fp_line (start 1.27 -5.08) (end 0.7366 -4.6736) (layer F.Cu) (width 0.3048))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start -2.54 0) (end -2.54 1.27) (layer F.Cu) (width 0.3048))
(pad "" np_thru_hole circle (at 11.938 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -11.938 -6.8834) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -11.938 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 11.938 -6.8834) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad 3 thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(pad 1 thru_hole circle (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask))
(pad 2 thru_hole circle (at 0 3.8989) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask))
(pad 4 thru_hole circle (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad "" np_thru_hole oval (at -11.938 -0.1016) (size 5 2) (drill oval 5 2) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at 11.938 -0.1016) (size 5 2) (drill oval 5 2) (layers *.Cu *.Mask))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp a6b82f97-c99f-4d3e-a8db-5e9fabe9cb87))
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp c53f1097-47a2-4400-92f1-ba0dd0fd5dc7))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 5ab15849-d45f-4603-bff9-be4c05db142c))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 510742c1-8093-4709-8b84-6f5331fc1e88))
(pad "" np_thru_hole circle (at -11.938 -6.8834) (size 3.048 3.048) (drill 3.048) (layers "*.Cu" "*.Mask") (tstamp b46c31b9-521a-4471-859e-19e3c06da819))
(pad "" np_thru_hole oval (at -11.938 -0.1016) (size 5 2) (drill oval 5 2) (layers "*.Cu" "*.Mask") (tstamp 788d6ce6-802b-4840-8439-f00251eab8c6))
(pad "" np_thru_hole circle (at -11.938 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers "*.Cu" "*.Mask") (tstamp a4ea0922-9f63-44c9-a721-3ad2329bb434))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp be0a5daf-f849-476c-a808-1428a796cb47))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp fb3e655c-0cf0-4011-a61a-43c06a464bdf))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp 17c722fe-9e72-4e46-875e-a940f31bc49d))
(pad "" np_thru_hole circle (at 11.938 -6.8834) (size 3.048 3.048) (drill 3.048) (layers "*.Cu" "*.Mask") (tstamp eba0dbcc-4657-4b6c-bbd1-4fa1b02dd1ec))
(pad "" np_thru_hole oval (at 11.938 -0.1016) (size 5 2) (drill oval 5 2) (layers "*.Cu" "*.Mask") (tstamp 0ec215f2-8b67-4fe6-9b62-c2ac7b895686))
(pad "" np_thru_hole circle (at 11.938 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers "*.Cu" "*.Mask") (tstamp effe77f8-9977-4f9c-bd4a-c8efb40c32a6))
(pad "1" thru_hole custom (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers "*.Cu" "*.Mask")
(thermal_bridge_angle 45)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 1.27 -0.9779) (end 0.7366 -0.5715) (width 0.3048))
(gr_line (start 1.651 -0.9779) (end 1.27 -0.9779) (width 0.3048))
) (tstamp 7ff7993c-bbaa-46af-a8d5-d37727a21d34))
(pad "1" thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers "*.Cu" "*.Mask") (tstamp 1d1fa26e-d11b-4aed-8dc5-740665250511))
(pad "2" thru_hole custom (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers "*.Cu" "*.Mask")
(thermal_bridge_angle 45)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 -0.1016) (end 1.27 2.4384) (width 0.3048))
(gr_line (start 1.27 2.4384) (end 1.27 3.7084) (width 0.3048))
(gr_line (start 1.27 3.7084) (end 3.81 6.2484) (width 0.3048))
) (tstamp aa78c580-43ee-4a9b-84d1-f225054b7891))
(pad "2" thru_hole circle (at 0 3.8989) (size 2.2352 2.2352) (drill 1.397) (layers "*.Cu" "*.Mask") (tstamp 2908a3a4-df35-402c-ab9f-a269756efcb1))
)

View File

@ -0,0 +1,11 @@
(module Key_MX_Aligner_tool (layer F.Cu) (tedit 5FF919FD)
(fp_text reference REF** (at -5.0292 -7.7724) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value Key_MX_Aligner (at 0 7.9756) (layer B.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_line (start -6.985 -6.8834) (end -6.985 7.0866) (layer Edge.Cuts) (width 0.1016))
(fp_line (start 6.985 7.0866) (end 6.985 -6.8834) (layer Edge.Cuts) (width 0.1016))
(fp_line (start -6.985 -6.8834) (end 6.985 -6.8834) (layer Edge.Cuts) (width 0.1016))
)

View File

@ -0,0 +1,74 @@
(footprint "Key_MX_DIY" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 60186279)
(attr through_hole)
(fp_text reference "SW_**" (at -5.7912 -8.6106) (layer "F.SilkS") hide
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 635addc9-1212-4dd8-9025-d46a1478049c)
)
(fp_text value "Key_MX" (at -5.334 8.6614) (layer "F.SilkS") hide
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 62fcada6-d502-422d-ace5-51c40c4111e6)
)
(fp_line (start -0.889 7.239) (end 0.635 7.239) (layer "F.SilkS") (width 0.1016) (tstamp 27d3534d-16f5-4ccf-9b16-2c5732c06b4d))
(fp_line (start 0.127 6.858) (end 0.127 7.62) (layer "F.SilkS") (width 0.12) (tstamp a988bd6f-305a-49e4-a300-383210fe668e))
(fp_poly (pts
(xy 0.127 7.239)
(xy -0.381 7.493)
(xy -0.381 6.985)
) (layer "F.SilkS") (width 0.1) (fill solid) (tstamp 8d7c4863-decc-41fb-bc0f-c15564084732))
(fp_line (start -7.6962 7.874) (end -7.6962 -9.652) (layer "F.CrtYd") (width 0.12) (tstamp 1fe7f185-5c1e-4d8f-8a18-abb08d1a1e13))
(fp_line (start -7.6962 -9.652) (end 7.6962 -9.652) (layer "F.CrtYd") (width 0.12) (tstamp 6a78f426-b0f1-4a10-8b9d-203792afdc98))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874) (layer "F.CrtYd") (width 0.12) (tstamp ad0afc42-584d-444a-a5d4-943137df2635))
(fp_line (start 7.6962 -9.652) (end 7.6962 7.874) (layer "F.CrtYd") (width 0.12) (tstamp cb063ba2-ba75-4d81-b6d1-01cb2c49d8e0))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762) (tstamp 880b494c-ee53-4f2b-8304-722863728cc3))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762) (tstamp acbb9c7e-a35c-43a0-a03c-5ae34b790b3c))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762) (tstamp e2074221-7a62-47e7-bcd1-2b33b1dec304))
(pad "1" thru_hole custom (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0.1016 -0.0381) (end 1.3716 -0.0381) (width 0.2))
(gr_line (start 1.3716 -0.0381) (end 2.54 -0.8763) (width 0.2))
(gr_line (start 0 -2.8321) (end 0 0) (width 0.2))
(gr_line (start -1.397 -4.6355) (end 0 -2.8321) (width 0.2))
(gr_line (start 1.1684 -4.6355) (end -1.397 -4.6355) (width 0.2))
) (tstamp 0b082f28-afa4-4577-beca-640eeac5c49e))
(pad "1" thru_hole circle (at -1.3716 -8.7376 180) (size 1.74 1.74) (drill 1.19) (layers *.Cu *.Mask) (tstamp 99708be6-f333-4f21-8be5-7127f6ccd79c))
(pad "1" thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask) (tstamp d3fbc779-09ec-46c9-8185-2a56ff83e138))
(pad "1" thru_hole circle (at 1.1684 -8.7376 180) (size 1.74 1.74) (drill 1.19) (layers *.Cu *.Mask) (tstamp f86c79bf-77ad-4f8c-a9b7-8ca94bfc8f71))
(pad "2" thru_hole circle (at 0 3.8989) (size 1.651 1.651) (drill 1.397) (layers *.Cu *.Mask) (tstamp 3624f8ff-2425-4b82-a6fc-b0ddd7bfdf00))
(pad "2" thru_hole custom (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end -0.0254 -6.3246) (width 0.2))
(gr_line (start -0.0254 -6.3246) (end -2.6416 -6.2992) (width 0.2))
(gr_line (start 1.143 1.2192) (end 0 0) (width 0.2))
(gr_line (start 1.1176 3.6322) (end 1.143 1.2192) (width 0.2))
(gr_line (start 3.8354 6.4008) (end 1.1176 3.6322) (width 0.2))
) (tstamp 43d16884-4b85-467f-a465-e8dd4ccd8dea))
(pad "2" thru_hole circle (at -6.4516 -8.7376 180) (size 1.74 1.74) (drill 1.19) (layers *.Cu *.Mask) (tstamp 8214e30f-4d6f-43d5-9e73-8e0c97659ab7))
(pad "2" thru_hole circle (at -3.9116 -8.7376 180) (size 1.74 1.74) (drill 1.19) (layers *.Cu *.Mask) (tstamp ee26d9ba-1842-4ede-9654-ad445edfaba0))
(pad "3" thru_hole custom (at 1.27 5.1816) (size 1.27 1.27) (drill 1.0668) (layers *.Cu *.Mask)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end 1.4224 -1.2446) (width 0.2))
(gr_line (start 1.4224 -1.2446) (end 1.4224 -8.1534) (width 0.2))
(gr_line (start 1.4224 -8.1534) (end 3.048 -8.1534) (width 0.2))
(gr_line (start 3.048 -8.1534) (end 3.048 -12.7) (width 0.2))
(gr_line (start 3.048 -12.7) (end 2.4384 -13.9192) (width 0.2))
) (tstamp 5d7bfcfa-2c97-4dd7-ae44-67b45a5f8d95))
(pad "3" thru_hole circle (at 3.7084 -8.7376 180) (size 1.74 1.74) (drill 1.19) (layers *.Cu *.Mask) (tstamp 6094d3d6-f35d-4866-9236-9f3101638c33))
(pad "4" thru_hole custom (at -1.27 5.1816) (size 1.27 1.27) (drill 1.0668) (layers *.Cu *.Mask)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end 0 0.9652) (width 0.2))
(gr_line (start 0 0.9652) (end 4.6736 0.9652) (width 0.2))
(gr_line (start 4.6736 0.9652) (end 4.6228 -7.6454) (width 0.2))
(gr_line (start 4.6228 -7.6454) (end 7.5184 -7.6454) (width 0.2))
(gr_line (start 7.5184 -7.6454) (end 7.5184 -13.9192) (width 0.2))
) (tstamp 4950c0a2-1f71-4d4a-ba69-985f703a991e))
(pad "4" thru_hole circle (at 6.2484 -8.7376 180) (size 1.74 1.74) (drill 1.19) (layers *.Cu *.Mask) (tstamp 9ae9aa26-ec22-48ae-b5f6-3ff2d7c07b90))
)

View File

@ -1,32 +1,55 @@
(module Key_MX_LED (layer F.Cu) (tedit 60186279)
(fp_text reference SW_** (at -5.7912 -8.6106) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(footprint "Key_MX_LED" (version 20221018) (generator pcbnew)
(layer "F.Cu")
(attr through_hole)
(fp_text reference "SW_**" (at -5.7912 -8.6106) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 635addc9-1212-4dd8-9025-d46a1478049c)
)
(fp_text value Key_MX (at -5.334 8.6614) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text value "Key_MX" (at -5.334 8.6614) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 62fcada6-d502-422d-ace5-51c40c4111e6)
)
(fp_line (start 0.127 6.858) (end 0.127 7.62) (layer F.SilkS) (width 0.12))
(fp_poly (pts (xy 0.127 7.239) (xy -0.381 7.493) (xy -0.381 6.985)) (layer F.SilkS) (width 0.1))
(fp_line (start -0.889 7.239) (end 0.635 7.239) (layer F.SilkS) (width 0.1016))
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start -3.81 -2.54) (end -2.54 0) (layer F.Cu) (width 0.3048))
(fp_line (start -2.54 0) (end -2.54 1.27) (layer F.Cu) (width 0.3048))
(fp_line (start -2.54 1.27) (end 0 3.81) (layer F.Cu) (width 0.3048))
(fp_line (start 1.651 -5.08) (end 1.27 -5.08) (layer F.Cu) (width 0.3048))
(fp_line (start 1.27 -5.08) (end 0.7366 -4.6736) (layer F.Cu) (width 0.3048))
(pad 3 thru_hole circle (at -1.27 5.1816) (size 1.27 1.27) (drill 1.0668) (layers *.Cu *.Mask))
(pad 4 thru_hole circle (at 1.27 5.1816) (size 1.27 1.27) (drill 1.0668) (layers *.Cu *.Mask))
(pad 2 thru_hole circle (at 0 3.8989) (size 1.651 1.651) (drill 1.397) (layers *.Cu *.Mask))
(pad 1 thru_hole circle (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask))
(pad 6 thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad 5 thru_hole circle (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(fp_line (start -0.889 7.239) (end 0.635 7.239)
(stroke (width 0.1016) (type solid)) (layer "F.SilkS") (tstamp 27d3534d-16f5-4ccf-9b16-2c5732c06b4d))
(fp_line (start 0.127 6.858) (end 0.127 7.62)
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp a988bd6f-305a-49e4-a300-383210fe668e))
(fp_poly
(pts
(xy 0.127 7.239)
(xy -0.381 7.493)
(xy -0.381 6.985)
)
(stroke (width 0.1) (type solid)) (fill solid) (layer "F.SilkS") (tstamp 8d7c4863-decc-41fb-bc0f-c15564084732))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 6a78f426-b0f1-4a10-8b9d-203792afdc98))
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 1fe7f185-5c1e-4d8f-8a18-abb08d1a1e13))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp cb063ba2-ba75-4d81-b6d1-01cb2c49d8e0))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp ad0afc42-584d-444a-a5d4-943137df2635))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp e2074221-7a62-47e7-bcd1-2b33b1dec304))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp 880b494c-ee53-4f2b-8304-722863728cc3))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp acbb9c7e-a35c-43a0-a03c-5ae34b790b3c))
(pad "1" thru_hole custom (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers "*.Cu" "*.Mask")
(thermal_bridge_angle 45)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end 2.54 -0.8763) (width 0.2))
) (tstamp 0b082f28-afa4-4577-beca-640eeac5c49e))
(pad "1" thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers "*.Cu" "*.Mask") (tstamp d3fbc779-09ec-46c9-8185-2a56ff83e138))
(pad "2" thru_hole custom (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers "*.Cu" "*.Mask")
(thermal_bridge_angle 45)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 1.1176) (end 1.016 4.8768) (width 0.2))
(gr_line (start 1.016 4.8768) (end 3.81 6.3373) (width 0.2))
) (tstamp 43d16884-4b85-467f-a465-e8dd4ccd8dea))
(pad "2" thru_hole circle (at 0 3.8989) (size 1.651 1.651) (drill 1.397) (layers "*.Cu" "*.Mask") (tstamp 3624f8ff-2425-4b82-a6fc-b0ddd7bfdf00))
(pad "3" thru_hole circle (at -1.27 5.1816) (size 1.27 1.27) (drill 1.0668) (layers "*.Cu" "*.Mask") (tstamp 4950c0a2-1f71-4d4a-ba69-985f703a991e))
(pad "4" thru_hole circle (at 1.27 5.1816) (size 1.27 1.27) (drill 1.0668) (layers "*.Cu" "*.Mask") (tstamp 5d7bfcfa-2c97-4dd7-ae44-67b45a5f8d95))
)

View File

@ -1,37 +1,51 @@
(module Key_MX_Spacebar_5.25 (layer F.Cu) (tedit 601862DF)
(fp_text reference SW_** (at -5.7912 -8.5852) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(footprint "Key_MX_Spacebar_5.25" (version 20221018) (generator pcbnew)
(layer "F.Cu")
(attr through_hole)
(fp_text reference "SW_**" (at -5.7912 -8.5852) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 3a4b3c9f-5a78-470d-8c5d-b5f4aa152a6d)
)
(fp_text value Key_MX (at -5.334 8.6868) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text value "Key_MX" (at -5.334 8.6868) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp c0abd6cb-d499-4a23-8a26-7e833b7aa18f)
)
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874) (layer F.CrtYd) (width 0.12))
(fp_line (start -3.81 -2.5146) (end -2.54 0.0254) (layer F.Cu) (width 0.3048))
(fp_line (start -2.54 0.0254) (end -2.54 1.2954) (layer F.Cu) (width 0.3048))
(fp_line (start -2.54 1.2954) (end 0 3.8354) (layer F.Cu) (width 0.3048))
(fp_line (start 1.651 -5.0546) (end 1.27 -5.0546) (layer F.Cu) (width 0.3048))
(fp_line (start 1.27 -5.0546) (end 0.7366 -4.6482) (layer F.Cu) (width 0.3048))
(pad 4 thru_hole circle (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask)
(solder_mask_margin 0.0762))
(pad 3 thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers *.Cu *.Mask))
(pad 1 thru_hole circle (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask))
(pad 2 thru_hole circle (at 0 3.8989) (size 2.2352 2.2352) (drill 1.397) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -66.675 -6.8834) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 66.675 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 66.675 -6.8834) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -66.675 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at -66.675 -0.1016) (size 5 2) (drill oval 5 2) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at 66.675 -0.1016) (size 5 2) (drill oval 5 2) (layers *.Cu *.Mask))
(model ${PROJECT_PATH}/cherry_mx.wrl
(at (xyz 0 0 0))
(fp_line (start -7.6962 -7.874) (end 7.6962 -7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 9edc424b-8ac8-4542-9d30-21889df7e278))
(fp_line (start -7.6962 7.874) (end -7.6962 -7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp a034633c-6fdb-4372-9631-e68dfb5fe4f1))
(fp_line (start 7.6962 -7.874) (end 7.6962 7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 4f4e4819-a0de-4e7f-b014-428b73df796f))
(fp_line (start 7.6962 7.874) (end -7.6962 7.874)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 06dda447-7a5e-4c5a-88c9-3c9bb09d6e14))
(pad "" np_thru_hole circle (at -66.675 -6.8834) (size 3.048 3.048) (drill 3.048) (layers "*.Cu" "*.Mask") (tstamp d9d9da93-63be-4c28-8943-5f7bb4b31b89))
(pad "" np_thru_hole oval (at -66.675 -0.1016) (size 5 2) (drill oval 5 2) (layers "*.Cu" "*.Mask") (tstamp 4144a7bb-554b-49fa-b00f-adfc56c5d0f6))
(pad "" np_thru_hole circle (at -66.675 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers "*.Cu" "*.Mask") (tstamp 3044c4fa-3589-48a0-a921-7945035047cb))
(pad "" np_thru_hole circle (at -5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp d8278fee-7397-4054-875a-6bbcc89a9eb4))
(pad "" np_thru_hole circle (at 0 0.1016) (size 3.9878 3.9878) (drill 3.9878) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp 06d817f3-2973-4ab5-9b4b-16299101116f))
(pad "" np_thru_hole circle (at 5.08 0.1016) (size 1.7018 1.7018) (drill 1.7018) (layers "*.Cu" "*.Mask")
(solder_mask_margin 0.0762) (tstamp d7115bbe-51ca-4b7d-ba87-004da4841551))
(pad "" np_thru_hole circle (at 66.675 -6.8834) (size 3.048 3.048) (drill 3.048) (layers "*.Cu" "*.Mask") (tstamp abba95bf-bbd5-4fa8-9287-1625ee918451))
(pad "" np_thru_hole oval (at 66.675 -0.1016) (size 5 2) (drill oval 5 2) (layers "*.Cu" "*.Mask") (tstamp fe0a93c6-4511-4863-b3c0-0da3d1f25efb))
(pad "" np_thru_hole circle (at 66.675 8.3566) (size 3.9878 3.9878) (drill 3.9878) (layers "*.Cu" "*.Mask") (tstamp 1f64c2fa-89ce-4835-bfa2-b9790d679f3f))
(pad "1" thru_hole custom (at 0 -4.1021) (size 2.2352 2.2352) (drill 1.397) (layers "*.Cu" "*.Mask")
(thermal_bridge_angle 45)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end 2.54 -0.8763) (width 0.2))
) (tstamp ddbd1858-51f8-422b-8170-2a124a0465c5))
(pad "1" thru_hole circle (at 2.54 -4.9784) (size 2.2352 2.2352) (drill 1.5748) (layers "*.Cu" "*.Mask") (tstamp ef9e95f6-dc87-4c29-b66f-23ffb6cdd527))
(pad "2" thru_hole custom (at -3.81 -2.4384) (size 2.2352 2.2352) (drill 1.5748) (layers "*.Cu" "*.Mask")
(thermal_bridge_angle 45)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end 1.27 4.9784) (width 0.2))
(gr_line (start 1.27 4.9784) (end 3.81 6.3373) (width 0.2))
) (tstamp 3956ad20-646c-4f1c-8364-b46ce6e8171a))
(pad "2" thru_hole circle (at 0 3.8989) (size 2.2352 2.2352) (drill 1.397) (layers "*.Cu" "*.Mask") (tstamp 7882c9ea-c66b-4e82-b1f7-7d2c71b447ea))
(model "${PROJECT_PATH}/cherry_mx.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)

View File

@ -1,65 +1,111 @@
(module "OSI mounting holes" (layer F.Cu) (tedit 5EF10B49)
(fp_text reference REF** (at 0 0.5) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(footprint "OSI mounting holes" (version 20221018) (generator pcbnew)
(layer "F.Cu")
(attr through_hole)
(fp_text reference "REF**" (at 0 0.5) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 9b3b86b5-9225-4dec-9179-82a1196a3238)
)
(fp_text value "OSI mounting holes" (at 0 -0.5) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text value "OSI mounting holes" (at 0 -0.5) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 5433f4ab-233b-418b-a1b9-475411197a1a)
)
(fp_circle (center 109.22 -97.9424) (end 112.72 -97.9424) (layer Cmts.User) (width 0.15))
(fp_circle (center -109.22 -97.9424) (end -105.72 -97.9424) (layer Cmts.User) (width 0.15))
(fp_circle (center 0 -97.9424) (end 3.5 -97.9424) (layer Cmts.User) (width 0.15))
(fp_circle (center -85.725 0.635) (end -81.975 0.635) (layer F.CrtYd) (width 0.05))
(fp_circle (center -85.725 0.635) (end -82.225 0.635) (layer Cmts.User) (width 0.15))
(fp_circle (center 85.725 0.635) (end 89.475 0.635) (layer F.CrtYd) (width 0.05))
(fp_circle (center 85.725 0.635) (end 89.225 0.635) (layer Cmts.User) (width 0.15))
(fp_circle (center 0 -92.8624) (end 3.5 -92.8624) (layer Cmts.User) (width 0.15))
(fp_circle (center -109.22 -92.8624) (end -105.72 -92.8624) (layer Cmts.User) (width 0.15))
(fp_circle (center 109.22 -92.8624) (end 112.72 -92.8624) (layer Cmts.User) (width 0.15))
(fp_text user %R (at -85.66658 5.27304) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "OSI" (at -85.92058 -4.32816) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 27c7889f-e62f-46c2-93f0-3c54721d011a)
)
(fp_text user OSI (at -85.92058 -4.32816) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "OSI" (at 85.5726 -4.191) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 2dc9c352-cdc9-4238-a8df-5b3c886cff40)
)
(fp_text user %R (at 86.57082 5.65404) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "OSI" (at -104.7496 -95.3516) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 548d8c15-2483-464f-8ebd-dde37f374e29)
)
(fp_text user OSI (at 85.5726 -4.191) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "OSI" (at 113.792 -95.2754) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 93f093e3-0eef-4ada-a707-8397cefb12c2)
)
(fp_text user OSI (at 4.572 -95.3516) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "OSI" (at 4.572 -95.3516) (layer "F.SilkS")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp bc8758b6-19a6-4c1e-9aa6-92ae5986edd7)
)
(fp_text user %R (at 0.84582 -87.86876) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "${REFERENCE}" (at 110.75162 -87.97036) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 01ab8ce6-36bc-465a-a40f-ab8a610387f7)
)
(fp_text user OSI (at -104.7496 -95.3516) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "${REFERENCE}" (at -109.31398 -87.86876) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 56570b12-1e7e-4fd3-a4c2-f8df493ac0a3)
)
(fp_text user %R (at -109.31398 -87.86876) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "${REFERENCE}" (at 86.57082 5.65404) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp 84b2f115-bb58-4c83-b56b-57f0ecf7c9a1)
)
(fp_text user OSI (at 113.792 -95.2754) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "${REFERENCE}" (at 0.84582 -87.86876) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp c16897fc-9ac2-4fab-ae3b-abcbd3e06f28)
)
(fp_text user %R (at 110.75162 -87.97036) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
(fp_text user "${REFERENCE}" (at -85.66658 5.27304) (layer "F.Fab")
(effects (font (size 1 1) (thickness 0.15)))
(tstamp d4ef1667-3ff3-436d-b266-7faf109788fd)
)
(fp_line (start -3.175 -101.6) (end -3.175 -88.9) (layer F.CrtYd) (width 0.12))
(fp_line (start -3.175 -88.9) (end 3.175 -88.9) (layer F.CrtYd) (width 0.12))
(fp_line (start 3.175 -88.9) (end 3.175 -101.6) (layer F.CrtYd) (width 0.12))
(fp_line (start 3.175 -101.6) (end -3.175 -101.6) (layer F.CrtYd) (width 0.12))
(fp_line (start -106.045 -88.9) (end -106.045 -101.6) (layer F.CrtYd) (width 0.12))
(fp_line (start -112.395 -88.9) (end -106.045 -88.9) (layer F.CrtYd) (width 0.12))
(fp_line (start -106.045 -101.6) (end -112.395 -101.6) (layer F.CrtYd) (width 0.12))
(fp_line (start -112.395 -101.6) (end -112.395 -88.9) (layer F.CrtYd) (width 0.12))
(fp_line (start 112.395 -88.9) (end 112.395 -101.6) (layer F.CrtYd) (width 0.12))
(fp_line (start 106.045 -88.9) (end 112.395 -88.9) (layer F.CrtYd) (width 0.12))
(fp_line (start 112.395 -101.6) (end 106.045 -101.6) (layer F.CrtYd) (width 0.12))
(fp_line (start 106.045 -101.6) (end 106.045 -88.9) (layer F.CrtYd) (width 0.12))
(pad "" np_thru_hole circle (at -85.725 0.635) (size 3.500001 3.500001) (drill 3.500001) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 85.725 0.635) (size 3.500001 3.500001) (drill 3.500001) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at 0 -95.25) (size 3.5052 8.5852) (drill oval 3.5052 8.5852) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at -109.22 -95.25) (size 3.5052 8.5852) (drill oval 3.5052 8.5852) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at 109.22 -95.25) (size 3.5052 8.5852) (drill oval 3.5052 8.5852) (layers *.Cu *.Mask))
(fp_circle (center -109.22 -97.9424) (end -107.46994 -97.9424)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp 01025a9a-0ad6-41c4-9e1a-ed6c3aa1b1de))
(fp_circle (center -109.22 -92.8624) (end -107.46994 -92.8624)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp 85a60eb7-74ef-487d-b8df-eb1018fbb1b2))
(fp_circle (center -85.725 0.635) (end -83.97494 0.635)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp 83a0bc2a-7306-41a8-a70f-85c7ca554680))
(fp_circle (center 0 -97.9424) (end 1.75006 -97.9424)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp 12277598-7f04-4d26-9aeb-79ca8cdbe798))
(fp_circle (center 0 -92.8624) (end 1.75006 -92.8624)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp d52a917b-51b4-44b0-8914-2eaa76ec025d))
(fp_circle (center 85.725 0.635) (end 87.47506 0.635)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp bf62e63f-7499-45e8-87b3-0dfa7a0bf6da))
(fp_circle (center 109.22 -97.9424) (end 110.97006 -97.9424)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp 2a22db23-c241-4cb7-8ef7-60a626886fb8))
(fp_circle (center 109.22 -92.8624) (end 110.97006 -92.8624)
(stroke (width 0.15) (type solid)) (fill none) (layer "Cmts.User") (tstamp d653e6c4-5e16-4519-adbc-b961dcc328f2))
(fp_circle (center -109.22 -95.4024) (end -107.46994 -95.4024)
(stroke (width 0.15) (type solid)) (fill none) (layer "Eco2.User") (tstamp 36a746d3-6213-45ab-8211-d297e480094b))
(fp_circle (center -85.725 0.635) (end -83.97494 0.635)
(stroke (width 0.15) (type solid)) (fill none) (layer "Eco2.User") (tstamp e601c69c-696b-47b5-b5b4-f98b13cc52e6))
(fp_circle (center 0 -95.4024) (end 1.75006 -95.4024)
(stroke (width 0.15) (type solid)) (fill none) (layer "Eco2.User") (tstamp 806690bd-c645-4a45-9639-ce3c5aa7400c))
(fp_circle (center 85.725 0.635) (end 87.47506 0.635)
(stroke (width 0.15) (type solid)) (fill none) (layer "Eco2.User") (tstamp 9f8ee5e3-b2fd-452d-89e5-f83963d3742f))
(fp_circle (center 109.22 -95.4024) (end 110.97006 -95.4024)
(stroke (width 0.15) (type solid)) (fill none) (layer "Eco2.User") (tstamp 240306cf-7921-4a92-b6e8-a028102ea398))
(fp_line (start -112.395 -101.6) (end -112.395 -88.9)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 1dba16be-dd36-4af3-99e9-3bcbda2931a5))
(fp_line (start -112.395 -88.9) (end -106.045 -88.9)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 77045cd6-f8cd-47bc-94fb-13e8085fca7a))
(fp_line (start -106.045 -101.6) (end -112.395 -101.6)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 50daee6d-66f5-4447-a568-a7d5202a98f4))
(fp_line (start -106.045 -88.9) (end -106.045 -101.6)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp c511bf0f-45d0-4a9e-b11e-d3bc054bedb2))
(fp_line (start -3.175 -101.6) (end -3.175 -88.9)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 4d3f73b6-eaab-42ad-bdb2-4b4ca09255ee))
(fp_line (start -3.175 -88.9) (end 3.175 -88.9)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp c2c48a55-bc5f-4f97-a612-07a7bed5b142))
(fp_line (start 3.175 -101.6) (end -3.175 -101.6)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 0f806816-bcb0-4c89-8d73-dabdd8b24da6))
(fp_line (start 3.175 -88.9) (end 3.175 -101.6)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp a9df06a1-e144-4984-a03f-871b422a8183))
(fp_line (start 106.045 -101.6) (end 106.045 -88.9)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp 8e00f6cb-8bd9-499e-81f5-8f26c4d40bd9))
(fp_line (start 106.045 -88.9) (end 112.395 -88.9)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp f9ec91da-fc55-434b-be7a-19f94dc471e3))
(fp_line (start 112.395 -101.6) (end 106.045 -101.6)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp fceae6b7-5dab-46ec-b4a2-7153a6beddce))
(fp_line (start 112.395 -88.9) (end 112.395 -101.6)
(stroke (width 0.12) (type solid)) (layer "F.CrtYd") (tstamp a842ec8e-31dd-4466-8a6a-5db692ab613b))
(fp_circle (center -85.725 0.635) (end -81.975 0.635)
(stroke (width 0.05) (type solid)) (fill none) (layer "F.CrtYd") (tstamp 0de3327e-b5c7-4d1a-8eaf-79b9a023cedc))
(fp_circle (center 85.725 0.635) (end 89.475 0.635)
(stroke (width 0.05) (type solid)) (fill none) (layer "F.CrtYd") (tstamp 2639d849-c4cb-4777-84f0-6626895651a1))
(pad "" np_thru_hole oval (at -109.22 -95.25) (size 3.5052 8.5852) (drill oval 3.5052 8.5852) (layers "*.Cu" "*.Mask") (tstamp 3ad54bfc-11e1-4e2c-bcea-d0e8340d063f))
(pad "" np_thru_hole circle (at -85.725 0.635) (size 3.500001 3.500001) (drill 3.500001) (layers "*.Cu" "*.Mask") (tstamp ebdbc4a6-54c4-4034-8831-21fb7089a0c9))
(pad "" np_thru_hole oval (at 0 -95.25) (size 3.5052 8.5852) (drill oval 3.5052 8.5852) (layers "*.Cu" "*.Mask") (tstamp 94688157-bfde-4214-be32-76b106668b97))
(pad "" np_thru_hole circle (at 85.725 0.635) (size 3.500001 3.500001) (drill 3.500001) (layers "*.Cu" "*.Mask") (tstamp 5f64083b-e896-4b3b-a24c-2cdc7fd981fe))
(pad "" np_thru_hole oval (at 109.22 -95.25) (size 3.5052 8.5852) (drill oval 3.5052 8.5852) (layers "*.Cu" "*.Mask") (tstamp d4d48680-de4c-4e0d-9236-bf16bb96855f))
)

Some files were not shown because too many files have changed in this diff Show More