mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-11-04 07:12:33 +01:00 
			
		
		
		
	Implement Capslock LED
This commit is contained in:
		
							parent
							
								
									9fc3afbef4
								
							
						
					
					
						commit
						79de0cd119
					
				@ -10,6 +10,7 @@
 | 
				
			|||||||
#include "ps2_mouse.h"
 | 
					#include "ps2_mouse.h"
 | 
				
			||||||
#include "ps2.h"
 | 
					#include "ps2.h"
 | 
				
			||||||
#include "outputselect.h"
 | 
					#include "outputselect.h"
 | 
				
			||||||
 | 
					#include "led.h"
 | 
				
			||||||
#define COUNT(x) (sizeof (x) / sizeof (*(x)))
 | 
					#define COUNT(x) (sizeof (x) / sizeof (*(x)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Fillers to make layering clearer
 | 
					// Fillers to make layering clearer
 | 
				
			||||||
@ -23,6 +24,8 @@
 | 
				
			|||||||
#undef KC_RALT
 | 
					#undef KC_RALT
 | 
				
			||||||
#define KC_RALT MT(MOD_RALT, KC_SLCK)
 | 
					#define KC_RALT MT(MOD_RALT, KC_SLCK)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool capslock = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// glow
 | 
					// glow
 | 
				
			||||||
enum glow_modes {
 | 
					enum glow_modes {
 | 
				
			||||||
  GLOW_NONE,
 | 
					  GLOW_NONE,
 | 
				
			||||||
@ -417,7 +420,7 @@ void led_set_layer_indicator(void) {
 | 
				
			|||||||
  static uint8_t oldlayer = 255;
 | 
					  static uint8_t oldlayer = 255;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  rgbsps_set(LED_IND_FUNC, 0, 0, 0);
 | 
					  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);
 | 
					  rgbsps_set(LED_IND_EMOJI, 0, 0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  led_reset();
 | 
					  led_reset();
 | 
				
			||||||
@ -438,9 +441,9 @@ void led_set_layer_indicator(void) {
 | 
				
			|||||||
    case _FUNC:
 | 
					    case _FUNC:
 | 
				
			||||||
      rgbsps_set(LED_IND_FUNC, 15, 0, 0);
 | 
					      rgbsps_set(LED_IND_FUNC, 15, 0, 0);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case _NUM:
 | 
					    // case _NUM:
 | 
				
			||||||
      rgbsps_set(LED_IND_NUM, 0, 0, 15);
 | 
					    //   rgbsps_set(LED_IND_NUM, 0, 0, 15);
 | 
				
			||||||
      break;
 | 
					    //   break;
 | 
				
			||||||
    case _EMOJI:
 | 
					    case _EMOJI:
 | 
				
			||||||
      rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
 | 
					      rgbsps_set(LED_IND_EMOJI, 15, 15, 0);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
@ -992,6 +995,18 @@ void battery_poll(uint8_t level) {
 | 
				
			|||||||
  rgbsps_send();
 | 
					  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() {
 | 
					void ps2_mouse_init_user() {
 | 
				
			||||||
    uint8_t rcv;
 | 
					    uint8_t rcv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -32,4 +32,7 @@ void matrix_scan_kb(void) {
 | 
				
			|||||||
    matrix_scan_user();
 | 
					    matrix_scan_user();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void led_set_kb(uint8_t usb_led) {
 | 
				
			||||||
 | 
					    led_set_user(usb_led);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user