19 lines
284 B
C
19 lines
284 B
C
|
|
||
|
#include "mc8051fun.h"
|
||
|
|
||
|
int getpin(i8051pin_T *pin)
|
||
|
{
|
||
|
switch(pin->port){
|
||
|
case 0:
|
||
|
return P0 & (1<<(pin->pin)) ? 1:0;
|
||
|
case 1:
|
||
|
return P1 & (1<<(pin->pin)) ? 1:0;
|
||
|
case 2:
|
||
|
return P2 & (1<<(pin->pin)) ? 1:0;
|
||
|
case 3:
|
||
|
return P3 & (1<<(pin->pin)) ? 1:0;
|
||
|
}
|
||
|
|
||
|
return 1;
|
||
|
}
|