#ifndef _U_LIGHT_CTRL_H_
#define _U_LIGHT_CTRL_H_
#include "u_global.h"
#include "u_main.h"

//enum _rc_code//ԭ���������������õ� 24 ������
//{
//	RC_CODE_UP			  	= 0x90,
//	RC_CODE_DOWN		  	= 0xB8,
//	RC_CODE_OFF			  	= 0xF8,
//	RC_CODE_ON			  	= 0xB0,
//	
//	RC_CODE_W			    	= 0xA8,
//	RC_CODE_FLASH		  	= 0xB2,
//	RC_CODE_STROBE			= 0x00,
//	RC_CODE_FADE		  	= 0x58,
//	RC_CODE_SMOOTH			= 0x30,
//	
//	RC_CODE_COLOR_R			= 0x98,	
//	RC_CODE_COLOR_G			= 0xD8,			
//	RC_CODE_COLOR_B			= 0x88,		
//				
//	RC_CODE_COLOR_1			= 0xE8,			
//	RC_CODE_COLOR_2			= 0x48,		
//	RC_CODE_COLOR_3			= 0x68,
//	
//	RC_CODE_COLOR_4			= 0x02,		
//	RC_CODE_COLOR_5			= 0x32,			
//	RC_CODE_COLOR_6			= 0x20,
//	
//	RC_CODE_COLOR_7			= 0x50,			
//	RC_CODE_COLOR_8			= 0x78,			
//	RC_CODE_COLOR_9			= 0x70,
//	
//	RC_CODE_COLOR_10		= 0x38,		
//	RC_CODE_COLOR_11		= 0x28,		
//	RC_CODE_COLOR_12		= 0xF0,
//};

enum _rc_code// 
{
	RC_CODE_UP			  	= 0x00,
	RC_CODE_DOWN		  	= 0x80,
	RC_CODE_OFF			  	= 0x40,
	RC_CODE_ON			  	= 0xC0,
	
	RC_CODE_W			    	= 0xE0,
	RC_CODE_FLASH		  	= 0xD0,
	RC_CODE_STROBE			= 0xF0,
	RC_CODE_FADE		  	= 0xC8,
	RC_CODE_SMOOTH			= 0xE8,
	
	RC_CODE_COLOR_R			= 0x20,	
	RC_CODE_COLOR_G			= 0xA0,			
	RC_CODE_COLOR_B			= 0x60,		
				
	RC_CODE_COLOR_1			= 0x10,			//��Ӧ����ң����12��������ɫֵ
	RC_CODE_COLOR_2			= 0x90,		
	RC_CODE_COLOR_3			= 0x50,
	
	RC_CODE_COLOR_4			= 0x30,		
	RC_CODE_COLOR_5			= 0xB0,			
	RC_CODE_COLOR_6			= 0x70,
	
	RC_CODE_COLOR_7			= 0x08,			
	RC_CODE_COLOR_8			= 0x88,			
	RC_CODE_COLOR_9			= 0x48,
	
	RC_CODE_COLOR_10		= 0x28,		
	RC_CODE_COLOR_11		= 0xA8,		
	RC_CODE_COLOR_12		= 0x68,
};
enum _rc_code_20 
{
	RC_CODE_UP_20				  = 0x00,
	RC_CODE_DOWN_20			      = 0x80,
	RC_CODE_OFF_20			      = 0xC0,
	RC_CODE_ON_20				  = 0x40,
	
	RC_CODE_COLOR_R_20	      	  = 0x20,	
	RC_CODE_COLOR_G_20	      	  = 0xA0,
	RC_CODE_COLOR_B_20	          = 0x60,		
	RC_CODE_W_20				  = 0xE0,
					
	RC_CODE_COLOR_ORANGE_20		  = 0x10,			
	RC_CODE_COLOR_YELLOW_20		  = 0x90,		
	RC_CODE_COLOR_CYAN_20			= 0x50,
	RC_CODE_COLOR_PURPLE_20		  = 0xD0,	

	
	RC_CODE_JUMP3_20			  = 0x30,			
	RC_CODE_JUMP7_20		      = 0xB0,
	RC_CODE_FADE3_20		      = 0x70,		
	RC_CODE_FADE7_20			  = 0xF0,	
	
	RC_CODE_MUSIC1_20		      = 0x08,
	RC_CODE_MUSIC2_20			  = 0x88,
	RC_CODE_MUSIC3_20			  = 0x48,
	RC_CODE_MUSIC4_20			  = 0xC8,
};

enum //_rc_mode
{
	RC_MODE_COLOR_MIN	= 0,
	RC_MODE_COLOR_R		= RC_MODE_COLOR_MIN,
	RC_MODE_COLOR_G,			
	RC_MODE_COLOR_B,		
	RC_MODE_COLOR_W,
	
	RC_MODE_COLOR_1,
	RC_MODE_COLOR_2,
	RC_MODE_COLOR_3,
	RC_MODE_COLOR_4,
	RC_MODE_COLOR_5,
	RC_MODE_COLOR_6,
	RC_MODE_COLOR_7,
	RC_MODE_COLOR_8,
	RC_MODE_COLOR_9,
	RC_MODE_COLOR_10,
	RC_MODE_COLOR_11,
	RC_MODE_COLOR_12,
	
	RC_MODE_FLASH,
	RC_MODE_STROBE,
	RC_MODE_FADE,
	RC_MODE_SMOOTH,
	
  	RC_CODE_FADE7,
	RC_CODE_FADE3,
	RC_CODE_JUMP3,
	RC_CODE_JUMP7,
	
	RC_MODE_RHYTM_MUSIC1,
	RC_MODE_RHYTM_MUSIC2,
	RC_MODE_RHYTM_MUSIC3,
	RC_MODE_RHYTM_MUSIC4,
};

typedef enum //_rc_mode_switch_dir
{
	RC_MODE_SHITCH_KEEP,
	RC_MODE_SHITCH_PLUS,
	RC_MODE_SHITCH_SUBT,
	
}RcModeDir_t;

void light_param_init(void);
void light_power_set(uint8_t set_state);

void ctrl_light_speed_ctrl(uint8_t light_speed);
void light_speed_ctrl(uint8_t light_speed);
void light_bright_ctrl(uint8_t light_bright);
void light_rhythm_enter(uint8_t rhythm_mode);
void rc_mode_enter(uint8_t rc_mode);

void ir_decode(const uint8_t *ir_code);
uint8_t rgb_line_order_check(void);

void light_info_save_set(void);
void light_info_save(void);
void light_flash_save_cb(void);
void light_info_init(void);
#endif	//_U_LIGHT_CTRL_H_