⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util_bk.h

📁 ucosii的源代码希望能给予学习嵌入式系统的朋友一定的帮助
💻 H
字号:
/*
*			BK Project no.1 AVR Library
*
*			Start day : 2006. 04. 14.
*			File name : util_bk.c util_bk.h
*			Programer : Blue Bear.
*			version   : v0.1
*	
*			Difference between This version and before version.
*				
*			
*
*
*
*/


#ifndef __UTIL__
#define __UTIL__

#define KEYCHAT
/**************************************************************************************************
*					Define Area
**************************************************************************************************/
#define OUT7 0x80						//Set Bit 7 of Port '1'
#define OUT6 0x40						//Set Bit 6 of Port '1'
#define OUT5 0x20						//Set Bit 5 of Port '1'
#define OUT4 0x10						//Set Bit 4 of Port '1'
#define OUT3 0x08						//Set Bit 3 of Port '1'
#define OUT2 0x04						//Set Bit 2 of Port '1'
#define OUT1 0x02						//Set Bit 1 of Port '1'
#define OUT0 0x01						//Set Bit 0 of Port '1'

/**************************************************************************************************
*					SetBit(port, num)
*						Set Bit of Port High.
*					arg 1: Port Name.
*					arg 2: Port Bit Number.
*
*					ClrBit(port, num)
*						Set Bit of Port Low.
*					arg 1: Port Name. 				-> PORTD
*					arg 2: Port Bit Number.
**************************************************************************************************/
#define SetBit(port, num) port |= 0x01 << num
#define ClrBit(port, num) port &= 0xfe << num

/**************************************************************************************************
*
*					SetPort()
*						Set Port Direction and Initial value.
*					arg 1: 器飘捞抚. 				-> 'A'
*					arg 2: 器飘 规氢.		-> OUT0|OUT2|OUT7
*					arg 3: 器飘 檬扁拳 蔼.
**************************************************************************************************/
void SetPort(uint8_t , uint8_t , uint8_t);

/**************************************************************************************************
*
*					KeyChat()
*						虐 吝汗 眉农 窃荐.
*					arg 1: 虐涝仿 蔼.						-> PORTD & 0xf0
*					arg 2: 傈虐狼 蔼阑 历厘窍绰 函荐.  		-> &KeyBuff
*					arg 3: 虐狼 馆汗 冉荐甫 历厘窍绰 函荐.	-> &KeyCnt
*					arg 4: 虐 吝汗 涝仿 力茄 蔼. 			-> 9
*
*					KeyChatExt()
*						虐 吝汗 眉农 犬厘 窃荐.
*					struct __KeyChkReg
*						mem 1: 傈虐 涝仿蔼阑 历厘窍绰 函荐.
*						mem 2: 虐狼 馆汗 冉荐甫 历厘窍绰 函荐.
*						mem 3: 虐狼 吝汗 涝仿阑 力茄 窍绰 蔼.
*						mem 4: 虐 涝仿捞 绝阑 版快狼 虐蔼.
*						mem 5: 虐蔼捞 绒瓤茄 版快啊 吝汗 瞪 版快 馆汗阑 搬沥窍绰 蔼.
*					arg 1: 虐 涝仿 蔼.
*					arg 2: struct __KeyChkReg pointer variable.
**************************************************************************************************/
uint8_t KeyChat(uint8_t KeyReg, uint8_t *pKeyBuff, uint8_t *pKeyCnt, uint8_t ChatCnt);

typedef struct __KeyChkReg{
	uint8_t KeyBuff;						//befor key value Store fild
	uint8_t KeyCnt;							//overlap input store fild
	uint8_t ChatCnt;						//limit to overlap input
	uint8_t DefValue;						//default key value
	uint8_t KeyOverlap;						//reacation value for repeat.
}KeyChkReg;

uint8_t KeyChatExt(uint8_t KeyReg, KeyChkReg *psKeyChkReg);

#endif //__UTIL__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -