Lift out the LED brightness into a global
Instead of passing the same constant to LedDisplay_SetLayerLed() all the time, lift it out into a global. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
@@ -82,7 +82,7 @@ bool handleKey(uhk_key_t key, int scancodeIdx, usb_keyboard_report_t *report, co
|
||||
if (key_toggled_off(prevKeyStates, currKeyStates, keyId)) {
|
||||
ActiveLayer = LAYER_ID_BASE;
|
||||
}
|
||||
LedDisplay_SetLayerLed(ActiveLayer, 0xff);
|
||||
LedDisplay_SetLayerLed(ActiveLayer);
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#define LAYER_LED_FIRST FRAME_REGISTER_PWM_FIRST + 13
|
||||
#define LAYER_LED_DISTANCE 16
|
||||
|
||||
void LedDisplay_SetLayerLed(uint8_t layerId, uint8_t brightness) {
|
||||
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), brightness * (layerId == i + 1));
|
||||
LedDriver_WriteRegister(I2C_ADDRESS_LED_DRIVER_LEFT, LAYER_LED_FIRST + (i * LAYER_LED_DISTANCE), LedDisplayBrightness * (layerId == i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "led_driver.h"
|
||||
|
||||
void LedDisplay_SetLayerLed(uint8_t layerId, uint8_t brightness);
|
||||
extern uint8_t LedDisplayBrightness;
|
||||
|
||||
void LedDisplay_SetLayerLed(uint8_t layerId);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user