aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/handwired
diff options
context:
space:
mode:
authorGravatar Priyadi Iman Nurcahyo <priyadi@priyadi.net>2017-02-11 19:03:18 +0700
committerGravatar Priyadi Iman Nurcahyo <priyadi@priyadi.net>2017-02-11 19:03:18 +0700
commit79de0cd11964e9205654498aa0027510e3c3535e (patch)
tree5c77e687491eabf1e5b062b47d0989786c03858c /keyboards/handwired
parent9fc3afbef4b3ecc8568c37f247c3c7f1ec87a4c1 (diff)
downloadqmk_firmware-79de0cd11964e9205654498aa0027510e3c3535e.tar.gz
Implement Capslock LED
Diffstat (limited to 'keyboards/handwired')
-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 @@
#include "ps2_mouse.h"
#include "ps2.h"
#include "outputselect.h"
+#include "led.h"
#define COUNT(x) (sizeof (x) / sizeof (*(x)))
// Fillers to make layering clearer
@@ -23,6 +24,8 @@
#undef KC_RALT
#define KC_RALT MT(MOD_RALT, KC_SLCK)
+bool capslock = false;
+
// glow
enum glow_modes {
GLOW_NONE,
@@ -417,7 +420,7 @@ void led_set_layer_indicator(void) {
static uint8_t oldlayer = 255;
rgbsps_set(LED_IND_FUNC, 0, 0, 0);
- rgbsps_set(LED_IND_NUM, 0, 0, 0);
+ // rgbsps_set(LED_IND_NUM, 0, 0, 0);
rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
led_reset();
@@ -438,9 +441,9 @@ void led_set_layer_indicator(void) {
case _FUNC:
rgbsps_set(LED_IND_FUNC, 15, 0, 0);
break;
- case _NUM:
- rgbsps_set(LED_IND_NUM, 0, 0, 15);
- break;
+ // case _NUM:
+ // rgbsps_set(LED_IND_NUM, 0, 0, 15);
+ // break;
case _EMOJI:
rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
break;
@@ -992,6 +995,18 @@ void battery_poll(uint8_t level) {
rgbsps_send();
}
+void led_set_user(uint8_t usb_led) {
+ bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK);
+ if (new_capslock ^ capslock) { // capslock state is different
+ if (capslock = new_capslock) {
+ rgbsps_set(LED_IND_NUM, 15, 0, 0);
+ } else {
+ rgbsps_set(LED_IND_NUM, 0, 0, 0);
+ }
+ rgbsps_send();
+ }
+}
+
void ps2_mouse_init_user() {
uint8_t rcv;
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) {
matrix_scan_user();
}
+void led_set_kb(uint8_t usb_led) {
+ led_set_user(usb_led);
+}