Compare commits

...

2 Commits

Author SHA1 Message Date
Paul Warren 0bda055378 CAPSLOCK and mode layers 2020-06-20 12:17:15 +10:00
Paul Warren b684acefe3 Dragon and Fishy 2020-06-20 12:16:59 +10:00
2 changed files with 56 additions and 3 deletions

1
kbd75/pwarren/config.h Normal file
View File

@ -0,0 +1 @@
#define RGBLIGHT_LAYERS 3

View File

@ -23,11 +23,14 @@ enum unicode_names {
COFFEE,
WINK,
GRIM,
DRAGON,
FISHY,
};
enum custom_keycode {
TFLIP,
FPALM,
FPALM2,
};
const uint32_t PROGMEM unicode_map[] = {
@ -44,6 +47,8 @@ const uint32_t PROGMEM unicode_map[] = {
[COFFEE] = 0x2615,
[WINK] = 0x1F609,
[GRIM] = 0x1F62C,
[DRAGON] = 0x1F409,
[FISHY] = 0x1F41F,
};
@ -69,9 +74,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[2] = LAYOUT(
RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, FPALM, TFLIP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______,
_______, FPALM, TFLIP, FPALM2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______,
_______, _______, _______, _______, _______, X(THUU), _______, _______, _______, _______, X(POOP), _______, _______, _______, _______,
_______, _______, X(SNEK), _______, _______, X(THUD), X(WINK), X(GRIM), X(KISS), X(CHEESY), X(FROWN), X(SMILE), _______, _______,
_______, _______, X(SNEK), X(DRAGON), X(FISHY), X(THUD), X(WINK), X(GRIM), X(KISS), X(CHEESY), X(FROWN), X(SMILE), _______, _______,
_______, _______, _______, _______, X(COFFEE), _______, _______,_______, _______, UC_MOD, UC_RMOD, X(BANG), _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@ -83,13 +88,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch(keycode) {
case FPALM:
if(record->event.pressed) {
send_unicode_hex_string("1F926 200D 2640 FE0F 000A");
}
return false;
break;
case TFLIP:
if(record->event.pressed) {
send_unicode_hex_string("0028 256F 00B0 25A1 00B0 0029 256F 0020 FE35 0020 253B 2501 253B");
}
return false;
break;
case FPALM:
case FPALM2:
if(record->event.pressed) {
send_unicode_hex_string("1F926 200D 2640 FE0F 000A");
}
@ -100,3 +111,44 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
// Lighting effects
// Light LEDs 6 to 9 and 12 to 15 red when caps lock is active. Hard to ignore!
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{6, 4, HSV_RED}, // Light 4 LEDs, starting with LED 6
{12, 4, HSV_RED} // Light 4 LEDs, starting with LED 12
);
// Light LEDs 9 & 10 in cyan when keyboard layer 1 is active
const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{9, 2, HSV_CYAN}
);
// Light LEDs 11 & 12 in purple when keyboard layer 2 is active
const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{11, 2, HSV_PURPLE}
);
// Now define the array of layers. Later layers take precedence
const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
my_capslock_layer,
my_layer1_layer, // Overrides caps lock layer
my_layer2_layer // Overrides other layers
);
void keyboard_post_init_user(void) {
// Enable the LED layers
rgblight_layers = my_rgb_layers;
}
layer_state_t layer_state_set_user(layer_state_t state) {
// Both layers will light up if both kb layers are active
rgblight_set_layer_state(1, layer_state_cmp(state, 1));
rgblight_set_layer_state(2, layer_state_cmp(state, 2));
return state;
}
bool led_update_user(led_t led_state) {
rgblight_set_layer_state(0, led_state.caps_lock);
return true;
}