ckled2001: driver naming cleanups (#21890)
This commit is contained in:
parent
eb2db05e8a
commit
35aceab1a4
37 changed files with 320 additions and 289 deletions
|
@ -20,6 +20,34 @@
|
|||
#include <stdbool.h>
|
||||
#include "progmem.h"
|
||||
|
||||
// ======== DEPRECATED DEFINES - DO NOT USE ========
|
||||
#ifdef DRIVER_COUNT
|
||||
# define CKLED2001_DRIVER_COUNT DRIVER_COUNT
|
||||
#endif
|
||||
#ifdef CKLED2001_TIMEOUT
|
||||
# define CKLED2001_I2C_TIMEOUT CKLED2001_TIMEOUT
|
||||
#endif
|
||||
#ifdef CKLED2001_PERSISTENCE
|
||||
# define CKLED2001_I2C_PERSISTENCE CKLED2001_PERSISTENCE
|
||||
#endif
|
||||
#ifdef PHASE_CHANNEL
|
||||
# define CKLED2001_PHASE_CHANNEL PHASE_CHANNEL
|
||||
#endif
|
||||
|
||||
#define MSKPHASE_12CHANNEL CKLED2001_MSKPHASE_12CHANNEL
|
||||
#define MSKPHASE_11CHANNEL CKLED2001_MSKPHASE_11CHANNEL
|
||||
#define MSKPHASE_10CHANNEL CKLED2001_MSKPHASE_10CHANNEL
|
||||
#define MSKPHASE_9CHANNEL CKLED2001_MSKPHASE_9CHANNEL
|
||||
#define MSKPHASE_8CHANNEL CKLED2001_MSKPHASE_8CHANNEL
|
||||
#define MSKPHASE_7CHANNEL CKLED2001_MSKPHASE_7CHANNEL
|
||||
#define MSKPHASE_6CHANNEL CKLED2001_MSKPHASE_6CHANNEL
|
||||
#define MSKPHASE_5CHANNEL CKLED2001_MSKPHASE_5CHANNEL
|
||||
#define MSKPHASE_4CHANNEL CKLED2001_MSKPHASE_4CHANNEL
|
||||
#define MSKPHASE_3CHANNEL CKLED2001_MSKPHASE_3CHANNEL
|
||||
#define MSKPHASE_2CHANNEL CKLED2001_MSKPHASE_2CHANNEL
|
||||
#define MSKPHASE_1CHANNEL CKLED2001_MSKPHASE_1CHANNEL
|
||||
// ========
|
||||
|
||||
typedef struct ckled2001_led {
|
||||
uint8_t driver : 2;
|
||||
uint8_t v;
|
||||
|
@ -47,90 +75,90 @@ void ckled2001_sw_return_normal(uint8_t addr);
|
|||
void ckled2001_sw_shutdown(uint8_t addr);
|
||||
|
||||
// Registers Page Define
|
||||
#define CONFIGURE_CMD_PAGE 0xFD
|
||||
#define LED_CONTROL_PAGE 0x00
|
||||
#define LED_PWM_PAGE 0x01
|
||||
#define FUNCTION_PAGE 0x03
|
||||
#define CURRENT_TUNE_PAGE 0x04
|
||||
#define CKLED2001_REG_CONFIGURE_CMD_PAGE 0xFD
|
||||
#define CKLED2001_LED_CONTROL_PAGE 0x00
|
||||
#define CKLED2001_LED_PWM_PAGE 0x01
|
||||
#define CKLED2001_FUNCTION_PAGE 0x03
|
||||
#define CKLED2001_CURRENT_TUNE_PAGE 0x04
|
||||
|
||||
// Function Register: address 0x00
|
||||
#define CONFIGURATION_REG 0x00
|
||||
#define MSKSW_SHUT_DOWN_MODE (0x0 << 0)
|
||||
#define MSKSW_NORMAL_MODE (0x1 << 0)
|
||||
#define CKLED2001_REG_CONFIGURATION 0x00
|
||||
#define CKLED2001_MSKSW_SHUT_DOWN_MODE (0x0 << 0)
|
||||
#define CKLED2001_MSKSW_NORMAL_MODE (0x1 << 0)
|
||||
|
||||
#define DRIVER_ID_REG 0x11
|
||||
#define CKLED2001_ID 0x8A
|
||||
#define CKLED2001_REG_DRIVER_ID 0x11
|
||||
#define CKLED2001_DRIVER_ID 0x8A
|
||||
|
||||
#define PDU_REG 0x13
|
||||
#define MSKSET_CA_CB_CHANNEL 0xAA
|
||||
#define MSKCLR_CA_CB_CHANNEL 0x00
|
||||
#define CKLED2001_REG_PDU 0x13
|
||||
#define CKLED2001_MSKSET_CA_CB_CHANNEL 0xAA
|
||||
#define CKLED2001_MSKCLR_CA_CB_CHANNEL 0x00
|
||||
|
||||
#define SCAN_PHASE_REG 0x14
|
||||
#define MSKPHASE_12CHANNEL 0x00
|
||||
#define MSKPHASE_11CHANNEL 0x01
|
||||
#define MSKPHASE_10CHANNEL 0x02
|
||||
#define MSKPHASE_9CHANNEL 0x03
|
||||
#define MSKPHASE_8CHANNEL 0x04
|
||||
#define MSKPHASE_7CHANNEL 0x05
|
||||
#define MSKPHASE_6CHANNEL 0x06
|
||||
#define MSKPHASE_5CHANNEL 0x07
|
||||
#define MSKPHASE_4CHANNEL 0x08
|
||||
#define MSKPHASE_3CHANNEL 0x09
|
||||
#define MSKPHASE_2CHANNEL 0x0A
|
||||
#define MSKPHASE_1CHANNEL 0x0B
|
||||
#define CKLED2001_REG_SCAN_PHASE 0x14
|
||||
#define CKLED2001_MSKPHASE_12CHANNEL 0x00
|
||||
#define CKLED2001_MSKPHASE_11CHANNEL 0x01
|
||||
#define CKLED2001_MSKPHASE_10CHANNEL 0x02
|
||||
#define CKLED2001_MSKPHASE_9CHANNEL 0x03
|
||||
#define CKLED2001_MSKPHASE_8CHANNEL 0x04
|
||||
#define CKLED2001_MSKPHASE_7CHANNEL 0x05
|
||||
#define CKLED2001_MSKPHASE_6CHANNEL 0x06
|
||||
#define CKLED2001_MSKPHASE_5CHANNEL 0x07
|
||||
#define CKLED2001_MSKPHASE_4CHANNEL 0x08
|
||||
#define CKLED2001_MSKPHASE_3CHANNEL 0x09
|
||||
#define CKLED2001_MSKPHASE_2CHANNEL 0x0A
|
||||
#define CKLED2001_MSKPHASE_1CHANNEL 0x0B
|
||||
|
||||
#define SLEW_RATE_CONTROL_MODE1_REG 0x15
|
||||
#define MSKPWM_DELAY_PHASE_ENABLE 0x04
|
||||
#define MSKPWM_DELAY_PHASE_DISABLE 0x00
|
||||
#define CKLED2001_REG_SLEW_RATE_CONTROL_MODE1 0x15
|
||||
#define CKLED2001_MSKPWM_DELAY_PHASE_ENABLE 0x04
|
||||
#define CKLED2001_MSKPWM_DELAY_PHASE_DISABLE 0x00
|
||||
|
||||
#define SLEW_RATE_CONTROL_MODE2_REG 0x16
|
||||
#define MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE 0xC0
|
||||
#define MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_DISABLE 0x00
|
||||
#define CKLED2001_REG_SLEW_RATE_CONTROL_MODE2 0x16
|
||||
#define CKLED2001_MSKDRIVING_SINKING_CHANNEL_SLEWRATE_ENABLE 0xC0
|
||||
#define CKLED2001_MSKDRIVING_SINKING_CHANNEL_SLEWRATE_DISABLE 0x00
|
||||
|
||||
#define OPEN_SHORT_ENABLE_REG 0x17
|
||||
#define MSKOPEN_DETECTION_ENABLE (0x01 << 7)
|
||||
#define MSKOPEN_DETECTION_DISABLE (0x00)
|
||||
#define CKLED2001_REG_OPEN_SHORT_ENABLE 0x17
|
||||
#define CKLED2001_MSKOPEN_DETECTION_ENABLE (0x01 << 7)
|
||||
#define CKLED2001_MSKOPEN_DETECTION_DISABLE (0x00)
|
||||
|
||||
#define MSKSHORT_DETECTION_ENABLE (0x01 << 6)
|
||||
#define MSKSHORT_DETECTION_DISABLE (0x00)
|
||||
#define CKLED2001_MSKSHORT_DETECTION_ENABLE (0x01 << 6)
|
||||
#define CKLED2001_MSKSHORT_DETECTION_DISABLE (0x00)
|
||||
|
||||
#define OPEN_SHORT_DUTY_REG 0x18
|
||||
#define OPEN_SHORT_FLAG_REG 0x19
|
||||
#define CKLED2001_REG_OPEN_SHORT_DUTY 0x18
|
||||
#define CKLED2001_REG_OPEN_SHORT_FLAG 0x19
|
||||
|
||||
#define MSKOPEN_DETECTION_INTERRUPT_ENABLE (0x01 << 7)
|
||||
#define MSKOPEN_DETECTION_INTERRUPT_DISABLE (0x00)
|
||||
#define CKLED2001_MSKOPEN_DETECTION_INTERRUPT_ENABLE (0x01 << 7)
|
||||
#define CKLED2001_MSKOPEN_DETECTION_INTERRUPT_DISABLE (0x00)
|
||||
|
||||
#define MSKSHORT_DETECTION_INTERRUPT_ENABLE (0x01 << 6)
|
||||
#define MSKSHORT_DETECTION_INTERRUPT_DISABLE (0x00)
|
||||
#define CKLED2001_MSKSHORT_DETECTION_INTERRUPT_ENABLE (0x01 << 6)
|
||||
#define CKLED2001_MSKSHORT_DETECTION_INTERRUPT_DISABLE (0x00)
|
||||
|
||||
#define SOFTWARE_SLEEP_REG 0x1A
|
||||
#define MSKSLEEP_ENABLE 0x02
|
||||
#define MSKSLEEP_DISABLE 0x00
|
||||
#define CKLED2001_REG_SOFTWARE_SLEEP 0x1A
|
||||
#define CKLED2001_MSKSLEEP_ENABLE 0x02
|
||||
#define CKLED2001_MSKSLEEP_DISABLE 0x00
|
||||
|
||||
// LED Control Registers
|
||||
#define LED_CONTROL_ON_OFF_FIRST_ADDR 0x0
|
||||
#define LED_CONTROL_ON_OFF_LAST_ADDR 0x17
|
||||
#define LED_CONTROL_ON_OFF_LENGTH ((LED_CONTROL_ON_OFF_LAST_ADDR - LED_CONTROL_ON_OFF_FIRST_ADDR) + 1)
|
||||
#define CKLED2001_LED_CONTROL_ON_OFF_FIRST_ADDR 0x0
|
||||
#define CKLED2001_LED_CONTROL_ON_OFF_LAST_ADDR 0x17
|
||||
#define CKLED2001_LED_CONTROL_ON_OFF_LENGTH ((CKLED2001_LED_CONTROL_ON_OFF_LAST_ADDR - CKLED2001_LED_CONTROL_ON_OFF_FIRST_ADDR) + 1)
|
||||
|
||||
#define LED_CONTROL_OPEN_FIRST_ADDR 0x18
|
||||
#define LED_CONTROL_OPEN_LAST_ADDR 0x2F
|
||||
#define LED_CONTROL_OPEN_LENGTH ((LED_CONTROL_OPEN_LAST_ADDR - LED_CONTROL_OPEN_FIRST_ADDR) + 1)
|
||||
#define CKLED2001_LED_CONTROL_OPEN_FIRST_ADDR 0x18
|
||||
#define CKLED2001_LED_CONTROL_OPEN_LAST_ADDR 0x2F
|
||||
#define CKLED2001_LED_CONTROL_OPEN_LENGTH ((CKLED2001_LED_CONTROL_OPEN_LAST_ADDR - CKLED2001_LED_CONTROL_OPEN_FIRST_ADDR) + 1)
|
||||
|
||||
#define LED_CONTROL_SHORT_FIRST_ADDR 0x30
|
||||
#define LED_CONTROL_SHORT_LAST_ADDR 0x47
|
||||
#define LED_CONTROL_SHORT_LENGTH ((LED_CONTROL_SHORT_LAST_ADDR - LED_CONTROL_SHORT_FIRST_ADDR) + 1)
|
||||
#define CKLED2001_LED_CONTROL_SHORT_FIRST_ADDR 0x30
|
||||
#define CKLED2001_LED_CONTROL_SHORT_LAST_ADDR 0x47
|
||||
#define CKLED2001_LED_CONTROL_SHORT_LENGTH ((CKLED2001_LED_CONTROL_SHORT_LAST_ADDR - CKLED2001_LED_CONTROL_SHORT_FIRST_ADDR) + 1)
|
||||
|
||||
#define LED_CONTROL_PAGE_LENGTH 0x48
|
||||
#define CKLED2001_LED_CONTROL_PAGE_LENGTH 0x48
|
||||
|
||||
// LED Control Registers
|
||||
#define LED_PWM_FIRST_ADDR 0x00
|
||||
#define LED_PWM_LAST_ADDR 0xBF
|
||||
#define LED_PWM_LENGTH 0xC0
|
||||
#define CKLED2001_LED_PWM_FIRST_ADDR 0x00
|
||||
#define CKLED2001_LED_PWM_LAST_ADDR 0xBF
|
||||
#define CKLED2001_LED_PWM_LENGTH 0xC0
|
||||
|
||||
// Current Tune Registers
|
||||
#define LED_CURRENT_TUNE_FIRST_ADDR 0x00
|
||||
#define LED_CURRENT_TUNE_LAST_ADDR 0x0B
|
||||
#define LED_CURRENT_TUNE_LENGTH 0x0C
|
||||
#define CKLED2001_LED_CURRENT_TUNE_FIRST_ADDR 0x00
|
||||
#define CKLED2001_LED_CURRENT_TUNE_LAST_ADDR 0x0B
|
||||
#define CKLED2001_LED_CURRENT_TUNE_LENGTH 0x0C
|
||||
|
||||
#define A_1 0x00
|
||||
#define A_2 0x01
|
||||
|
@ -334,4 +362,4 @@ void ckled2001_sw_shutdown(uint8_t addr);
|
|||
#define L_13 0xBC
|
||||
#define L_14 0xBD
|
||||
#define L_15 0xBE
|
||||
#define L_16 0xBF
|
||||
#define L_16 0xBF
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue