|
|
@ -35,23 +35,98 @@ |
|
|
|
# define SNLED27351_CURRENT_TUNE CKLED2001_CURRENT_TUNE |
|
|
|
#endif |
|
|
|
|
|
|
|
#define MSKPHASE_12CHANNEL SNLED27351_MSKPHASE_12CHANNEL |
|
|
|
#define MSKPHASE_11CHANNEL SNLED27351_MSKPHASE_11CHANNEL |
|
|
|
#define MSKPHASE_10CHANNEL SNLED27351_MSKPHASE_10CHANNEL |
|
|
|
#define MSKPHASE_9CHANNEL SNLED27351_MSKPHASE_9CHANNEL |
|
|
|
#define MSKPHASE_8CHANNEL SNLED27351_MSKPHASE_8CHANNEL |
|
|
|
#define MSKPHASE_7CHANNEL SNLED27351_MSKPHASE_7CHANNEL |
|
|
|
#define MSKPHASE_6CHANNEL SNLED27351_MSKPHASE_6CHANNEL |
|
|
|
#define MSKPHASE_5CHANNEL SNLED27351_MSKPHASE_5CHANNEL |
|
|
|
#define MSKPHASE_4CHANNEL SNLED27351_MSKPHASE_4CHANNEL |
|
|
|
#define MSKPHASE_3CHANNEL SNLED27351_MSKPHASE_3CHANNEL |
|
|
|
#define MSKPHASE_2CHANNEL SNLED27351_MSKPHASE_2CHANNEL |
|
|
|
#define MSKPHASE_1CHANNEL SNLED27351_MSKPHASE_1CHANNEL |
|
|
|
#define MSKPHASE_12CHANNEL SNLED27351_SCAN_PHASE_12_CHANNEL |
|
|
|
#define MSKPHASE_11CHANNEL SNLED27351_SCAN_PHASE_11_CHANNEL |
|
|
|
#define MSKPHASE_10CHANNEL SNLED27351_SCAN_PHASE_10_CHANNEL |
|
|
|
#define MSKPHASE_9CHANNEL SNLED27351_SCAN_PHASE_9_CHANNEL |
|
|
|
#define MSKPHASE_8CHANNEL SNLED27351_SCAN_PHASE_8_CHANNEL |
|
|
|
#define MSKPHASE_7CHANNEL SNLED27351_SCAN_PHASE_7_CHANNEL |
|
|
|
#define MSKPHASE_6CHANNEL SNLED27351_SCAN_PHASE_6_CHANNEL |
|
|
|
#define MSKPHASE_5CHANNEL SNLED27351_SCAN_PHASE_5_CHANNEL |
|
|
|
#define MSKPHASE_4CHANNEL SNLED27351_SCAN_PHASE_4_CHANNEL |
|
|
|
#define MSKPHASE_3CHANNEL SNLED27351_SCAN_PHASE_3_CHANNEL |
|
|
|
#define MSKPHASE_2CHANNEL SNLED27351_SCAN_PHASE_2_CHANNEL |
|
|
|
#define MSKPHASE_1CHANNEL SNLED27351_SCAN_PHASE_1_CHANNEL |
|
|
|
|
|
|
|
#define ckled2001_led snled27351_led_t |
|
|
|
#define g_ckled2001_leds g_snled27351_leds |
|
|
|
// ======== |
|
|
|
|
|
|
|
#define SNLED27351_REG_COMMAND 0xFD |
|
|
|
#define SNLED27351_COMMAND_LED_CONTROL 0x00 |
|
|
|
#define SNLED27351_COMMAND_PWM 0x01 |
|
|
|
#define SNLED27351_COMMAND_FUNCTION 0x03 |
|
|
|
#define SNLED27351_COMMAND_CURRENT_TUNE 0x04 |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_SOFTWARE_SHUTDOWN 0x00 |
|
|
|
#define SNLED27351_SOFTWARE_SHUTDOWN_SSD_SHUTDOWN (0x0 << 0) |
|
|
|
#define SNLED27351_SOFTWARE_SHUTDOWN_SSD_NORMAL (0x1 << 0) |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_ID 0x11 |
|
|
|
#define SNLED27351_DRIVER_ID 0x8A |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_PULLDOWNUP 0x13 |
|
|
|
#define SNLED27351_PULLDOWNUP_ALL_ENABLED 0xAA |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_SCAN_PHASE 0x14 |
|
|
|
#define SNLED27351_SCAN_PHASE_12_CHANNEL 0x00 |
|
|
|
#define SNLED27351_SCAN_PHASE_11_CHANNEL 0x01 |
|
|
|
#define SNLED27351_SCAN_PHASE_10_CHANNEL 0x02 |
|
|
|
#define SNLED27351_SCAN_PHASE_9_CHANNEL 0x03 |
|
|
|
#define SNLED27351_SCAN_PHASE_8_CHANNEL 0x04 |
|
|
|
#define SNLED27351_SCAN_PHASE_7_CHANNEL 0x05 |
|
|
|
#define SNLED27351_SCAN_PHASE_6_CHANNEL 0x06 |
|
|
|
#define SNLED27351_SCAN_PHASE_5_CHANNEL 0x07 |
|
|
|
#define SNLED27351_SCAN_PHASE_4_CHANNEL 0x08 |
|
|
|
#define SNLED27351_SCAN_PHASE_3_CHANNEL 0x09 |
|
|
|
#define SNLED27351_SCAN_PHASE_2_CHANNEL 0x0A |
|
|
|
#define SNLED27351_SCAN_PHASE_1_CHANNEL 0x0B |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_SLEW_RATE_CONTROL_MODE_1 0x15 |
|
|
|
#define SNLED27351_SLEW_RATE_CONTROL_MODE_1_PDP_ENABLE (0b1 << 2) |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_SLEW_RATE_CONTROL_MODE_2 0x16 |
|
|
|
#define SNLED27351_SLEW_RATE_CONTROL_MODE_2_SSL_ENABLE (0b1 << 6) |
|
|
|
#define SNLED27351_SLEW_RATE_CONTROL_MODE_2_DSL_ENABLE (0b1 << 7) |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_OPEN_SHORT_ENABLE 0x17 |
|
|
|
#define SNLED27351_OPEN_SHORT_ENABLE_SDS_ENABLE (0b1 << 6) |
|
|
|
#define SNLED27351_OPEN_SHORT_ENABLE_ODS_ENABLE (0b1 << 7) |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_OPEN_SHORT_DUTY 0x18 |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_OPEN_SHORT_FLAG 0x19 |
|
|
|
#define SNLED27351_OPEN_SHORT_FLAG_OSINT_ENABLE (0b1 << 6) |
|
|
|
#define SNLED27351_OPEN_SHORT_FLAG_ODINT_ENABLE (0b1 << 7) |
|
|
|
|
|
|
|
#define SNLED27351_FUNCTION_REG_SOFTWARE_SLEEP 0x1A |
|
|
|
#define SNLED27351_SOFTWARE_SLEEP_ENABLE (0b1 << 1) |
|
|
|
|
|
|
|
// LED Control Registers |
|
|
|
#define SNLED27351_LED_CONTROL_ON_OFF_FIRST_ADDR 0x0 |
|
|
|
#define SNLED27351_LED_CONTROL_ON_OFF_LAST_ADDR 0x17 |
|
|
|
#define SNLED27351_LED_CONTROL_ON_OFF_LENGTH ((SNLED27351_LED_CONTROL_ON_OFF_LAST_ADDR - SNLED27351_LED_CONTROL_ON_OFF_FIRST_ADDR) + 1) |
|
|
|
|
|
|
|
#define SNLED27351_LED_CONTROL_OPEN_FIRST_ADDR 0x18 |
|
|
|
#define SNLED27351_LED_CONTROL_OPEN_LAST_ADDR 0x2F |
|
|
|
#define SNLED27351_LED_CONTROL_OPEN_LENGTH ((SNLED27351_LED_CONTROL_OPEN_LAST_ADDR - SNLED27351_LED_CONTROL_OPEN_FIRST_ADDR) + 1) |
|
|
|
|
|
|
|
#define SNLED27351_LED_CONTROL_SHORT_FIRST_ADDR 0x30 |
|
|
|
#define SNLED27351_LED_CONTROL_SHORT_LAST_ADDR 0x47 |
|
|
|
#define SNLED27351_LED_CONTROL_SHORT_LENGTH ((SNLED27351_LED_CONTROL_SHORT_LAST_ADDR - SNLED27351_LED_CONTROL_SHORT_FIRST_ADDR) + 1) |
|
|
|
|
|
|
|
#define SNLED27351_LED_CONTROL_PAGE_LENGTH 0x48 |
|
|
|
|
|
|
|
// LED Control Registers |
|
|
|
#define SNLED27351_LED_PWM_FIRST_ADDR 0x00 |
|
|
|
#define SNLED27351_LED_PWM_LAST_ADDR 0xBF |
|
|
|
#define SNLED27351_LED_PWM_LENGTH 0xC0 |
|
|
|
|
|
|
|
// Current Tune Registers |
|
|
|
#define SNLED27351_LED_CURRENT_TUNE_FIRST_ADDR 0x00 |
|
|
|
#define SNLED27351_LED_CURRENT_TUNE_LAST_ADDR 0x0B |
|
|
|
#define SNLED27351_LED_CURRENT_TUNE_LENGTH 0x0C |
|
|
|
|
|
|
|
#define SNLED27351_I2C_ADDRESS_GND 0x74 |
|
|
|
#define SNLED27351_I2C_ADDRESS_SCL 0x75 |
|
|
|
#define SNLED27351_I2C_ADDRESS_SDA 0x76 |
|
|
@ -100,92 +175,6 @@ void snled27351_flush(void); |
|
|
|
void snled27351_sw_return_normal(uint8_t addr); |
|
|
|
void snled27351_sw_shutdown(uint8_t addr); |
|
|
|
|
|
|
|
// Registers Page Define |
|
|
|
#define SNLED27351_REG_CONFIGURE_CMD_PAGE 0xFD |
|
|
|
#define SNLED27351_LED_CONTROL_PAGE 0x00 |
|
|
|
#define SNLED27351_LED_PWM_PAGE 0x01 |
|
|
|
#define SNLED27351_FUNCTION_PAGE 0x03 |
|
|
|
#define SNLED27351_CURRENT_TUNE_PAGE 0x04 |
|
|
|
|
|
|
|
// Function Register: address 0x00 |
|
|
|
#define SNLED27351_REG_CONFIGURATION 0x00 |
|
|
|
#define SNLED27351_MSKSW_SHUT_DOWN_MODE (0x0 << 0) |
|
|
|
#define SNLED27351_MSKSW_NORMAL_MODE (0x1 << 0) |
|
|
|
|
|
|
|
#define SNLED27351_REG_DRIVER_ID 0x11 |
|
|
|
#define SNLED27351_DRIVER_ID 0x8A |
|
|
|
|
|
|
|
#define SNLED27351_REG_PDU 0x13 |
|
|
|
#define SNLED27351_MSKSET_CA_CB_CHANNEL 0xAA |
|
|
|
#define SNLED27351_MSKCLR_CA_CB_CHANNEL 0x00 |
|
|
|
|
|
|
|
#define SNLED27351_REG_SCAN_PHASE 0x14 |
|
|
|
#define SNLED27351_MSKPHASE_12CHANNEL 0x00 |
|
|
|
#define SNLED27351_MSKPHASE_11CHANNEL 0x01 |
|
|
|
#define SNLED27351_MSKPHASE_10CHANNEL 0x02 |
|
|
|
#define SNLED27351_MSKPHASE_9CHANNEL 0x03 |
|
|
|
#define SNLED27351_MSKPHASE_8CHANNEL 0x04 |
|
|
|
#define SNLED27351_MSKPHASE_7CHANNEL 0x05 |
|
|
|
#define SNLED27351_MSKPHASE_6CHANNEL 0x06 |
|
|
|
#define SNLED27351_MSKPHASE_5CHANNEL 0x07 |
|
|
|
#define SNLED27351_MSKPHASE_4CHANNEL 0x08 |
|
|
|
#define SNLED27351_MSKPHASE_3CHANNEL 0x09 |
|
|
|
#define SNLED27351_MSKPHASE_2CHANNEL 0x0A |
|
|
|
#define SNLED27351_MSKPHASE_1CHANNEL 0x0B |
|
|
|
|
|
|
|
#define SNLED27351_REG_SLEW_RATE_CONTROL_MODE1 0x15 |
|
|
|
#define SNLED27351_MSKPWM_DELAY_PHASE_ENABLE 0x04 |
|
|
|
#define SNLED27351_MSKPWM_DELAY_PHASE_DISABLE 0x00 |
|
|
|
|
|
|
|
#define SNLED27351_REG_SLEW_RATE_CONTROL_MODE2 0x16 |
|
|
|
#define SNLED27351_MSKDRIVING_SINKING_CHANNEL_SLEWRATE_ENABLE 0xC0 |
|
|
|
#define SNLED27351_MSKDRIVING_SINKING_CHANNEL_SLEWRATE_DISABLE 0x00 |
|
|
|
|
|
|
|
#define SNLED27351_REG_OPEN_SHORT_ENABLE 0x17 |
|
|
|
#define SNLED27351_MSKOPEN_DETECTION_ENABLE (0x01 << 7) |
|
|
|
#define SNLED27351_MSKOPEN_DETECTION_DISABLE (0x00) |
|
|
|
|
|
|
|
#define SNLED27351_MSKSHORT_DETECTION_ENABLE (0x01 << 6) |
|
|
|
#define SNLED27351_MSKSHORT_DETECTION_DISABLE (0x00) |
|
|
|
|
|
|
|
#define SNLED27351_REG_OPEN_SHORT_DUTY 0x18 |
|
|
|
#define SNLED27351_REG_OPEN_SHORT_FLAG 0x19 |
|
|
|
|
|
|
|
#define SNLED27351_MSKOPEN_DETECTION_INTERRUPT_ENABLE (0x01 << 7) |
|
|
|
#define SNLED27351_MSKOPEN_DETECTION_INTERRUPT_DISABLE (0x00) |
|
|
|
|
|
|
|
#define SNLED27351_MSKSHORT_DETECTION_INTERRUPT_ENABLE (0x01 << 6) |
|
|
|
#define SNLED27351_MSKSHORT_DETECTION_INTERRUPT_DISABLE (0x00) |
|
|
|
|
|
|
|
#define SNLED27351_REG_SOFTWARE_SLEEP 0x1A |
|
|
|
#define SNLED27351_MSKSLEEP_ENABLE 0x02 |
|
|
|
#define SNLED27351_MSKSLEEP_DISABLE 0x00 |
|
|
|
|
|
|
|
// LED Control Registers |
|
|
|
#define SNLED27351_LED_CONTROL_ON_OFF_FIRST_ADDR 0x0 |
|
|
|
#define SNLED27351_LED_CONTROL_ON_OFF_LAST_ADDR 0x17 |
|
|
|
#define SNLED27351_LED_CONTROL_ON_OFF_LENGTH ((SNLED27351_LED_CONTROL_ON_OFF_LAST_ADDR - SNLED27351_LED_CONTROL_ON_OFF_FIRST_ADDR) + 1) |
|
|
|
|
|
|
|
#define SNLED27351_LED_CONTROL_OPEN_FIRST_ADDR 0x18 |
|
|
|
#define SNLED27351_LED_CONTROL_OPEN_LAST_ADDR 0x2F |
|
|
|
#define SNLED27351_LED_CONTROL_OPEN_LENGTH ((SNLED27351_LED_CONTROL_OPEN_LAST_ADDR - SNLED27351_LED_CONTROL_OPEN_FIRST_ADDR) + 1) |
|
|
|
|
|
|
|
#define SNLED27351_LED_CONTROL_SHORT_FIRST_ADDR 0x30 |
|
|
|
#define SNLED27351_LED_CONTROL_SHORT_LAST_ADDR 0x47 |
|
|
|
#define SNLED27351_LED_CONTROL_SHORT_LENGTH ((SNLED27351_LED_CONTROL_SHORT_LAST_ADDR - SNLED27351_LED_CONTROL_SHORT_FIRST_ADDR) + 1) |
|
|
|
|
|
|
|
#define SNLED27351_LED_CONTROL_PAGE_LENGTH 0x48 |
|
|
|
|
|
|
|
// LED Control Registers |
|
|
|
#define SNLED27351_LED_PWM_FIRST_ADDR 0x00 |
|
|
|
#define SNLED27351_LED_PWM_LAST_ADDR 0xBF |
|
|
|
#define SNLED27351_LED_PWM_LENGTH 0xC0 |
|
|
|
|
|
|
|
// Current Tune Registers |
|
|
|
#define SNLED27351_LED_CURRENT_TUNE_FIRST_ADDR 0x00 |
|
|
|
#define SNLED27351_LED_CURRENT_TUNE_LAST_ADDR 0x0B |
|
|
|
#define SNLED27351_LED_CURRENT_TUNE_LENGTH 0x0C |
|
|
|
|
|
|
|
#define A_1 0x00 |
|
|
|
#define A_2 0x01 |
|
|
|
#define A_3 0x02 |
|
|
|