Use LED_BRIGHTNESS_LEVEL in led_display.c instead of magic values.

This commit is contained in:
László Monda
2017-09-29 01:33:21 +02:00
parent eb2d7ada3a
commit 28f0cdd2c0

View File

@@ -65,27 +65,26 @@ void LedDisplay_SetText(uint8_t length, const char* text) {
case 1:
allSegmentSets |= characterToSegmentSet(text[0]);
}
LedDriverStates[LedDriverId_Left].sourceLedValues[11] = allSegmentSets & 0b00000001 ? 255 : 0;
LedDriverStates[LedDriverId_Left].sourceLedValues[12] = allSegmentSets & 0b00000010 ? 255 : 0;
LedDriverStates[LedDriverId_Left].sourceLedValues[11] = allSegmentSets & 0b00000001 ? LED_BRIGHTNESS_LEVEL : 0;
LedDriverStates[LedDriverId_Left].sourceLedValues[12] = allSegmentSets & 0b00000010 ? LED_BRIGHTNESS_LEVEL : 0;
allSegmentSets >>= 2;
for (uint8_t i = 24; i <= 136; i += 16) {
for (uint8_t j = 0; j < 5; j++) {
LedDriverStates[LedDriverId_Left].sourceLedValues[i + j] = allSegmentSets & 1 << j ? 255 : 0;
LedDriverStates[LedDriverId_Left].sourceLedValues[i + j] = allSegmentSets & 1 << j ? LED_BRIGHTNESS_LEVEL : 0;
}
allSegmentSets >>= 5;
}
}
void LedDisplay_SetLayer(uint8_t layerId) {
for (uint8_t i = 13; i <= 45; i += 16) {
LedDriverStates[LedDriverId_Left].sourceLedValues[i] = 0;
}
if (layerId >= LAYER_ID_MOD && layerId <= LAYER_ID_MOUSE) {
LedDriverStates[LedDriverId_Left].sourceLedValues[16 * layerId - 3] = 255;
LedDriverStates[LedDriverId_Left].sourceLedValues[16 * layerId - 3] = LED_BRIGHTNESS_LEVEL;
}
}
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled) {
LedDriverStates[LedDriverId_Left].sourceLedValues[8 + icon] = isEnabled ? 255 : 0;
LedDriverStates[LedDriverId_Left].sourceLedValues[8 + icon] = isEnabled ? LED_BRIGHTNESS_LEVEL : 0;
}