From 968655c74cc13a1a63320ef795fe436449708429 Mon Sep 17 00:00:00 2001 From: lokher Date: Wed, 3 Aug 2022 16:53:42 +0800 Subject: Add K8 pro --- drivers/led/ckled2001.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'drivers/led/ckled2001.c') 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); -} +} + + -- cgit v1.2.3