Do not duplicate kbled support. Add kbled_max and kbled_get_color functions

This commit is contained in:
Jeremy Soller
2021-01-05 13:15:59 -07:00
committed by Jeremy Soller
parent 9309efb3e0
commit 5bab59a526
28 changed files with 148 additions and 309 deletions

View File

@@ -6,6 +6,9 @@ EC=it8587e
KEYMAP?=default
SRC+=$(BOARD_DIR)/keymap/$(KEYMAP).c
# Set keyboard LED mechanism
KBLED=rgb_pwm
# Set discrete GPU I2C bus
CFLAGS+=-DI2C_DGPU=I2C_1

View File

@@ -1,36 +0,0 @@
// SPDX-License-Identifier: GPL-3.0-only
#include <board/kbled.h>
#include <ec/pwm.h>
void kbled_init(void) {
//TODO: enable PWMs
kbled_reset();
}
void kbled_reset(void) {
// Set brightness and color
kbled_set_color(0xFFFFFF);
kbled_set(0x00);
}
uint8_t kbled_get(void) {
// Get PWM for power
return DCR0;
}
void kbled_set(uint8_t level) {
// Set PWM for power
DCR0 = level;
}
void kbled_set_color(uint32_t color) {
// Set PWM for blue component
DCR7 = (uint8_t)(color);
// Set PWM for green component
DCR6 = (uint8_t)(color >> 8);
// Set PWM for red component
DCR5 = (uint8_t)(color >> 16);
}