diff options
Diffstat (limited to 'keyboards/wilba_tech/wt_main.c')
-rw-r--r-- | keyboards/wilba_tech/wt_main.c | 92 |
1 files changed, 85 insertions, 7 deletions
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); +} |