📄 getportbit.c
字号:
/*****************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** +++ *** *
* *** + + *** *
* *** + CHIPCON CC1010 *
* *** + + *** HAL - GetPortBit *
* *** +++ *** *
* *** *** *
* *********** *
* ********* *
* *
*****************************************************************************
* *
*****************************************************************************
* Author: ROH *
*****************************************************************************
* Revision history: *
* *
* $Log: GetPortBit.c,v $
* Revision 1.1 2002/10/14 13:04:32 tos
* Initial version in CVS.
*
* *
****************************************************************************/
#include <chipcon/hal.h>
//----------------------------------------------------------------------------
// Functions which allow procedural or indirect access to ports.
// Sets and gets data bitwise
byte halGetPortBit(byte portNum, byte bitNum) {
byte mask=(1<<bitNum);
switch (portNum) {
case 0: return !!(P0&mask);
case 1: return !!(P1&mask);
case 2: return !!(P2&mask);
case 3: return !!(P3&mask);
default: return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -