aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyadi Iman Nurcahyo <priyadi@priyadi.net>2017-02-11 19:03:18 +0700
committerPriyadi Iman Nurcahyo <priyadi@priyadi.net>2017-02-11 19:03:18 +0700
commit79de0cd11964e9205654498aa0027510e3c3535e (patch)
tree5c77e687491eabf1e5b062b47d0989786c03858c
parent9fc3afbef4b3ecc8568c37f247c3c7f1ec87a4c1 (diff)
downloadqmk_firmware-79de0cd11964e9205654498aa0027510e3c3535e.tar.gz
qmk_firmware-79de0cd11964e9205654498aa0027510e3c3535e.zip
Implement Capslock LED
-rw-r--r--keyboards/handwired/promethium/keymaps/priyadi/keymap.c23
-rw-r--r--keyboards/handwired/promethium/promethium.c3
2 files changed, 22 insertions, 4 deletions
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
index 992a03a41..2a21b4ba7 100644
--- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
+++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c
@@ -10,6 +10,7 @@
10#include "ps2_mouse.h" 10#include "ps2_mouse.h"
11#include "ps2.h" 11#include "ps2.h"
12#include "outputselect.h" 12#include "outputselect.h"
13#include "led.h"
13#define COUNT(x) (sizeof (x) / sizeof (*(x))) 14#define COUNT(x) (sizeof (x) / sizeof (*(x)))
14 15
15// Fillers to make layering clearer 16// Fillers to make layering clearer
@@ -23,6 +24,8 @@
23#undef KC_RALT 24#undef KC_RALT
24#define KC_RALT MT(MOD_RALT, KC_SLCK) 25#define KC_RALT MT(MOD_RALT, KC_SLCK)
25 26
27bool capslock = false;
28
26// glow 29// glow
27enum glow_modes { 30enum glow_modes {
28 GLOW_NONE, 31 GLOW_NONE,
@@ -417,7 +420,7 @@ void led_set_layer_indicator(void) {
417 static uint8_t oldlayer = 255; 420 static uint8_t oldlayer = 255;
418 421
419 rgbsps_set(LED_IND_FUNC, 0, 0, 0); 422 rgbsps_set(LED_IND_FUNC, 0, 0, 0);
420 rgbsps_set(LED_IND_NUM, 0, 0, 0); 423 // rgbsps_set(LED_IND_NUM, 0, 0, 0);
421 rgbsps_set(LED_IND_EMOJI, 0, 0, 0); 424 rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
422 425
423 led_reset(); 426 led_reset();
@@ -438,9 +441,9 @@ void led_set_layer_indicator(void) {
438 case _FUNC: 441 case _FUNC:
439 rgbsps_set(LED_IND_FUNC, 15, 0, 0); 442 rgbsps_set(LED_IND_FUNC, 15, 0, 0);
440 break; 443 break;
441 case _NUM: 444 // case _NUM:
442 rgbsps_set(LED_IND_NUM, 0, 0, 15); 445 // rgbsps_set(LED_IND_NUM, 0, 0, 15);
443 break; 446 // break;
444 case _EMOJI: 447 case _EMOJI:
445 rgbsps_set(LED_IND_EMOJI, 15, 15, 0); 448 rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
446 break; 449 break;
@@ -992,6 +995,18 @@ void battery_poll(uint8_t level) {
992 rgbsps_send(); 995 rgbsps_send();
993} 996}
994 997
998void led_set_user(uint8_t usb_led) {
999 bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK);
1000 if (new_capslock ^ capslock) { // capslock state is different
1001 if (capslock = new_capslock) {
1002 rgbsps_set(LED_IND_NUM, 15, 0, 0);
1003 } else {
1004 rgbsps_set(LED_IND_NUM, 0, 0, 0);
1005 }
1006 rgbsps_send();
1007 }
1008}
1009
995void ps2_mouse_init_user() { 1010void ps2_mouse_init_user() {
996 uint8_t rcv; 1011 uint8_t rcv;
997 1012
diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c
index 3e369a624..62e2281fa 100644
--- a/keyboards/handwired/promethium/promethium.c
+++ b/keyboards/handwired/promethium/promethium.c
@@ -32,4 +32,7 @@ void matrix_scan_kb(void) {
32 matrix_scan_user(); 32 matrix_scan_user();
33} 33}
34 34
35void led_set_kb(uint8_t usb_led) {
36 led_set_user(usb_led);
37}
35 38