summaryrefslogtreecommitdiffstats
path: root/drivers/led/ckled2001.c
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2022-08-03 16:53:42 +0800
committerlokher <lokher@gmail.com>2022-08-05 14:45:45 +0800
commit968655c74cc13a1a63320ef795fe436449708429 (patch)
treeb37716e10d16dcf760ba608dc66051cdb47eb31b /drivers/led/ckled2001.c
parent068bfc49de127c1f1305ee7680f51425ca9cd1f1 (diff)
Add K8 pro
Diffstat (limited to 'drivers/led/ckled2001.c')
-rw-r--r--drivers/led/ckled2001.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/led/ckled2001.c b/drivers/led/ckled2001.c
index 8d71805a24..dac61f7816 100644
--- a/drivers/led/ckled2001.c
+++ b/drivers/led/ckled2001.c
@@ -30,6 +30,10 @@
# define PHASE_CHANNEL MSKPHASE_12CHANNEL
#endif
+#ifndef CKLED2001_CURRENT_TUNE
+# define CKLED2001_CURRENT_TUNE {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
+#endif
+
// Transfer buffer for TWITransmitData()
uint8_t g_twi_transfer_buffer[20];
@@ -123,18 +127,10 @@ void CKLED2001_init(uint8_t addr) {
}
// Set CURRENT PAGE (Page 4)
+ uint8_t current_tuen_reg_list[LED_CURRENT_TUNE_LENGTH] = CKLED2001_CURRENT_TUNE;
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, CURRENT_TUNE_PAGE);
for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) {
- switch (i) {
- case 2:
- case 5:
- case 8:
- case 11:
- CKLED2001_write_register(addr, i, 0xA0);
- break;
- default:
- CKLED2001_write_register(addr, i, 0xFF);
- }
+ CKLED2001_write_register(addr, i, current_tuen_reg_list[i]);
}
// Enable LEDs ON/OFF
@@ -220,18 +216,20 @@ void CKLED2001_update_led_control_registers(uint8_t addr, uint8_t index) {
g_led_control_registers_update_required[index] = false;
}
-void CKLED2001_return_normal(uint8_t addr) {
+void CKLED2001_sw_return_normal(uint8_t addr) {
// Select to function page
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
// Setting LED driver to normal mode
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE);
}
-void CKLED2001_shutdown(uint8_t addr) {
+void CKLED2001_sw_shutdown(uint8_t addr) {
// Select to function page
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
// Setting LED driver to shutdown mode
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE);
// Write SW Sleep Register
CKLED2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_ENABLE);
-}
+}
+
+