Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macro support with new keybard keymap_all.h #80

Merged
merged 2 commits into from
Oct 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions keyboards/svalboard/keymaps/vial/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,6 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return state;
}



void keyboard_post_init_user(void) {
// Customise these values if you need to debug the matrix
//debug_enable=true;
//debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
rgblight_layers = sval_rgb_layers;
}

enum layer {
NORMAL,
FUNC,
Expand All @@ -84,6 +73,8 @@ enum layer {
#if __has_include("keymap_all.h")
#include "keymap_all.h"
#else
int sval_macro_size = 0;
uint8_t sval_macros[] = {0};
const uint16_t PROGMEM keymaps[DYNAMIC_KEYMAP_LAYER_COUNT][MATRIX_ROWS][MATRIX_COLS] = {
[NORMAL] = LAYOUT(
/*Center North East South West*/
Expand Down Expand Up @@ -182,3 +173,27 @@ bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record,
return achordion_opposite_hands(tap_hold_record, other_record);
}

void keyboard_post_init_user(void) {
// Customise these values if you need to debug the matrix
//debug_enable=true;
//debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
rgblight_layers = sval_rgb_layers;

#if __has_include("keymap_all.h")
// Check if we've already got our macros set. At this point we're just
// seeing if ANY macro is defined.
if (sval_macro_size > 0) {
uint8_t get[DYNAMIC_KEYMAP_MACRO_COUNT];
uint8_t check[DYNAMIC_KEYMAP_MACRO_COUNT];

memset(check, 0, DYNAMIC_KEYMAP_MACRO_COUNT);
dynamic_keymap_macro_get_buffer(0, DYNAMIC_KEYMAP_MACRO_COUNT, get);
if (memcmp(get, check, DYNAMIC_KEYMAP_MACRO_COUNT) == 0) {
// We have a blank keymap. Copy ours over.
dynamic_keymap_macro_set_buffer(0, sval_macro_size, sval_macros);
}
}
#endif
}