diff --git a/firmware/asdf/src/Arch/asdf_arch_atmega2560.c b/firmware/asdf/src/Arch/asdf_arch_atmega2560.c index 117e17a..5d05949 100644 --- a/firmware/asdf/src/Arch/asdf_arch_atmega2560.c +++ b/firmware/asdf/src/Arch/asdf_arch_atmega2560.c @@ -49,10 +49,6 @@ static volatile uint8_t tick = 0; // data polarity may be changed with a DIP switch, so we use a static instead of a constant static uint8_t data_polarity = ASDF_DEFAULT_DATA_POLARITY; -// strobe polarity may be changed with a DIP switch, so we use a static instead of a constant -static uint8_t strobe_polarity = ASDF_DEFAULT_STROBE_POLARITY; - - // PROCEDURE: ISR for Timer 0 overflow // INPUTS: none // OUTPUTS:none @@ -554,7 +550,26 @@ void asdf_arch_out3_open_lo_set(uint8_t value) } } -// PROCEDURE: asdf_arch_init_strobe +// PROCEDURE: asdf_arch_pos_strobe +// INPUTS: none +// OUTPUTS: none +// +// DESCRIPTION: Initialize strobe output to positive polarity. Initial state is +// LOW +// +// SIDE EFFECTS: See DESCRIPTION +// +// SCOPE: public +// +// COMPLEXITY: 1 +// +void asdf_arch_set_pos_strobe(void) +{ + clear_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); + set_bit(&ASDF_STROBE_DDR, ASDF_STROBE_BIT); +} + +// PROCEDURE: asdf_arch_neg_strobe // INPUTS: none // OUTPUTS: none // @@ -566,14 +581,9 @@ void asdf_arch_out3_open_lo_set(uint8_t value) // // COMPLEXITY: 1 // -static void asdf_arch_init_strobe(void) +void asdf_arch_set_neg_strobe(void) { - if (strobe_polarity == ASDF_POSITIVE_POLARITY) { - clear_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); - } - else { - set_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); - } + set_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); set_bit(&ASDF_STROBE_DDR, ASDF_STROBE_BIT); } @@ -636,7 +646,8 @@ static void asdf_arch_init_row_outputs(void) // INPUTS: none // OUTPUTS: none // -// DESCRIPTION: Delays a fixed amount of time for keyboard output pulses specified by ASDF_PULSE_DELAY_SHORT_US +// DESCRIPTION: Delays a fixed amount of time for keyboard output pulses specified by +// ASDF_PULSE_DELAY_SHORT_US // // SIDE EFFECTS: see above. // @@ -655,7 +666,8 @@ void asdf_arch_pulse_delay_short(void) // INPUTS: none // OUTPUTS: none // -// DESCRIPTION: Delays a fixed amount of time for keyboard output pulses specified by ASDF_PULSE_DELAY_LONG_MS +// DESCRIPTION: Delays a fixed amount of time for keyboard output pulses specified by +// ASDF_PULSE_DELAY_LONG_MS // // SIDE EFFECTS: see above. // @@ -697,11 +709,15 @@ void asdf_arch_init(void) // set up ASCII output port asdf_arch_init_ascii_output(); - // initialize keyboard data and strobe to positive polairy + // initialize keyboard data polarity and strobe polarity data_polarity = ASDF_DEFAULT_DATA_POLARITY; - strobe_polarity = ASDF_DEFAULT_STROBE_POLARITY; - asdf_arch_init_strobe(); + if (ASDF_DEFAULT_STROBE_POLARITY == ASDF_POSITIVE_POLARITY) { + asdf_arch_set_pos_strobe(); + } else { + asdf_arch_set_neg_strobe(); + } + asdf_arch_init_leds(); // set up row and column ports @@ -774,7 +790,8 @@ asdf_cols_t asdf_arch_osi_read_row(uint8_t row) if (row > 7) { cols = asdf_arch_read_row(row); - } else { + } + else { // enable the OSI keyboard clear_bit(&ASDF_OSI_KBE_PORT, ASDF_OSI_KBE_BIT); @@ -791,7 +808,7 @@ asdf_cols_t asdf_arch_osi_read_row(uint8_t row) ASDF_LOROW_PORT = row & 0xff; - cols = (asdf_cols_t) ASDF_COLUMNS_PORT; + cols = (asdf_cols_t) ASDF_COLUMNS_PORT; } return cols; } diff --git a/firmware/asdf/src/Arch/asdf_arch_atmega2560.h b/firmware/asdf/src/Arch/asdf_arch_atmega2560.h index 6145470..e5d7cde 100644 --- a/firmware/asdf/src/Arch/asdf_arch_atmega2560.h +++ b/firmware/asdf/src/Arch/asdf_arch_atmega2560.h @@ -357,6 +357,21 @@ // DIP switch is on row 8 #define ASDF_ARCH_DIPSWITCH_ROW 8 + +// PROCEDURE: asdf_arch_pos_strobe +// INPUTS: none +// OUTPUTS: none +// DESCRIPTION: Initialize strobe output to positive polarity. Initial state is +// LOW +void asdf_arch_set_pos_strobe(void); + +// PROCEDURE: asdf_arch_neg_strobe +// INPUTS: none +// OUTPUTS: none +// DESCRIPTION: Initialize strobe output +void asdf_arch_set_neg_strobe(void); + + // PROCEDURE: asdf_arch_null_output // INPUTS: (uint8_t) value - ignored // OUTPUTS: none diff --git a/firmware/asdf/src/Arch/asdf_arch_atmega328p.c b/firmware/asdf/src/Arch/asdf_arch_atmega328p.c index bcc752f..b542621 100644 --- a/firmware/asdf/src/Arch/asdf_arch_atmega328p.c +++ b/firmware/asdf/src/Arch/asdf_arch_atmega328p.c @@ -45,7 +45,6 @@ static volatile uint8_t tick = 0; static uint8_t data_polarity = ASDF_DEFAULT_DATA_POLARITY; -static uint8_t strobe_polarity = ASDF_DEFAULT_STROBE_POLARITY; // PROCEDURE: ISR for Timer 0 overflow @@ -536,7 +535,26 @@ void asdf_arch_out3_open_lo_set(uint8_t value) } } -// PROCEDURE: asdf_arch_init_strobe +// PROCEDURE: asdf_arch_pos_strobe +// INPUTS: none +// OUTPUTS: none +// +// DESCRIPTION: Initialize strobe output to positive polarity. Initial state is +// LOW +// +// SIDE EFFECTS: See DESCRIPTION +// +// SCOPE: public +// +// COMPLEXITY: 1 +// +void asdf_arch_set_pos_strobe(void) +{ + clear_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); + set_bit(&ASDF_STROBE_DDR, ASDF_STROBE_BIT); +} + +// PROCEDURE: asdf_arch_neg_strobe // INPUTS: none // OUTPUTS: none // @@ -548,14 +566,9 @@ void asdf_arch_out3_open_lo_set(uint8_t value) // // COMPLEXITY: 1 // -static void asdf_arch_init_strobe(void) +void asdf_arch_set_neg_strobe(void) { - if (strobe_polarity == ASDF_POSITIVE_POLARITY) { - clear_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); - } - else { - set_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); - } + set_bit(&ASDF_STROBE_PORT, ASDF_STROBE_BIT); set_bit(&ASDF_STROBE_DDR, ASDF_STROBE_BIT); } @@ -691,11 +704,17 @@ void asdf_arch_init(void) // set up ASCII output port asdf_arch_init_ascii_output(); - // initialize keyboard data and strobe to positive polairy + // initialize keyboard data polarity and strobe polarity data_polarity = ASDF_DEFAULT_DATA_POLARITY; - strobe_polarity = ASDF_DEFAULT_STROBE_POLARITY; - asdf_arch_init_strobe(); + if (ASDF_DEFAULT_STROBE_POLARITY == ASDF_POSITIVE_POLARITY) { + asdf_arch_set_pos_strobe(); + } else { + asdf_arch_set_neg_strobe(); + } + + asdf_arch_init_leds(); + asdf_arch_init_leds(); // set up row output port diff --git a/firmware/asdf/src/Arch/asdf_arch_atmega328p.h b/firmware/asdf/src/Arch/asdf_arch_atmega328p.h index 46690a0..b473595 100644 --- a/firmware/asdf/src/Arch/asdf_arch_atmega328p.h +++ b/firmware/asdf/src/Arch/asdf_arch_atmega328p.h @@ -262,6 +262,19 @@ // DIP switch is on row 8 #define ASDF_ARCH_DIPSWITCH_ROW 8 +// PROCEDURE: asdf_arch_pos_strobe +// INPUTS: none +// OUTPUTS: none +// DESCRIPTION: Initialize strobe output to positive polarity. Initial state is +// LOW + void asdf_arch_set_pos_strobe(void); + +// PROCEDURE: asdf_arch_neg_strobe +// INPUTS: none +// OUTPUTS: none +// DESCRIPTION: Initialize strobe output +void asdf_arch_set_neg_strobe(void); + // PROCEDURE: asdf_arch_null_output // INPUTS: (uint8_t) value - ignored // OUTPUTS: none diff --git a/firmware/asdf/src/Keymaps/asdf_all_keymap_defs_production.h b/firmware/asdf/src/Keymaps/asdf_all_keymap_defs_production.h index cd4d8db..542dd4f 100644 --- a/firmware/asdf/src/Keymaps/asdf_all_keymap_defs_production.h +++ b/firmware/asdf/src/Keymaps/asdf_all_keymap_defs_production.h @@ -40,7 +40,7 @@ #include "Keymaps/asdf_keymap_defs_apple2.h" #include "Keymaps/asdf_keymap_defs_sol.h" -#define ASDF_NUM_KEYMAPS \ +#define ASDF_NUM_KEYMAPS \ (ASDF_ASCII_ALL_MAPS_COUNT + ASDF_APPLE2_ALL_MAPS_COUNT + ASDF_SOL_ALL_MAPS_COUNT) #define ASDF_KEYMAP_DEFS \ diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_defs_apple2.h b/firmware/asdf/src/Keymaps/asdf_keymap_defs_apple2.h index ed57128..38123ba 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_defs_apple2.h +++ b/firmware/asdf/src/Keymaps/asdf_keymap_defs_apple2.h @@ -39,6 +39,9 @@ #if !defined(ASDF_KEYMAP_DEFS_APPLE2_H) #define ASDF_KEYMAP_DEFS_APPLE2_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. @@ -151,8 +154,7 @@ // definitions in positions 0-3 ensures consistent map selection among all // keymaps. -#define ASDF_APPLE2_DIP_SWITCHES \ - [ASDF_ARCH_DIPSWITCH_ROW] = { ACTION_MAPSEL_0, ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3 } +#define ASDF_APPLE2_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES #define APPLE_LEFT_ARROW ASCII_CTRL_H #define APPLE_RIGHT_ARROW ASCII_CTRL_U diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_defs_ascii.h b/firmware/asdf/src/Keymaps/asdf_keymap_defs_ascii.h index 258e9a7..6009e43 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_defs_ascii.h +++ b/firmware/asdf/src/Keymaps/asdf_keymap_defs_ascii.h @@ -3,7 +3,7 @@ // Unfified Keyboard Project // ASDF keyboard firmware // -// asdf_keymaps_ascii.h +// asdf_keymaps_ascii.h // // Ascii keymaps // @@ -31,6 +31,9 @@ #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. @@ -57,57 +60,62 @@ #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 }, \ +#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_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 +#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 +#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 // @@ -140,9 +148,7 @@ // definitions in positions 0-3 ensures consistent map selection among all // keymaps. - -#define ASDF_ASCII_DIP_SWITCHES \ - [ASDF_ARCH_DIPSWITCH_ROW] = { ACTION_MAPSEL_0, ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3 } +#define ASDF_ASCII_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES // clang-format off #define ASDF_ASCII_PLAIN_MAP \ @@ -211,9 +217,9 @@ // 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_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; @@ -228,20 +234,16 @@ // [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_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_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 @@ -258,12 +260,14 @@ #define ASDF_NUM_COLS ASDF_ASCII_NUM_COLS #endif -#if !defined(ASDF_KEYMAP_INITIALIZER_LENGTH) || (ASDF_KEYMAP_INITIALIZER_LENGTH < ASDF_ASCII_KEYMAP_INITIALIZER_LENGTH) +#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) +#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 @@ -272,4 +276,3 @@ //-------|---------|---------+---------+---------+---------+---------+---------+ // Above line is 80 columns, and should display completely in the editor. - diff --git a/firmware/asdf/src/Keymaps/asdf_keymap_defs_sol.h b/firmware/asdf/src/Keymaps/asdf_keymap_defs_sol.h index 0bfd1fa..bb742f2 100644 --- a/firmware/asdf/src/Keymaps/asdf_keymap_defs_sol.h +++ b/firmware/asdf/src/Keymaps/asdf_keymap_defs_sol.h @@ -31,6 +31,9 @@ #if !defined(ASDF_KEYMAP_DEFS_SOL20_H) #define ASDF_KEYMAP_DEFS_SOL20_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. @@ -117,7 +120,7 @@ { \ { .virtual_device = VCAPS_LED, \ .physical_device = SOL_KBD_LED_UPPERCASE, \ - .initial_value = SOL_KBD_LED_OFF }, \ + .initial_value = SOL_KBD_LED_OFF }, \ { .virtual_device = VSHIFT_LED, \ .physical_device = SOL_KBD_LED_SHIFTLOCK, \ .initial_value = SOL_KBD_LED_OFF }, \ @@ -139,19 +142,21 @@ .initial_value = SOL_KBD_TTL_HIGH }, \ } -// function hooks for the SOL keyboard. At Setup, activate CAPSLOCK to emulate -// original keyboard. -#define ASDF_SOL_KEYMAP_HOOK_INITIALIZER_LENGTH 1 +// function hooks for the SOL keyboard: +// - At Setup, activate CAPSLOCK to emulate original keyboard. +// - At Setup, configure negative strobe +#define ASDF_SOL_KEYMAP_HOOK_INITIALIZER_LENGTH 2 #define ASDF_SOL_KEYMAP_HOOK_INITIALIZER \ { \ - { \ - .hook_id = ASDF_HOOK_KEYMAP_SETUP, \ + { .hook_id = ASDF_HOOK_KEYMAP_SETUP, \ .hook_func = asdf_modifier_capslock_activate, \ }, \ + { .hook_id = ASDF_HOOK_KEYMAP_SETUP, \ + .hook_func = asdf_arch_set_neg_strobe, \ + }, \ } -#define ASDF_SOL_DIP_SWITCHES \ - [ASDF_ARCH_DIPSWITCH_ROW] = { ACTION_MAPSEL_0, ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3 } +#define ASDF_SOL_DIP_SWITCHES ASDF_KEYMAP_DIP_SWITCHES // clang-format off #define ASDF_SOL_PLAIN_MAP \ diff --git a/firmware/asdf/src/asdf.c b/firmware/asdf/src/asdf.c index 1aa7637..c1b1ef5 100644 --- a/firmware/asdf/src/asdf.c +++ b/firmware/asdf/src/asdf.c @@ -191,6 +191,14 @@ static void asdf_activate_action(action_t keycode) asdf_keymaps_map_select_3_set(); break; } + case ACTION_STROBE_POLARITY_SELECT: { + asdf_arch_set_pos_strobe(); + break; + } + case ACTION_AUTOREPEAT_SELECT: { + asdf_repeat_auto_on(); + break; + } case ACTION_VLED1: { asdf_virtual_activate(VLED1); break; @@ -292,6 +300,14 @@ static void asdf_deactivate_action(action_t keycode) asdf_keymaps_map_select_3_clear(); break; } + case ACTION_STROBE_POLARITY_SELECT: { + asdf_arch_set_neg_strobe(); + break; + } + case ACTION_AUTOREPEAT_SELECT: { + asdf_repeat_auto_off(); + break; + } case ACTION_NOTHING: default: break; } @@ -498,8 +514,7 @@ void asdf_keyscan(void) { asdf_hook_get(ASDF_HOOK_EACH_SCAN)(); for (uint8_t row = 0; row < ASDF_NUM_ROWS; row++) { - 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_SCANNER); asdf_cols_t row_key_state = (*row_reader)(row); asdf_cols_t changed = row_key_state ^ last_stable_key_state[row]; diff --git a/firmware/asdf/src/asdf.h b/firmware/asdf/src/asdf.h index d0b27e0..a5413e6 100644 --- a/firmware/asdf/src/asdf.h +++ b/firmware/asdf/src/asdf.h @@ -57,6 +57,8 @@ typedef enum { ACTION_MAPSEL_1, ACTION_MAPSEL_2, ACTION_MAPSEL_3, + ACTION_AUTOREPEAT_SELECT, + ACTION_STROBE_POLARITY_SELECT, ACTION_VLED1, ACTION_VLED2, ACTION_VLED3,