aboutsummaryrefslogtreecommitdiff
path: root/keyboards/handwired/swiftrax/bumblebee/bumblebee.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/handwired/swiftrax/bumblebee/bumblebee.c')
-rw-r--r--keyboards/handwired/swiftrax/bumblebee/bumblebee.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/keyboards/handwired/swiftrax/bumblebee/bumblebee.c b/keyboards/handwired/swiftrax/bumblebee/bumblebee.c
new file mode 100644
index 000000000..613a1fa1b
--- /dev/null
+++ b/keyboards/handwired/swiftrax/bumblebee/bumblebee.c
@@ -0,0 +1,56 @@
1/*
2Copyright 2021 Swiftrax <swiftrax@gmail.com>
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#include "bumblebee.h"
18
19// Encoder
20bool encoder_update_kb(uint8_t index, bool clockwise) {
21 if (!encoder_update_user(index, clockwise))
22 return false;
23 if (clockwise)
24 tap_code16(KC_VOLU);
25 else
26 tap_code16(KC_VOLD);
27 return true;
28}
29
30// Initialize all RGB indicators to 'off'
31__attribute__((weak))
32void keyboard_post_init_user(void) {
33 rgblight_setrgb_at(0, 0, 0, 0); // [..., 0] = top LED
34 rgblight_setrgb_at(0, 0, 0, 1); // [..., 1] = middle LED
35 rgblight_setrgb_at(0, 0, 0, 2); // [..., 2] = bottom LED
36}
37
38// RGB Layer Indicators
39layer_state_t layer_state_set_kb(layer_state_t state) {
40 if (get_highest_layer(state) == 0) {
41 rgblight_setrgb_at(255, 0, 0, 0); //red
42 } else {
43 rgblight_setrgb_at(0, 0, 0, 0);
44 }
45 if (get_highest_layer(state) == 1){
46 rgblight_setrgb_at(0, 0, 255, 1); //green
47 } else{
48 rgblight_setrgb_at(0, 0, 0, 1);
49 }
50 if (get_highest_layer(state) == 2){
51 rgblight_setrgb_at(0, 255, 0, 2); //blue
52 } else{
53 rgblight_setrgb_at(0, 0, 0, 2);
54 }
55 return layer_state_set_user(state);
56} \ No newline at end of file