/****************************************************************************
**	Filename  : key_digital_driver
**	Project   :
**	Module	  :
**	Processor :
**	Date/Time :
**	Abstract  :
**	Contents  :
**	Author	  : mingyea
**	http	  :
**	mail	  :
**	--------------------------------------------------------------------------
**
**	--------------------------------------------------------------------------
*****************************************************************************/
#ifndef _KEY_COM_CFG_H_
#define _KEY_COM_CFG_H_

#include "common_types.h"
#include "Cpu.h"
#include "gpio.h"
#include "common_cfg.h"

/*****************************************************************************
* Include Files
*****************************************************************************/

/*****************************************************************************
* Defines
*****************************************************************************/
//单片机平台
#if 0
typedef GPIO_PinType pins_channel_type_t ;
typedef GPIO_LevelType gpio_output_level_e;
#else

#if 0
#ifndef pins_channel_type_t
#define  pins_channel_type_t   GPIO_PinType
#endif

#ifndef gpio_output_level_e
#define  gpio_output_level_e   GPIO_LevelType
#endif
#endif

#endif

#define KEY_TIME_UNIT 10u   //任务调度的时间


/***各种按键的时间配置部分******/

#if 0
#define KEY_DIGITAL_DRIVER_DEBOUNCE_TIME  (30u/KEY_DIGITAL_DRIVER_TIME_UNIT)   //按键检测的消抖
#define KEY_DIGITAL_DRIVER_LONG_DOWN_TIME  (20000u/KEY_DIGITAL_DRIVER_TIME_UNIT)   //按键检测的長按
#define KEY_DIGITAL_DRIVER_STICK_TIME  (90000u/KEY_DIGITAL_DRIVER_TIME_UNIT)   //按键检测的卡住
#endif

#define KEY_DIGITAL_DRIVER_TIME_UNIT  KEY_TIME_UNIT   //按键检测的周期

#define KEY_DIGITAL_DITHERING_TIME		(30u/KEY_DIGITAL_DRIVER_TIME_UNIT)					/*5*10 50MS  去抖时间*/
#define KEY_DIGITAL_LONGDOWN_TIMEOUT 		(1000u/KEY_DIGITAL_DRIVER_TIME_UNIT)
#define KEY_DIGITAL_VOLICE_LONGDOWN_TIMEOUT 		(600u/KEY_DIGITAL_DRIVER_TIME_UNIT)
#define KEY_STUCK_TIMEOUT_20S 		(20000u/KEY_DIGITAL_DRIVER_TIME_UNIT)
#define KEY_STUCK_TIMEOUT_5MIN 		(300000u/KEY_DIGITAL_DRIVER_TIME_UNIT)

#define KEY_DIGITAL_FAULT_TIMEOUT 		(300u/KEY_DIGITAL_DRIVER_TIME_UNIT)

#define KEY_ADC_TIME_UNIT  KEY_TIME_UNIT   //時間周期
#define KEY_ADC_DEBOUNCE_TIME  (50u/KEY_ADC_TIME_UNIT)
#define KEY_ADC_LONGPRESS_TIME (1000u/KEY_ADC_TIME_UNIT)
#define KEY_ADC_STICKPRESS_TIME  (300000u/KEY_ADC_TIME_UNIT)
#define KEY_ADC_FAULT_TIME  (300u/KEY_ADC_TIME_UNIT)
#define KEY_ADC_OTHER_FAULT_TIME  (1000u/KEY_ADC_TIME_UNIT)

#define KEY_ADC_MEDIA_STICKPRESS_TIME  (20000u/KEY_ADC_TIME_UNIT)

#define KEY_PICK_STICKPRESS_TIME 		(20000u/KEY_DIGITAL_DRIVER_TIME_UNIT)



#define KEY_DIGITAL_DITHERING_TIME_ID  0u
#define KEY_DIGITAL_LONGDOWN_TIMEOUT_ID  (KEY_DIGITAL_DITHERING_TIME_ID+1u)
#define KEY_DIGITAL_STUCK_TIMEOUT_ID  (KEY_DIGITAL_LONGDOWN_TIMEOUT_ID+1u)
#define KEY_DIGITAL_FAULT_TIMEOUT_ID  (KEY_DIGITAL_STUCK_TIMEOUT_ID+1u)

#define KEY_ADC_DEBOUNCE_TIME_ID  (KEY_DIGITAL_FAULT_TIMEOUT_ID+1u)
#define KEY_ADC_LONGPRESS_TIME_ID  (KEY_ADC_DEBOUNCE_TIME_ID+1u)
#define KEY_ADC_STICKPRESS_TIME_ID  (KEY_ADC_LONGPRESS_TIME_ID+1u)
#define KEY_ADC_FAULT_TIME_ID  (KEY_ADC_STICKPRESS_TIME_ID+1u)
#define KEY_ADC_OTHER_FAULT_TIME_ID  (KEY_ADC_FAULT_TIME_ID+1u)


#define KEY_TIME_CFG_ID_TOTAL  (KEY_ADC_OTHER_FAULT_TIME_ID+1u)


extern const u16 g_key_cfg_times[KEY_TIME_CFG_ID_TOTAL];

/*extern */
#endif /* end __KEY_H */
/*****************************************************************************
**                            End Of File
******************************************************************************/
