From 03069fc8b5708f0af4367068eaf822a5f091063a Mon Sep 17 00:00:00 2001 From: Dave Date: Sat, 4 Dec 2021 23:53:15 -0600 Subject: [PATCH] Tie message ID strings to function keys for classic and classic_caps keyboards. --- .../asdf/src/Keymaps/asdf_keymap_apple2_caps.c | 3 --- firmware/asdf/src/Keymaps/asdf_keymap_classic.c | 13 ++++++++++--- firmware/asdf/src/Keymaps/asdf_keymap_classic.h | 8 ++++++-- .../asdf/src/Keymaps/asdf_keymap_classic_add_map.c | 1 + .../asdf/src/Keymaps/asdf_keymap_classic_caps.c | 14 ++++++++++++-- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_apple2_caps.c b/firmware/asdf/src/Keymaps/asdf_keymap_apple2_caps.c index 7eabcb6..cbe7778 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_apple2_caps.c +++ b/firmware/asdf/src/Keymaps/asdf_keymap_apple2_caps.c @@ -61,9 +61,6 @@ void setup_apple2_caps_keymap(void) asdf_hook_assign(APPLESOFT_KEYBOARD_TEST, applesoft_keyboard_test); asdf_hook_assign(APPLE2_CAPS_ID_MESSAGE, apple2_caps_id_message); - asdf_virtual_init(); - - // 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); diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_classic.c b/firmware/asdf/src/Keymaps/asdf_keymap_classic.c index 0b66b3f..1f2a5be 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_classic.c +++ b/firmware/asdf/src/Keymaps/asdf_keymap_classic.c @@ -23,12 +23,18 @@ // this program. If not, see . // +#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: @@ -47,14 +53,15 @@ void setup_classic_keymap(void) { - asdf_print("[Keymap: classic]\n"); + 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_virtual_init(); + 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); @@ -62,6 +69,7 @@ void setup_classic_keymap(void) // 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 @@ -69,7 +77,6 @@ void setup_classic_keymap(void) // 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); - } diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_classic.h b/firmware/asdf/src/Keymaps/asdf_keymap_classic.h index c4edb27..716573e 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_classic.h +++ b/firmware/asdf/src/Keymaps/asdf_keymap_classic.h @@ -31,8 +31,7 @@ #if !defined(ASDF_KEYMAP_DEFS_CLASSIC_H) #define ASDF_KEYMAP_DEFS_CLASSIC_H -// include DIP switch definitions -#include "asdf_keymap_defs_dipswitch.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. @@ -59,6 +58,11 @@ #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) */ //-------|---------|---------+---------+---------+---------+---------+---------+ diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_classic_add_map.c b/firmware/asdf/src/Keymaps/asdf_keymap_classic_add_map.c index 8a33630..b8e56ca 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_classic_add_map.c +++ b/firmware/asdf/src/Keymaps/asdf_keymap_classic_add_map.c @@ -29,6 +29,7 @@ #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 // diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_classic_caps.c b/firmware/asdf/src/Keymaps/asdf_keymap_classic_caps.c index 47bc4e8..804c3c3 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_classic_caps.c +++ b/firmware/asdf/src/Keymaps/asdf_keymap_classic_caps.c @@ -23,12 +23,21 @@ // this program. If not, see . // +#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: @@ -47,7 +56,7 @@ void setup_classic_caps_keymap(void) { - asdf_print("[Keymap: classic CAPS]"); + 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); @@ -55,7 +64,8 @@ void setup_classic_caps_keymap(void) classic_add_map(CLASSIC_SHIFT_MAP, MOD_SHIFT_MAP); classic_add_map(CLASSIC_CTRL_MAP, MOD_CTRL_MAP); - asdf_virtual_init(); + 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);