Merge pull request #23 from algernon/f/led-display/layer-leds
Light up LEDs on the display when switching layers
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#include "keyboard_layout.h"
|
#include "keyboard_layout.h"
|
||||||
#include "led_driver.h"
|
#include "led_display.h"
|
||||||
#include "layer.h"
|
#include "layer.h"
|
||||||
|
|
||||||
static uint8_t keyMasks[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
static uint8_t keyMasks[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
||||||
@@ -82,6 +82,7 @@ bool handleKey(uhk_key_t key, int scancodeIdx, usb_keyboard_report_t *report, co
|
|||||||
if (key_toggled_off(prevKeyStates, currKeyStates, keyId)) {
|
if (key_toggled_off(prevKeyStates, currKeyStates, keyId)) {
|
||||||
ActiveLayer = LAYER_ID_BASE;
|
ActiveLayer = LAYER_ID_BASE;
|
||||||
}
|
}
|
||||||
|
LedDisplay_SetLayerLed(ActiveLayer);
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
13
right/src/led_display.c
Normal file
13
right/src/led_display.c
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "led_display.h"
|
||||||
|
#include "layer.h"
|
||||||
|
|
||||||
|
#define LAYER_LED_FIRST FRAME_REGISTER_PWM_FIRST + 13
|
||||||
|
#define LAYER_LED_DISTANCE 16
|
||||||
|
|
||||||
|
uint8_t LedDisplayBrightness = 0xff;
|
||||||
|
|
||||||
|
void LedDisplay_SetLayerLed(uint8_t layerId) {
|
||||||
|
for (uint8_t i = 0; i < LAYER_COUNT; i++) {
|
||||||
|
LedDriver_WriteRegister(I2C_ADDRESS_LED_DRIVER_LEFT, LAYER_LED_FIRST + (i * LAYER_LED_DISTANCE), LedDisplayBrightness * (layerId == i + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
10
right/src/led_display.h
Normal file
10
right/src/led_display.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#ifndef __LED_DISPLAY_H__
|
||||||
|
#define __LED_DISPLAY_H__
|
||||||
|
|
||||||
|
#include "led_driver.h"
|
||||||
|
|
||||||
|
extern uint8_t LedDisplayBrightness;
|
||||||
|
|
||||||
|
void LedDisplay_SetLayerLed(uint8_t layerId);
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user