Skip to content

Commit

Permalink
cajal init
Browse files Browse the repository at this point in the history
  • Loading branch information
wavemoran committed Oct 28, 2021
1 parent a0b7c16 commit 91817ca
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 0 deletions.
4 changes: 4 additions & 0 deletions keyboards/walletburner/cajal/keymaps/wavemoran/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// #define TAPPING_FORCE_HOLD
#define IGNORE_MOD_TAP_INTERRUPT
#define TAPPING_TERM 175
#define TAPPING_FORCE_HOLD
156 changes: 156 additions & 0 deletions keyboards/walletburner/cajal/keymaps/wavemoran/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/* Copyright 2020 Worldspawn <mcmancuso@gmail.com>
*
* 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 QMK_KEYBOARD_H

// Custom Keycode Definitions
#define KC_CPYP LGUI(LSFT(LCTL(KC_4))) // Copy portion of screen
#define KC_CAPP LGUI(LSFT(KC_4)) // Capture portion of screen
#define KC_CPSC LGUI(LSFT(KC_5)) // Print screen options
#define KC_EMOJI LGUI(LCTL(KC_SPC)) // Emoji keyboard

enum cajal_layers {
_BASE,
_LOWER,
_RAISE
};

enum cajal_keycodes {
BASE,
LOWER,
RAISE
};

//Tap Dance Declarations
enum {
TD_QS,
};

//Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_QS] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_SCLN),
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_BASE] = LAYOUT_stagger(
KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_BSPC, RGB_TOG,
LGUI_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, LGUI_T(KC_J), KC_K, KC_L, TD(TD_QS), KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP,
KC_LCTL, KC_LOPT, KC_LGUI, LT(LOWER, KC_SPC), LT(RAISE, KC_SPC), KC_RGUI, KC_ROPT, KC_LEFT, KC_DOWN, KC_RGHT
),

[_LOWER] = LAYOUT_stagger(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC, KC_BSLS, RGB_MOD,
KC_TRNS, KC_CPSC, KC_CAPP, KC_CPYP, KC_EMOJI, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS,
KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_TRNS, KC_PGUP,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END
),

[_RAISE] = LAYOUT_stagger(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_F11, KC_DEL, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_EQL, KC_MINS, KC_BSLS, KC_LCBR, KC_RCBR, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PIPE, KC_PLUS, KC_UNDS, KC_LBRC, KC_RBRC, KC_PIPE, RGB_VAI,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_HUD, RGB_VAD, RGB_HUI
)
};

//code for LED Brightness fix
void matrix_init_user(void) {
// set LED 1 to output and low
setPinOutput(B5);
writePinLow(B5);
// set LED 2 to output and low
setPinOutput(B6);
writePinLow(B6);
// set LED 3 to output and low
setPinOutput(B7);
writePinLow(B7);
}

// Update pin LEDs based on layer. Repurpose CAPS LOCK LED.
// B5 Middle LED
// B6 Top LED
// B7 Bottom LED
layer_state_t layer_state_set_user(layer_state_t state) {
writePinLow(B7);
writePinLow(B6);
writePinLow(B5);
switch (get_highest_layer(state)) {
case 1:
writePinHigh(B6);
break;
case 2:
writePinHigh(B5);
break;
case 3:
writePinHigh(B7);
break;
case 4:
writePinHigh(B5);
writePinHigh(B6);
break;
case 5:
writePinHigh(B6);
writePinHigh(B7);
break;
}
return state;
}

// Update encoder rotation functionality for each layer
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
switch(biton32(layer_state)){
case 5:
if (clockwise) {
rgblight_increase_sat();
} else {
rgblight_decrease_sat();
}
break;
case 4:
if (clockwise) {
rgblight_increase_val();
} else {
rgblight_decrease_val();
}
break;
// skip 3 for now, access is more awkward
case 2:
if (clockwise) {
rgblight_increase_hue();
} else {
rgblight_decrease_hue();
}
break;
case 1:
if (clockwise) {
rgblight_step();
} else {
rgblight_step_reverse();
}
break;
default:
if (clockwise) {
tap_code(KC_VOLD);
} else {
tap_code(KC_VOLU);
}
break;
}}
return true;
};
1 change: 1 addition & 0 deletions keyboards/walletburner/cajal/keymaps/wavemoran/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TAP_DANCE_ENABLE = yes

0 comments on commit 91817ca

Please sign in to comment.