Update LED brightness levels upon applying the configuration.
This commit is contained in:
@@ -5,6 +5,9 @@
|
|||||||
#include "config_globals.h"
|
#include "config_globals.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "usb_report_updater.h"
|
#include "usb_report_updater.h"
|
||||||
|
#include "led_display.h"
|
||||||
|
#include "slave_scheduler.h"
|
||||||
|
#include "slave_drivers/is31fl3731_driver.h"
|
||||||
|
|
||||||
static parser_error_t parseModuleConfiguration(config_buffer_t *buffer)
|
static parser_error_t parseModuleConfiguration(config_buffer_t *buffer)
|
||||||
{
|
{
|
||||||
@@ -59,10 +62,6 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
|||||||
uint8_t alphanumericSegmentsBrightness = ReadUInt8(buffer);
|
uint8_t alphanumericSegmentsBrightness = ReadUInt8(buffer);
|
||||||
uint8_t keyBacklightBrightness = ReadUInt8(buffer);
|
uint8_t keyBacklightBrightness = ReadUInt8(buffer);
|
||||||
|
|
||||||
(void)iconsAndLayerTextsBrightness;
|
|
||||||
(void)alphanumericSegmentsBrightness;
|
|
||||||
(void)keyBacklightBrightness;
|
|
||||||
|
|
||||||
// Mouse kinetic properties
|
// Mouse kinetic properties
|
||||||
|
|
||||||
uint8_t mouseMoveInitialSpeed = ReadUInt8(buffer);
|
uint8_t mouseMoveInitialSpeed = ReadUInt8(buffer);
|
||||||
@@ -138,6 +137,16 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
|||||||
if (!ParserRunDry) {
|
if (!ParserRunDry) {
|
||||||
DoubleTapSwitchLayerTimeout = doubleTapSwitchLayerTimeout;
|
DoubleTapSwitchLayerTimeout = doubleTapSwitchLayerTimeout;
|
||||||
|
|
||||||
|
// Update LED brightnesses and reinitialize LED drivers
|
||||||
|
|
||||||
|
IconsAndLayerTextsBrightness = iconsAndLayerTextsBrightness;
|
||||||
|
AlphanumericSegmentsBrightness = alphanumericSegmentsBrightness;
|
||||||
|
KeyBacklightBrightness = keyBacklightBrightness;
|
||||||
|
Slaves[SlaveId_LeftLedDriver].isConnected = false;
|
||||||
|
Slaves[SlaveId_RightLedDriver].isConnected = false;
|
||||||
|
|
||||||
|
// Update mouse key speeds
|
||||||
|
|
||||||
MouseMoveState.initialSpeed = mouseMoveInitialSpeed;
|
MouseMoveState.initialSpeed = mouseMoveInitialSpeed;
|
||||||
MouseMoveState.acceleration = mouseMoveAcceleration;
|
MouseMoveState.acceleration = mouseMoveAcceleration;
|
||||||
MouseMoveState.deceleratedSpeed = mouseMoveDeceleratedSpeed;
|
MouseMoveState.deceleratedSpeed = mouseMoveDeceleratedSpeed;
|
||||||
@@ -150,6 +159,8 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
|||||||
MouseScrollState.baseSpeed = mouseScrollBaseSpeed;
|
MouseScrollState.baseSpeed = mouseScrollBaseSpeed;
|
||||||
MouseScrollState.acceleratedSpeed = mouseScrollAcceleratedSpeed;
|
MouseScrollState.acceleratedSpeed = mouseScrollAcceleratedSpeed;
|
||||||
|
|
||||||
|
// Update counts
|
||||||
|
|
||||||
AllKeymapsCount = keymapCount;
|
AllKeymapsCount = keymapCount;
|
||||||
AllMacrosCount = macroCount;
|
AllMacrosCount = macroCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
#include "layer.h"
|
#include "layer.h"
|
||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
|
|
||||||
|
uint8_t IconsAndLayerTextsBrightness = 0xff;
|
||||||
|
uint8_t AlphanumericSegmentsBrightness = 0xff;
|
||||||
|
|
||||||
static const uint16_t capitalLetterToSegmentSet[] = {
|
static const uint16_t capitalLetterToSegmentSet[] = {
|
||||||
0b0000000011110111,
|
0b0000000011110111,
|
||||||
0b0001001010001111,
|
0b0001001010001111,
|
||||||
@@ -69,13 +72,13 @@ void LedDisplay_SetText(uint8_t length, const char* text)
|
|||||||
allSegmentSets |= characterToSegmentSet(text[0]);
|
allSegmentSets |= characterToSegmentSet(text[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
LedDriverValues[LedDriverId_Left][11] = allSegmentSets & 0b00000001 ? LED_BRIGHTNESS_LEVEL : 0;
|
LedDriverValues[LedDriverId_Left][11] = allSegmentSets & 0b00000001 ? AlphanumericSegmentsBrightness : 0;
|
||||||
LedDriverValues[LedDriverId_Left][12] = allSegmentSets & 0b00000010 ? LED_BRIGHTNESS_LEVEL : 0;
|
LedDriverValues[LedDriverId_Left][12] = allSegmentSets & 0b00000010 ? AlphanumericSegmentsBrightness : 0;
|
||||||
allSegmentSets >>= 2;
|
allSegmentSets >>= 2;
|
||||||
|
|
||||||
for (uint8_t i = 24; i <= 136; i += 16) {
|
for (uint8_t i = 24; i <= 136; i += 16) {
|
||||||
for (uint8_t j = 0; j < 5; j++) {
|
for (uint8_t j = 0; j < 5; j++) {
|
||||||
LedDriverValues[LedDriverId_Left][i + j] = allSegmentSets & 1 << j ? LED_BRIGHTNESS_LEVEL : 0;
|
LedDriverValues[LedDriverId_Left][i + j] = allSegmentSets & 1 << j ? AlphanumericSegmentsBrightness : 0;
|
||||||
}
|
}
|
||||||
allSegmentSets >>= 5;
|
allSegmentSets >>= 5;
|
||||||
}
|
}
|
||||||
@@ -94,11 +97,11 @@ void LedDisplay_SetLayer(uint8_t layerId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (layerId >= LayerId_Mod && layerId <= LayerId_Mouse) {
|
if (layerId >= LayerId_Mod && layerId <= LayerId_Mouse) {
|
||||||
LedDriverValues[LedDriverId_Left][16 * layerId - 3] = LED_BRIGHTNESS_LEVEL;
|
LedDriverValues[LedDriverId_Left][16 * layerId - 3] = IconsAndLayerTextsBrightness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled)
|
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled)
|
||||||
{
|
{
|
||||||
LedDriverValues[LedDriverId_Left][8 + icon] = isEnabled ? LED_BRIGHTNESS_LEVEL : 0;
|
LedDriverValues[LedDriverId_Left][8 + icon] = isEnabled ? IconsAndLayerTextsBrightness : 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,11 @@
|
|||||||
LedDisplayIcon_Adaptive,
|
LedDisplayIcon_Adaptive,
|
||||||
} led_display_icon_t;
|
} led_display_icon_t;
|
||||||
|
|
||||||
|
// Variables:
|
||||||
|
|
||||||
|
extern uint8_t IconsAndLayerTextsBrightness;
|
||||||
|
extern uint8_t AlphanumericSegmentsBrightness;
|
||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|
||||||
void LedDisplay_SetText(uint8_t length, const char* text);
|
void LedDisplay_SetText(uint8_t length, const char* text);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "slave_scheduler.h"
|
#include "slave_scheduler.h"
|
||||||
#include "led_display.h"
|
#include "led_display.h"
|
||||||
|
|
||||||
|
uint8_t KeyBacklightBrightness = 0xff;
|
||||||
uint8_t LedDriverValues[LED_DRIVER_MAX_COUNT][LED_DRIVER_LED_COUNT];
|
uint8_t LedDriverValues[LED_DRIVER_MAX_COUNT][LED_DRIVER_LED_COUNT];
|
||||||
|
|
||||||
static led_driver_state_t ledDriverStates[LED_DRIVER_MAX_COUNT] = {
|
static led_driver_state_t ledDriverStates[LED_DRIVER_MAX_COUNT] = {
|
||||||
@@ -70,7 +71,7 @@ void LedSlaveDriver_Init(uint8_t ledDriverId)
|
|||||||
led_driver_state_t *currentLedDriverState = ledDriverStates + ledDriverId;
|
led_driver_state_t *currentLedDriverState = ledDriverStates + ledDriverId;
|
||||||
currentLedDriverState->phase = LedDriverPhase_SetFunctionFrame;
|
currentLedDriverState->phase = LedDriverPhase_SetFunctionFrame;
|
||||||
currentLedDriverState->ledIndex = 0;
|
currentLedDriverState->ledIndex = 0;
|
||||||
memset(LedDriverValues[ledDriverId], LED_BRIGHTNESS_LEVEL, LED_DRIVER_LED_COUNT);
|
memset(LedDriverValues[ledDriverId], KeyBacklightBrightness, LED_DRIVER_LED_COUNT);
|
||||||
|
|
||||||
if (ledDriverId == LedDriverId_Left) {
|
if (ledDriverId == LedDriverId_Left) {
|
||||||
LedDisplay_SetIcon(LedDisplayIcon_CapsLock, false);
|
LedDisplay_SetIcon(LedDisplayIcon_CapsLock, false);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#define LED_CONTROL_REGISTERS_COMMAND_LENGTH 19
|
#define LED_CONTROL_REGISTERS_COMMAND_LENGTH 19
|
||||||
#define PMW_REGISTER_UPDATE_CHUNK_SIZE 8
|
#define PMW_REGISTER_UPDATE_CHUNK_SIZE 8
|
||||||
#define PWM_REGISTER_BUFFER_LENGTH (1 + PMW_REGISTER_UPDATE_CHUNK_SIZE)
|
#define PWM_REGISTER_BUFFER_LENGTH (1 + PMW_REGISTER_UPDATE_CHUNK_SIZE)
|
||||||
#define LED_BRIGHTNESS_LEVEL 0xff
|
|
||||||
|
|
||||||
#define IS_ISO true
|
#define IS_ISO true
|
||||||
#define ISO_KEY_LED_DRIVER_ID LedDriverId_Left
|
#define ISO_KEY_LED_DRIVER_ID LedDriverId_Left
|
||||||
@@ -45,6 +44,7 @@
|
|||||||
|
|
||||||
// Variables:
|
// Variables:
|
||||||
|
|
||||||
|
extern uint8_t KeyBacklightBrightness;
|
||||||
extern uint8_t LedDriverValues[LED_DRIVER_MAX_COUNT][LED_DRIVER_LED_COUNT];
|
extern uint8_t LedDriverValues[LED_DRIVER_MAX_COUNT][LED_DRIVER_LED_COUNT];
|
||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|||||||
Reference in New Issue
Block a user