diff options
Diffstat (limited to 'keyboards/wilba_tech')
-rw-r--r-- | keyboards/wilba_tech/wt60_a/config.h | 12 | ||||
-rw-r--r-- | keyboards/wilba_tech/wt65_a/config.h | 12 | ||||
-rw-r--r-- | keyboards/wilba_tech/wt80_a/config.h | 12 | ||||
-rw-r--r-- | keyboards/wilba_tech/wt_main.c | 92 |
4 files changed, 106 insertions, 22 deletions
diff --git a/keyboards/wilba_tech/wt60_a/config.h b/keyboards/wilba_tech/wt60_a/config.h index 26f9ed2ba4..8c18582a88 100644 --- a/keyboards/wilba_tech/wt60_a/config.h +++ b/keyboards/wilba_tech/wt60_a/config.h @@ -195,10 +195,12 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x07 +#define EEPROM_VERSION 0x08 #define EEPROM_VERSION_ADDR 34 -// Backlight config starts after EEPROM version -#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 -// Dynamic keymap starts after backlight config (35+37) -#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*5*14*2)) = (35+560) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 595 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 429 +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/wilba_tech/wt65_a/config.h b/keyboards/wilba_tech/wt65_a/config.h index 5f535c6a79..88e9023539 100644 --- a/keyboards/wilba_tech/wt65_a/config.h +++ b/keyboards/wilba_tech/wt65_a/config.h @@ -195,10 +195,12 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x07 +#define EEPROM_VERSION 0x08 #define EEPROM_VERSION_ADDR 34 -// Backlight config starts after EEPROM version -#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 -// Dynamic keymap starts after backlight config (35+37) -#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*5*15*2)) = (35+600) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 635 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 389 +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/wilba_tech/wt80_a/config.h b/keyboards/wilba_tech/wt80_a/config.h index f78ce7fb34..ca03c366e9 100644 --- a/keyboards/wilba_tech/wt80_a/config.h +++ b/keyboards/wilba_tech/wt80_a/config.h @@ -195,10 +195,12 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x07 +#define EEPROM_VERSION 0x08 #define EEPROM_VERSION_ADDR 34 -// Backlight config starts after EEPROM version -#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 -// Dynamic keymap starts after backlight config (35+37) -#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*6*17*2)) = (35+816) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 851 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 173 +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/wilba_tech/wt_main.c b/keyboards/wilba_tech/wt_main.c index 23f07d7eb1..de6d7b92c1 100644 --- a/keyboards/wilba_tech/wt_main.c +++ b/keyboards/wilba_tech/wt_main.c @@ -17,6 +17,7 @@ #include "quantum.h" #include "keyboards/wilba_tech/wt_mono_backlight.h" #include "keyboards/zeal60/zeal60_api.h" // Temporary hack +#include "keyboards/zeal60/zeal60_keycodes.h" // Temporary hack #include "raw_hid.h" #include "dynamic_keymap.h" @@ -91,22 +92,57 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) dynamic_keymap_reset(); break; } -#endif // DYNAMIC_KEYMAP_ENABLE - case id_backlight_config_set_value: + case id_dynamic_keymap_macro_get_count: + { + command_data[0] = dynamic_keymap_macro_get_count(); + break; + } + case id_dynamic_keymap_macro_get_buffer_size: + { + uint16_t size = dynamic_keymap_macro_get_buffer_size(); + command_data[0] = size >> 8; + command_data[1] = size & 0xFF; + break; + } + case id_dynamic_keymap_macro_get_buffer: + { + uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; + uint16_t size = command_data[2]; // size <= 28 + dynamic_keymap_macro_get_buffer( offset, size, &command_data[3] ); + break; + } + case id_dynamic_keymap_macro_set_buffer: + { + uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; + uint16_t size = command_data[2]; // size <= 28 + dynamic_keymap_macro_set_buffer( offset, size, &command_data[3] ); + break; + } + case id_dynamic_keymap_macro_reset: + { + dynamic_keymap_macro_reset(); + break; + } + case id_dynamic_keymap_get_layer_count: { - //backlight_config_set_value(command_data); + command_data[0] = dynamic_keymap_get_layer_count(); break; } - case id_backlight_config_get_value: + case id_dynamic_keymap_get_buffer: { - //backlight_config_get_value(command_data); + uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; + uint16_t size = command_data[2]; // size <= 28 + dynamic_keymap_get_buffer( offset, size, &command_data[3] ); break; } - case id_backlight_config_save: + case id_dynamic_keymap_set_buffer: { - //backlight_config_save(); + uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; + uint16_t size = command_data[2]; // size <= 28 + dynamic_keymap_set_buffer( offset, size, &command_data[3] ); break; } +#endif // DYNAMIC_KEYMAP_ENABLE case id_eeprom_reset: { eeprom_reset(); @@ -151,6 +187,8 @@ void main_init(void) #ifdef DYNAMIC_KEYMAP_ENABLE // This resets the keymaps in EEPROM to what is in flash. dynamic_keymap_reset(); + // This resets the macros in EEPROM to nothing. + dynamic_keymap_macro_reset(); #endif // Save the magic number last, in case saving was interrupted eeprom_set_valid(true); @@ -196,3 +234,43 @@ void matrix_scan_kb(void) backlight_update_pwm_buffers(); matrix_scan_user(); } + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) +{ + switch(keycode) { + case FN_MO13: + if (record->event.pressed) { + layer_on(1); + update_tri_layer(1, 2, 3); + } else { + layer_off(1); + update_tri_layer(1, 2, 3); + } + return false; + break; + case FN_MO23: + if (record->event.pressed) { + layer_on(2); + update_tri_layer(1, 2, 3); + } else { + layer_off(2); + update_tri_layer(1, 2, 3); + } + return false; + break; + } + +#ifdef DYNAMIC_KEYMAP_ENABLE + // Handle macros + if (record->event.pressed) { + if ( keycode >= MACRO00 && keycode <= MACRO15 ) + { + uint8_t id = keycode - MACRO00; + dynamic_keymap_macro_send(id); + return false; + } + } +#endif //DYNAMIC_KEYMAP_ENABLE + + return process_record_user(keycode, record); +} |