aboutsummaryrefslogtreecommitdiff
path: root/keyboards/primekb/meridian/meridian.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/primekb/meridian/meridian.c')
-rw-r--r--keyboards/primekb/meridian/meridian.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/keyboards/primekb/meridian/meridian.c b/keyboards/primekb/meridian/meridian.c
new file mode 100644
index 000000000..8d94faf9e
--- /dev/null
+++ b/keyboards/primekb/meridian/meridian.c
@@ -0,0 +1,68 @@
1/*
2Copyright 2020 Holten Campbell
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "meridian.h"
19
20//Initialize B12 for in-switch caps lock
21void keyboard_pre_init_kb(void){
22 setPinOutput(B12);
23 keyboard_pre_init_user();
24}
25
26//Initialize all RGB indicators to 'off'
27__attribute__((weak))
28void keyboard_post_init_user(void) {
29 rgblight_setrgb_at(0, 0, 0, 0); // [..., 0] = top LED
30 rgblight_setrgb_at(0, 0, 0, 1); // [..., 1] = middle LED
31 rgblight_setrgb_at(0, 0, 0, 2); // [..., 2] = bottom LED
32}
33
34//Indicator light function
35bool led_update_kb(led_t led_state) {
36 bool res = led_update_user(led_state);
37 if (res) {
38 // writePin(B12, !led_state.caps_lock); //Un-comment this line to enable in-switch capslock indicator
39 if (led_state.caps_lock) {
40 rgblight_setrgb_at(0, 255, 0, 0); //green
41 } else {
42 rgblight_setrgb_at(0, 0, 0, 0);
43 }
44 if (led_state.num_lock) {
45 rgblight_setrgb_at(0, 0, 255, 1); //blue
46 } else {
47 rgblight_setrgb_at(0, 0, 0, 1);
48 }
49 if (led_state.scroll_lock) {
50 rgblight_setrgb_at(255, 0, 0, 2); //red
51 } else {
52 rgblight_setrgb_at(0, 0, 0, 2);
53 }
54}
55 return res;
56}
57
58//Below is an exmaple of layer indication using one of the RGB indicatiors. As configured, uses the bottom indicator (2) to light up red when layer 1 is in use.
59/*
60layer_state_t layer_state_set_kb(layer_state_t state) {
61 if (get_highest_layer(state) == 1) {
62 rgblight_setrgb_at(255, 0, 0, 2);
63 } else {
64 rgblight_setrgb_at(0, 0, 0, 2);
65 }
66 return state;
67}
68*/