updating to include light layers eventually

This commit is contained in:
Chris Cochrun 2023-08-01 05:48:18 -05:00
parent 7dad54fdde
commit 7781d7552c
3 changed files with 132 additions and 1 deletions

View file

@ -0,0 +1,19 @@
/*
Copyright 2023 Chris Cochrun <chris@cochrun.xyz>
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
#define RGBLIGHT_LAYERS

View file

@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
BL_STEP, _______, _______, _______, KC_MINS, KC_LCBR, KC_LPRN, KC_RPRN, KC_RCBR, KC_1, KC_2, KC_3, KC_MINS, _______,
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
_______, _______, KC_DEL, KC_DEL, _______, KC_P0
_______, _______, KC_DEL, KC_DEL, _______, KC_0
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
),
@ -113,3 +113,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
// Light LEDs 9 & 10 in cyan when keyboard layer 1 is active
const rgblight_segment_t PROGMEM numnav_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 extra_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(
numnav_layer, // Overrides caps lock layer
extra_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) {
rgblight_set_layer_state(0, layer_state_cmp(state, _LOWER));
rgblight_set_layer_state(1, layer_state_cmp(state, _RAISE));
return state;
}

View file

@ -0,0 +1,83 @@
/*
Copyright 2023 John Stegeman
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
/*
LED index mapping:
(31) (32) (33) (67) (66) (65)
0 1 2 3 4 5 39 38 37 36 35 34
11 10 9 8 7 6 40 41 42 43 44 45
12 13 14 15 16 17 51 50 49 48 47 46
23 22 21 20 19 18 27 61 52 53 54 55 56 57
24 25 26 60 59 58
(30) (29) (28) (62) (63) (64)
*/
const rgblight_segment_t PROGMEM COLEMAK_LIGHT_LAYER[] = RGBLIGHT_LAYER_SEGMENTS(
// left side
{0, 6, HSV_BLUE},
{6, 5, HSV_AZURE},
{11, 2, HSV_BLUE},
{13, 10, HSV_AZURE},
{23, 2, HSV_BLUE},
{25, 1, HSV_RED},
{26, 2, HSV_BLUE},
{28, 3, HSV_BLUE}, // underglow
{31, 3, HSV_BLUE}, // underglow
// right side
{34, 6, HSV_BLUE},
{40, 4, HSV_AZURE},
{44, 3, HSV_BLUE},
{47, 7, HSV_AZURE},
{54, 5, HSV_BLUE},
{59, 1, HSV_RED},
{60, 2, HSV_BLUE},
{62, 3, HSV_BLUE}, // underglow
{65, 3, HSV_BLUE} // underglow
);
const rgblight_segment_t PROGMEM NAVNUM_LIGHT_LAYER[] = RGBLIGHT_LAYER_SEGMENTS(
{0, 14, HSV_BLACK},
{14, 3, HSV_GREEN},
{17, 2, HSV_BLACK},
{19, 1, HSV_GREEN},
{20, 21, RGB_OFF},
{41, 3, HSV_GREEN},
{44, 4, HSV_BLACK},
{48, 3, HSV_GREEN},
{51, 2, HSV_BLACK},
{53, 3, HSV_GREEN},
{56, 2, HSV_BLACK},
{58, 1, HSV_GREEN},
{59, 9, HSV_BLACK}
);
const rgblight_segment_t* const PROGMEM MY_LIGHT_LAYERS[] = RGBLIGHT_LAYERS_LIST(
COLEMAK_LIGHT_LAYER,
NAVNUM_LIGHT_LAYER
);