Files
CW_A5H_9225_8108/A5H_9225_8108_SPIV3.0/HY88xx/hy8602.h

251 lines
8.7 KiB
C
Raw Normal View History

2025-09-29 16:42:09 +08:00
#ifndef __HY8602_H
#define __HY8602_H
#ifdef HY8602
#define CH_NUMBERS 8
#define PWM_OFFSET 3
#define BTI_WIDTH 20
//0x42
#define PWM_TP_Pos 0
#define PWM_TP (0XFFF<<PWM_TP_Pos)
//0x48
#define DC_RANGE_Pos 0
#define DC_RANGE_24MA 0
#define DC_RANGE_48MA 1
#define DC_RANGE_72MA 2
#define DC_RANGE (DC_RANGE_72MA<<DC_RANGE_Pos)
#define OPEN_LV_Pos 2
#define OPEN_LV_50MV 0
#define OPEN_LV_80MV 1
#define OPEN_LV_100MV 2
#define OPEN_LV_130MV 3
#define OPEN_LV (OPEN_LV_80MV<<OPEN_LV_Pos)
#define RISE_FALL_Pos 6
#define RISE_FALL_TIME_0_3US 0
#define RISE_FALL_TIME_0_6US 1
#define RISE_FALL_TIME_1US 2
#define RISE_FALL_TIME_1_6US 3
#define RISE_FALL_TIME (RISE_FALL_TIME_1_6US<<RISE_FALL_Pos)
#define OPEN_DEBOUNCE_TIME_Pos 14
#define OPEN_DEBOUNCE_TIME_8_TPWM 0
#define OPEN_DEBOUNCE_TIME_16_TPWM 1
#define OPEN_DEBOUNCE_TIME_32_TPWM 2
#define OPEN_DEBOUNCE_TIME_64_TPWM 3
#define OPEN_DEBOUNCE_TIME (OPEN_DEBOUNCE_TIME_64_TPWM<<OPEN_DEBOUNCE_TIME_Pos)
//0x4A
#define OTP_LV_Pos 1
#define OTP_LV_155 0
#define OTP_LV_145 1
#define OTP_LV_135 2
#define OTP_LV_125 3
#define OTP_LV (OTP_LV_145<<OTP_LV_Pos)
#define OTP_RECOVERY_Pos 3
#define OTP_RECOVERY_135 0
#define OTP_RECOVERY_125 1
#define OTP_RECOVERY_115 2
#define OTP_RECOVERY_105 3
#define OTP_RECOVERY (OTP_RECOVERY_125<<OTP_RECOVERY_Pos)
#define SPIKE_FILTER_TIME_Pos 5
#define SPIKE_FILTER_1NS 0
#define SPIKE_FILTER_2NS 1
#define SPIKE_FILTER_TIME (SPIKE_FILTER_1NS<<SPIKE_FILTER_TIME_Pos)
#define SPIKE_FILTER_Pos 6
#define SPIKE_FILTER_BYPASS 0
#define SPIKE_FILTER_ENABLE 1
#define SPIKE_FILTER (SPIKE_FILTER_BYPASS<<SPIKE_FILTER_Pos)
#define DITHER_Pos 7
#define DITHER_NO 0
#define DITHER_1BITS 1
#define DITHER_2BITS 2
#define DITHER_3BITS 3
#define DITHER (DITHER_NO<<DITHER_Pos)
#define LED_BST_SEL_Pos 9
#define MINIMUM_BST 0
#define MIDDLE_BST 2
#define MAXINMUN_BST 3
#define LED_BST_SEL (MIDDLE_BST<<LED_BST_SEL_Pos)
#define ANALOG_MOP_Pos 11
#define ANALOG_100 0
#define ANALOG_75 1
#define ANALOG_50 2
#define ANALOG_25 3
#define ANALOG_MOP (ANALOG_100<<ANALOG_MOP_Pos)
//0x4C
#define CHANNEL_DELAY_Pos 0
#define CHANNEL_DELAY_12_TOSC 0
#define CHANNEL_DELAY_24_TOSC 1
#define CHANNEL_DELAY_40_TOSC 2
#define CHANNEL_DELAY_64_TOSC 3
#define CHANNEL_DELAY_80_TOSC 4
#define CHANNEL_DELAY_160_TOSC 5
#define CHANNEL_DELAY_320_TOSC 6
#define CHANNEL_DELAY_400_TOSC 7
#define CHANNEL_DELAY (CHANNEL_DELAY_64_TOSC<<CHANNEL_DELAY_Pos)
#define FAULT_DEGLITCH_TIME_Pos 3
#define FAULT_DEGLITCH_TIME_16_24_TOSC 0
#define FAULT_DEGLITCH_TIME_24_32_TOSC 1
#define FAULT_DEGLITCH_TIME_48_56_TOSC 2
#define FAULT_DEGLITCH_TIME_88_96_TOSC 3
#define FAULT_DEGLITCH_TIME (FAULT_DEGLITCH_TIME_24_32_TOSC<<FAULT_DEGLITCH_TIME_Pos)
#define DOS_OUTPUT_Pos 5
#define DOS_HIZ 0
#define DOS_OUTPUT 1
#define DOS_OUTPUT_MODE (DOS_OUTPUT<<DOS_OUTPUT_Pos)
#define CHANNEL_GPOUPING_Pos 6
#define CHANNEL_GROUP_NO 0
#define CHANNEL_GROUP_2_CHANNEL 1
#define CHANNEL_GROUP_4_CHANNEL 2
#define CHANNEL_GPOUPING (CHANNEL_GROUP_NO<<CHANNEL_GPOUPING_Pos)
#define PWM_ALIGN_Pos 8
#define PWM_ALIGN_HEAD 0
#define PWM_ALIGN_TAIL 1
#define PWM_ALIGN (PWM_ALIGN_HEAD<<PWM_ALIGN_Pos)
#define DC_DIM_UPDATE_Pos 9
#define DC_DIM_UPDATE_WAIT_PWM 0
#define DC_DIM_UPDATE_NO_WAIT 1
#define DC_DIM_UPDATE (DC_DIM_UPDATE_WAIT_PWM<<DC_DIM_UPDATE_Pos)
#define FAULT_BLANK_TIME_Pos 10
#define FAULT_BLANK_TIME_20_TP_PWM 0
#define FAULT_BLANK_TIME_40_TP_PWM 1
#define FAULT_BLANK_TIME_80_TP_PWM 2
#define FAULT_BLANK_TIME_160_TP_PWM 3
#define FAULT_BLANK_TIME_320_TP_PWM 4
#define FAULT_BLANK_TIME_640_TP_PWM 5
#define FAULT_BLANK_TIME_1280_TP_PWM 6
#define FAULT_BLANK_TIME_2560_TP_PWM 7
#define FAULT_BLANK_TIME (FAULT_BLANK_TIME_160_TP_PWM<<FAULT_BLANK_TIME_Pos)
#define ONE_WIRE_DEGLITCH_TIME_Pos 13
#define ONE_WIRE_DEGLITCH_TIME_1_TOSC 0
#define ONE_WIRE_DEGLITCH_TIME_2_TOSC 1
#define ONE_WIRE_DEGLITCH_TIME_3_TOSC 2
#define ONE_WIRE_DEGLITCH_TIME_4_TOSC 3
#define ONE_WIRE_DEGLITCH_TIME_5_TOSC 4
#define ONE_WIRE_DEGLITCH_TIME_8_TOSC 5
#define ONE_WIRE_DEGLITCH_TIME_16_TOSC 6
#define ONE_WIRE_DEGLITCH_TIME_32_TOSC 7
#define ONE_WIRE_DEGLITCH_TIME (ONE_WIRE_DEGLITCH_TIME_2_TOSC<<ONE_WIRE_DEGLITCH_TIME_Pos)
//0x4E
#define GM_OPTION_Pos 0
#define GM_OPTION_DEFAULT 0
#define GM_OPTION_DECREASE 1
#define GM_OPTION (GM_OPTION_DEFAULT<<GM_OPTION_Pos)
#define SHORT_LV_Pos 1
#define SHORT_LV_2V 0
#define SHORT_LV_3V 1
#define SHORT_LV_4V 2
#define SHORT_LV_5V 3
#define SHORT_LV_6V 4
#define SHORT_LV_7V 5
#define SHORT_LV_9V 6
#define SHORT_LV_12V 7
#define SHORT_LV (SHORT_LV_12V<<SHORT_LV_Pos)
//6BITS
//pwm_freq=15.728M/(N+1)
#define PWM_CLK_SEL_Pos 4
#define PWM_CLK_SEL (0<<PWM_CLK_SEL_Pos)
#define MIX_DC_LSB_Pos 10
#define MIX_DC_LSB_0 0
#define MIX_DC_LSB_1 1
#define MIX_DC_LSB (MIX_DC_LSB_0<<MIX_DC_LSB_Pos)
#define MIX_PWM_LSB_Pos 11
#define MIX_PWM_LSB_0 0
#define MIX_PWM_LSB_1 1
#define MIX_PWM_LSB (MIX_PWM_LSB_0<<MIX_PWM_LSB_Pos)
#define OPEN_DEBOUNCE_Pos 12
#define OPEN_DEBOUNCE_SEL_EOP 0
#define OPEN_DEBOUNCE_SEL_PWM 1
#define OPEN_DEBOUNCE (OPEN_DEBOUNCE_SEL_PWM<<OPEN_DEBOUNCE_Pos)
#define BFI_MODE_Pos 13
#define BFI_RESERVE_FIRST 0
#define BFI_BLANK_FIRST 1
#define BFI_MODE (BFI_RESERVE_FIRST<<BFI_MODE_Pos)
#define BFI_Pos 14
#define BFI_ENABLE 1
#define BFI_DISABLE 0
#define BFI (BFI_DISABLE<<BFI_Pos)
#define SLEEP_RECOVERY_Pos 15
#define SLEEP_RECOVERY_NO_DATA 0
#define SLEEP_RECOVERY_DIMMING_DATA 1
#define SLEEP_RECOVERY (SLEEP_RECOVERY_DIMMING_DATA<<SLEEP_RECOVERY_Pos)
//0x50
#define SHORT_DC_VALUE_Pos 0
#define SHORT_DC_VALUE (0X1<<SHORT_DC_VALUE_Pos) //
//0x52 //9BITS
#define BFI_NUMBER_Pos 0
#define BFI_NUMBER (1<<BFI_NUMBER_Pos)
//0x58
#define HEADROOM_Pos 0
#define HEADROOM_500MV 0
#define HEADROOM_600MV 1
#define HEADROOM_700MV 2
#define HEADROOM_800MV 3
#define HEADROOM_1000MV 4
#define HEADROOM_1200MV 5
#define HEADROOM_1400MV 6
#define HEADROOM_1600MV 7
#define HEADROOM (HEADROOM_1000MV<<HEADROOM_Pos)
//0x46
#define SICK_FAULT_DISABLE 0 // 0:Enable sick dection 1:Disable sick dection
#define OPEN_FALUT_DISABLE 0 // 0:Enable open dection 1:Disable open dection
#define SHORT_FAULT_DISABLE 0 // 0:Enable short dection 1:Disable short dection
#define OTP_FAULT_DISABLE 0 // 0:Enable OTP dection 1:Disable OTP dection
#define OTP_OFF_DISABLE 0 // 0:Turn off pwm when OTP 1:not turn off pwm when OTP
#define OTP_REC_DISABLE 0 // 0:recovery pwm when OTP relieve 1:not auto recovery pwm when OTP relieve
#define OPEN_OFF_DISABLE 1 // 0:turn off pwm when open fault detected 1:not turn off pwm when open fault detected
#define SHORT_OFF_DISABLE 0 // 0:turn off pwm when short fault detected 1:not turn off pwm when short fault detected
#define DIP_CRC_CHECK_DISABLE 0 // 0:enable double-wire CRC check 1:disable double-wire CRC check
#define PWM_HIGH_TIME_FAULT_DISABLE 0 // 0:enable pwm high time detect function 1:disable pwm high time detect function
#define SICK_RANGE_SEL 0 // 0:sick detection related to open 1:sick detection not related to open
#define DIS_DOS_CRC 0 // 0:enable dis-dos communication CRC check 1:disable dis-dos communication CRC check
#define CONFIG_DONE 1
#endif
#endif