example_keyboards
IBNobody 9 years ago
parent 7ff57503c6
commit 44e4320b2e

@ -2,6 +2,8 @@
// this is the style you want to emulate. // this is the style you want to emulate.
#include "planck.h" #include "planck.h"
#include "print.h"
#include "action_layer.h"
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
#include "backlight.h" #include "backlight.h"
#endif #endif
@ -38,10 +40,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_QW] = { [_QW] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {RESET, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT }, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT },
{KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT} {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, M(_LW), KC_SPC, KC_SPC, M(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT}
}, },
/* Colemak /* Colemak
@ -95,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______},
{_______, _______, _______, _______, MO(_FN), _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}, },
/* Lower /* Lower
@ -113,7 +115,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______},
{_______, _______, _______, _______, _______, _______, _______, MO(_FN), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}, },
/* Function /* Function
@ -139,20 +141,53 @@ const uint16_t PROGMEM fn_actions[] = {
}; };
int tri_layer = 0;
void update_tri_layer(int layer) {
if (tri_layer > 1) {
layer_on(layer);
} else {
layer_off(layer);
}
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{ {
// MACRODOWN only works in this function // MACRODOWN only works in this function
switch(id) { switch(id)
case 0: {
if (record->event.pressed) { case _RS:
register_code(KC_RSFT); if (record->event.pressed) {
#ifdef BACKLIGHT_ENABLE print("RS_DN");
backlight_step(); layer_on(_RS);
#endif tri_layer++;
} else { update_tri_layer(_FN);
unregister_code(KC_RSFT); } else {
} print("RS_UP");
break; layer_off(_RS);
} tri_layer--;
return MACRO_NONE; update_tri_layer(_FN);
phex(layer_state);
}
break;
case _LW:
if (record->event.pressed) {
print("LW_DN");
layer_on(_LW);
tri_layer++;
update_tri_layer(_FN);
} else {
print("LW_UP");
layer_off(_LW);
tri_layer--;
update_tri_layer(_FN);
}
break;
default:
break;
}
return MACRO_NONE;
}; };

Loading…
Cancel
Save