CH552/projects/examples/TouchKey/TouchKey.H

50 lines
2.6 KiB
C++
Raw Normal View History

2018-10-17 10:44:45 +02:00
#define INTERRUPT_TouchKey 0 //<2F><><EFBFBD><EFBFBD>TouchKey<65>жϷ<D0B6>ʽ
#define KEY_FIRST 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼͨ<CABC><CDA8>
#define KEY_LAST 3 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>
#define KEY_ACT 20 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȸߣ<C8B8><DFA3><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD>
#define KEY_BASE_SAMPLE_TIME 5 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼ֵ<D7BC><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ȡ<EFBFBD><C8A1><EFBFBD>ȶ<EFBFBD><C8B6><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>׼ֵ
extern UINT16 KeyFree[KEY_LAST-KEY_FIRST+1]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD>ڱȽϰ<C8BD><CFB0><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵС<D6B5>ڻ<EFBFBD>׼ֵ<D7BC><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
extern UINT8V KeyBuf; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϊ0<CEAA><30>ʾ<EFBFBD>ް<EFBFBD><DEB0><EFBFBD><EFBFBD><EFBFBD>Ϊ1<CEAA><31>ʾ<EFBFBD><CABE>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><E2B0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define TouchKeyOFF() {TKEY_CTRL &= 0xF8;} //<2F>رյ<D8B1><D5B5>ݼ<EFBFBD><DDBC><EFBFBD><E2A3AC><EFBFBD><EFBFBD>1ms<6D><73><EFBFBD><EFBFBD>2ms<6D><73>ʱ<EFBFBD>ж<EFBFBD>
#define TouchKeyON_NoChannel() {TKEY_CTRL = TKEY_CTRL & 0xF8 | 7;} //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><E2A3AC><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>
#define TouchKeyQueryCyl1ms() {TKEY_CTRL &= ~bTKC_2MS;} //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ms
#define TouchKeyQueryCyl2ms() {TKEY_CTRL |= bTKC_2MS;} //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2ms
/*******************************************************************************
* Function Name : TouchKeyChannelSelect(UINT8 ch)
* Description : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>
* Input : UINT8 ch <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>
0: <EFBFBD>رյ<EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ms<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2ms<EFBFBD><EFBFBD>ʱ<EFBFBD>ж<EFBFBD>
1~6 <EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>
7: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>
* Output : None
* Return : <EFBFBD>ɹ<EFBFBD> SUCCESS
ʧ<EFBFBD><EFBFBD> FAIL
*******************************************************************************/
UINT8 TouchKeyChannelSelect(UINT8 ch);
/*******************************************************************************
* Function Name : GetTouckKeyFreeBuf()
* Description : <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>״̬<EFBFBD><EFBFBD>ֵ
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void GetTouckKeyFreeBuf();
#if !INTERRUPT_TouchKey
/*******************************************************************************
* Function Name : TouchKeyChannelQuery()
* Description : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>ѯ
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TouchKeyChannelQuery();
#endif