diff options
author | QMK Bot <hello@qmk.fm> | 2021-02-09 14:59:41 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-02-09 14:59:41 +0000 |
commit | 9aed856d788a65eb6e58823d743679b4c102d695 (patch) | |
tree | a171bd446d6924393e62db0028f205ab78ff393a /keyboards/nullbitsco | |
parent | 39ed48f7a79d7d31545b3ecf80ae6ea5f6489c30 (diff) | |
parent | 4107856b70eb686d2e151254ca73adf522312c49 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/nullbitsco')
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/default/keymap.c | 20 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/iso/keymap.c | 8 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/oled/keymap.c | 78 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/via/config.h | 21 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/via/keymap.c | 30 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.c | 133 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.h | 50 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/via/rules.mk | 5 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/via/via_extras.c | 129 | ||||
-rw-r--r-- | keyboards/nullbitsco/nibble/keymaps/via/via_extras.h | 39 |
10 files changed, 77 insertions, 436 deletions
diff --git a/keyboards/nullbitsco/nibble/keymaps/default/keymap.c b/keyboards/nullbitsco/nibble/keymaps/default/keymap.c index 6d453e7067..787e8bd8f7 100644 --- a/keyboards/nullbitsco/nibble/keymaps/default/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/default/keymap.c @@ -15,8 +15,10 @@ */ #include QMK_KEYBOARD_H -#define _MA 0 -#define _FN 1 +enum layer_names { + _MA, + _FN +}; enum custom_keycodes { KC_CUST = SAFE_RANGE, @@ -24,14 +26,14 @@ enum custom_keycodes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_MA] = LAYOUT_ansi( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TILD, + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, KC_F13, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_F14, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_F15, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_F16, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FN), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [_FN] = LAYOUT_ansi( - RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_INS, + RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_END, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -68,7 +70,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { } break; - + } return true; } @@ -100,10 +102,10 @@ void change_RGB(bool clockwise) { } else { rgblight_step_reverse(); } - } + } } -void encoder_update_kb(uint8_t index, bool clockwise) { +void encoder_update_user(uint8_t index, bool clockwise) { if (layer_state_is(1)) { //change RGB settings change_RGB(clockwise); @@ -113,7 +115,7 @@ void encoder_update_kb(uint8_t index, bool clockwise) { tap_code(KC_VOLU); } else { tap_code(KC_VOLD); - } + } } } @@ -125,4 +127,4 @@ void matrix_init_user(void) { void matrix_scan_user(void) { // Scan and parse keystrokes from remote keyboard, if connected (see readme) matrix_scan_remote_kb(); -}
\ No newline at end of file +} diff --git a/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c b/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c index 7e78b1f638..214034ef8e 100644 --- a/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c @@ -15,8 +15,10 @@ */ #include QMK_KEYBOARD_H -#define _MA 0 -#define _FN 1 +enum layer_names { + _MA, + _FN +}; enum custom_keycodes { KC_CUST = SAFE_RANGE, @@ -103,7 +105,7 @@ void change_RGB(bool clockwise) { } } -void encoder_update_kb(uint8_t index, bool clockwise) { +void encoder_update_user(uint8_t index, bool clockwise) { if (layer_state_is(1)) { //change RGB settings change_RGB(clockwise); diff --git a/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c b/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c index 0b6a974426..b9630b8e8c 100644 --- a/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c @@ -15,8 +15,10 @@ */ #include QMK_KEYBOARD_H -#define _MA 0 -#define _FN 1 +enum layer_names { + _MA, + _FN +}; enum custom_keycodes { KC_CUST = SAFE_RANGE, @@ -24,14 +26,14 @@ enum custom_keycodes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_MA] = LAYOUT_ansi( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TILD, + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, KC_F13, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_F14, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_F15, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_F16, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FN), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [_FN] = LAYOUT_ansi( - RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_INS, + RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_END, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -44,37 +46,37 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_ static void render_logo(void) { static const char PROGMEM nibble_logo[] = { - 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, - 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, - 0x1f, 0x1f, 0x1f, 0x3f, 0x3e, 0xfe, 0xfe, 0xfc, 0xf8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x3f, 0x3e, 0xfe, 0xfe, - 0xfc, 0xf8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xff, 0xff, 0xff, - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e, 0x0c, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x0f, 0x1f, 0x7f, 0xff, 0xfe, 0xf8, 0xf0, 0xc0, 0x80, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, - 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xfc, 0xff, 0xff, 0xbf, 0x1f, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xff, 0xff, - 0xff, 0xbf, 0x1f, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x1f, 0x7f, 0xff, - 0xfe, 0xfc, 0xf0, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x0f, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xe0, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x0f, - 0xff, 0xff, 0xff, 0xfe, 0xf8, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, - 0x00, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x07, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, - 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, - 0xf8, 0xf8, 0xf8, 0xf8, 0x7c, 0x7c, 0x7e, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x7f, - 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x7c, 0x7c, 0x7e, - 0x3f, 0x3f, 0x1f, 0x0f, 0x07, 0x00, 0x00, 0x1f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, - 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x78, 0x30, 0x3f, 0x7f, 0xff, 0xff, 0xff, + 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, + 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, + 0x1f, 0x1f, 0x1f, 0x3f, 0x3e, 0xfe, 0xfe, 0xfc, 0xf8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xfe, + 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x3f, 0x3e, 0xfe, 0xfe, + 0xfc, 0xf8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xff, 0xff, 0xff, + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e, 0x0c, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x0f, 0x1f, 0x7f, 0xff, 0xfe, 0xf8, 0xf0, 0xc0, 0x80, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, + 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xfc, 0xff, 0xff, 0xbf, 0x1f, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xff, 0xff, + 0xff, 0xbf, 0x1f, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x1f, 0x7f, 0xff, + 0xfe, 0xfc, 0xf0, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x0f, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xe0, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x0f, + 0xff, 0xff, 0xff, 0xfe, 0xf8, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x07, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0x7c, 0x7c, 0x7e, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x7f, + 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x7c, 0x7c, 0x7e, + 0x3f, 0x3f, 0x1f, 0x0f, 0x07, 0x00, 0x00, 0x1f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x78, 0x30, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x78, 0x30, 0x00 }; // Host Keyboard Layer Status @@ -114,13 +116,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { } break; - + } return true; } -void encoder_update_kb(uint8_t index, bool clockwise) { +void encoder_update_user(uint8_t index, bool clockwise) { if (clockwise) { tap_code(KC_VOLU); } else { @@ -136,4 +138,4 @@ void matrix_init_user(void) { void matrix_scan_user(void) { // Scan and parse keystrokes from remote keyboard, if connected (see readme) matrix_scan_remote_kb(); -}
\ No newline at end of file +} diff --git a/keyboards/nullbitsco/nibble/keymaps/via/config.h b/keyboards/nullbitsco/nibble/keymaps/via/config.h deleted file mode 100644 index 961e2aed1a..0000000000 --- a/keyboards/nullbitsco/nibble/keymaps/via/config.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2020 Jay Greco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -// Custom config starts after VIA's EEPROM usage, -// dynamic keymaps start after this. -// Custom config Usage: -// 1 for enabled encoder modes (1 byte) -// 6 for 3x custom encoder settings, left, right, and press (18 bytes) -#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 19
\ No newline at end of file diff --git a/keyboards/nullbitsco/nibble/keymaps/via/keymap.c b/keyboards/nullbitsco/nibble/keymaps/via/keymap.c index f72ffc56e1..5b2f3b4f2e 100644 --- a/keyboards/nullbitsco/nibble/keymaps/via/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/via/keymap.c @@ -14,12 +14,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include QMK_KEYBOARD_H -#include "via_extras.h" -#define _BASE 0 -#define _VIA1 1 -#define _VIA2 2 -#define _VIA3 3 +enum layer_names { + _BASE, + _VIA1, + _VIA2, + _VIA3 +}; #define KC_DISC_MUTE KC_F23 #define KC_DISC_DEAF KC_F24 @@ -50,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_VIA1] = LAYOUT_all( - RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_INS, + RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_END, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -100,7 +101,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { tap_code(KC_DISC_MUTE); if (!rgblight_is_enabled()) break; - + if (muted) { rgblight_enable_noeeprom(); } else { @@ -133,7 +134,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!is_alt_tab_active) { is_alt_tab_active = true; register_code(KC_LALT); - } + } alt_tab_timer = timer_read(); register_code(KC_TAB); } else { @@ -142,11 +143,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; default: - break; + break; } return true; } +void encoder_update_user(uint8_t index, bool clockwise) { + // Encoder is mapped to volume functions by default + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } +} + void matrix_init_user(void) { // Initialize remote keyboard, if connected (see readme) matrix_init_remote_kb(); @@ -161,4 +171,4 @@ void matrix_scan_user(void) { is_alt_tab_active = false; } } -}
\ No newline at end of file +} diff --git a/keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.c b/keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.c deleted file mode 100644 index bdea1869c2..0000000000 --- a/keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright 2020 Jay Greco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#include "nibble_encoder.h" - -uint8_t encoder_value = 0x20, - encoder_mode = ENC_MODE_VOLUME, - enabled_encoder_modes = 0x1F; - -uint16_t retrieve_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior) { -#ifdef DYNAMIC_KEYMAP_ENABLE - void* addr = (void*)(EEPROM_CUSTOM_ENCODER + (encoder_idx * 6) + (behavior * 2)); - uint16_t keycode = eeprom_read_byte(addr) << 8; - keycode |= eeprom_read_byte(addr + 1); - return keycode; -#else - return 0; -#endif -} - -void set_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior, uint16_t new_code) { -#ifdef DYNAMIC_KEYMAP_ENABLE - void* addr = (void*)(EEPROM_CUSTOM_ENCODER + (encoder_idx * 6) + (behavior * 2)); - eeprom_update_byte(addr, (uint8_t)(new_code >> 8)); - eeprom_update_byte(addr + 1, (uint8_t)(new_code & 0xFF)); -#endif -} - -void pre_encoder_mode_change(void) { - dprintf("Changing encoder mode: %u\n", encoder_mode); -} - -void post_encoder_mode_change(void) { - dprintf("Encoder mode: %u\n", encoder_mode); -} - -//??? -void change_encoder_mode(bool clockwise) { - pre_encoder_mode_change(); - if(enabled_encoder_modes == 0){ - enabled_encoder_modes = 0x1F; - } - do { - if(!clockwise){ - if (encoder_mode == 0){ - encoder_mode = _NUM_ENCODER_MODES - 1; - } else{ - encoder_mode = encoder_mode - 1; - } - } else { - encoder_mode = (encoder_mode + 1) % _NUM_ENCODER_MODES; - } - } while(((1 << encoder_mode) & enabled_encoder_modes) == 0); - post_encoder_mode_change(); -} - -uint16_t handle_encoder_cw(void) { - dprintf("Encoder mode: %u\n", encoder_mode); - uint16_t mapped_code = 0; - switch(encoder_mode){ - default: - break; - case ENC_MODE_VOLUME: - mapped_code = KC_VOLU; - break; - case ENC_MODE_MEDIA: - mapped_code = KC_MEDIA_NEXT_TRACK; - break; - case ENC_MODE_SCROLL: - mapped_code = KC_WH_D; - break; - case ENC_MODE_BACKLIGHT: - mapped_code = RGB_VAI; - break; -#ifdef DYNAMIC_KEYMAP_ENABLE - case ENC_MODE_CUSTOM0: - mapped_code = retrieve_custom_encoder_config(0, ENC_CUSTOM_CW); - break; - case ENC_MODE_CUSTOM1: - mapped_code = retrieve_custom_encoder_config(1, ENC_CUSTOM_CW); - break; - case ENC_MODE_CUSTOM2: - mapped_code = retrieve_custom_encoder_config(2, ENC_CUSTOM_CW); - break; -#endif - } - return mapped_code; -} - -uint16_t handle_encoder_ccw(void) { - dprintf("Encoder mode: %u\n", encoder_mode); - uint16_t mapped_code = 0; - switch(encoder_mode){ - default: - break; - case ENC_MODE_VOLUME: - mapped_code = KC_VOLD; - break; - case ENC_MODE_MEDIA: - mapped_code = KC_MEDIA_PREV_TRACK; - break; - case ENC_MODE_SCROLL: - mapped_code = KC_WH_U; - break; - case ENC_MODE_BACKLIGHT: - mapped_code = RGB_VAD; - break; -#ifdef DYNAMIC_KEYMAP_ENABLE - case ENC_MODE_CUSTOM0: - mapped_code = retrieve_custom_encoder_config(0, ENC_CUSTOM_CCW); - break; - case ENC_MODE_CUSTOM1: - mapped_code = retrieve_custom_encoder_config(1, ENC_CUSTOM_CCW); - break; - case ENC_MODE_CUSTOM2: - mapped_code = retrieve_custom_encoder_config(2, ENC_CUSTOM_CCW); - break; -#endif - } - return mapped_code; -} diff --git a/keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.h b/keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.h deleted file mode 100644 index fc1e61434b..0000000000 --- a/keyboards/nullbitsco/nibble/keymaps/via/nibble_encoder.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2020 Jay Greco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#pragma once - -#include QMK_KEYBOARD_H -#include "eeprom.h" - -#define EEPROM_ENABLED_ENCODER_MODES (VIA_EEPROM_CUSTOM_CONFIG_ADDR) -#define EEPROM_CUSTOM_ENCODER (VIA_EEPROM_CUSTOM_CONFIG_ADDR+1) - -enum encoder_modes { - ENC_MODE_VOLUME, - ENC_MODE_MEDIA, - ENC_MODE_SCROLL, - ENC_MODE_BRIGHTNESS, - ENC_MODE_BACKLIGHT, - ENC_MODE_CUSTOM0, - ENC_MODE_CUSTOM1, - ENC_MODE_CUSTOM2, - _NUM_ENCODER_MODES, -}; - -enum custom_encoder_behavior { - ENC_CUSTOM_CW = 0, - ENC_CUSTOM_CCW, - ENC_CUSTOM_PRESS -}; - -uint16_t - retrieve_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior), - handle_encoder_cw(void), - handle_encoder_ccw(void); - -void set_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior, uint16_t new_code), - pre_encoder_mode_change(void), - post_encoder_mode_change(void), - change_encoder_mode(bool clockwise);
\ No newline at end of file diff --git a/keyboards/nullbitsco/nibble/keymaps/via/rules.mk b/keyboards/nullbitsco/nibble/keymaps/via/rules.mk index ee197efc02..036bd6d1c3 100644 --- a/keyboards/nullbitsco/nibble/keymaps/via/rules.mk +++ b/keyboards/nullbitsco/nibble/keymaps/via/rules.mk @@ -1,4 +1 @@ -VIA_ENABLE = yes - -SRC += keymaps/via/nibble_encoder.c -SRC += keymaps/via/via_extras.c
\ No newline at end of file +VIA_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/nullbitsco/nibble/keymaps/via/via_extras.c b/keyboards/nullbitsco/nibble/keymaps/via/via_extras.c deleted file mode 100644 index 067296b76b..0000000000 --- a/keyboards/nullbitsco/nibble/keymaps/via/via_extras.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2020 Jay Greco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "via_extras.h" - -// Encoder Behavior -extern uint8_t encoder_value; -extern uint8_t encoder_mode; -extern uint8_t enabled_encoder_modes; - -void raw_hid_receive_kb( uint8_t *data, uint8_t length ) -{ - uint8_t *command_id = &(data[0]); - uint8_t *command_data = &(data[1]); - dprintf("raw hid recv! command_id: %u\n",*command_id); - switch ( *command_id ) - { - case id_get_keyboard_value: - { - switch( command_data[0]) - { - case id_encoder_modes: - { - command_data[1] = enabled_encoder_modes; - dprintf("[read] enabled_encoder_modes: %u\n", enabled_encoder_modes); - } - break; - - case id_encoder_custom: - { - uint8_t custom_encoder_idx = command_data[1]; - uint16_t keycode = retrieve_custom_encoder_config(custom_encoder_idx, ENC_CUSTOM_CW); - command_data[2] = keycode >> 8; - command_data[3] = keycode & 0xFF; - keycode = retrieve_custom_encoder_config(custom_encoder_idx, ENC_CUSTOM_CCW); - command_data[4] = keycode >> 8; - command_data[5] = keycode & 0xFF; - keycode = retrieve_custom_encoder_config(custom_encoder_idx, ENC_CUSTOM_PRESS); - command_data[6] = keycode >> 8; - command_data[7] = keycode & 0xFF; - } - break; - - default: - { - *command_id = id_unhandled; - } - break; - } - } - break; - case id_set_keyboard_value: - { - switch(command_data[0]){ - case id_encoder_modes: - { - enabled_encoder_modes = command_data[1]; - dprintf("[write] enabled_encoder_modes: %u\n", enabled_encoder_modes); - eeprom_update_byte((uint8_t*)EEPROM_ENABLED_ENCODER_MODES, enabled_encoder_modes); - } - break; - - case id_encoder_custom: - { - uint8_t custom_encoder_idx = command_data[1]; - uint8_t encoder_behavior = command_data[2]; - uint16_t keycode = (command_data[3] << 8) | command_data[4]; - set_custom_encoder_config(custom_encoder_idx, encoder_behavior, keycode); - } - break; - - default: - { - *command_id = id_unhandled; - } - break; - } - } - break; - - default: - { - // Unhandled message. - *command_id = id_unhandled; - } - break; - } -} - -void encoder_update_kb(uint8_t index, bool clockwise) { - if (layer_state_is(1)) { - change_encoder_mode(clockwise); - return; - } - uint16_t mapped_code = 0; - if (clockwise) { - mapped_code = handle_encoder_cw(); - } else { - mapped_code = handle_encoder_ccw(); - } - if(mapped_code != 0){ - tap_code16(mapped_code); - } -} - -void custom_config_load(void){ -#ifdef DYNAMIC_KEYMAP_ENABLE - enabled_encoder_modes = eeprom_read_byte((uint8_t*)EEPROM_ENABLED_ENCODER_MODES); -#endif -} - -void via_init_kb(void) -{ - dprintf("VIA is enabled.\n"); - custom_config_load(); -} diff --git a/keyboards/nullbitsco/nibble/keymaps/via/via_extras.h b/keyboards/nullbitsco/nibble/keymaps/via/via_extras.h deleted file mode 100644 index 83c3c13128..0000000000 --- a/keyboards/nullbitsco/nibble/keymaps/via/via_extras.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2020 Jay Greco - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#pragma once - -#include "nibble_encoder.h" -#include "via.h" -#include "raw_hid.h" -#include "dynamic_keymap.h" -#include "tmk_core/common/eeprom.h" - -enum nibble_keyboard_value_id { - id_encoder_modes = 0x80, - id_unused_mode_1, - id_encoder_custom, - id_unused_mode_2 -}; - -// Encoder Behavior -extern uint8_t encoder_value, - encoder_mode, - enabled_encoder_modes; - -void raw_hid_receive_kb(uint8_t *data, uint8_t length), - encoder_update_kb(uint8_t index, bool clockwise), - custom_config_load(void), - via_init_kb(void);
\ No newline at end of file |