5 #define PIN_SWITCH(operation) switch(pinNumber) { \
6 case 0: operation(0,0); break; \
7 case 1: operation(0,1); break; \
8 case 2: operation(0,2); break; \
9 case 3: operation(0,3); break; \
10 case 4: operation(0,4); break; \
11 case 5: operation(0,5); break; \
12 case 10: operation(1,0); break; \
13 case 11: operation(1,1); break; \
14 case 12: operation(1,2); break; \
15 case 13: operation(1,3); break; \
16 case 14: operation(1,4); break; \
17 case 15: operation(1,5); break; \
18 case 16: operation(1,6); break; \
19 case 17: operation(1,7); break; \
20 case 20: operation(2,0); break; \
21 case 21: operation(2,1); break; \
22 case 22: operation(2,2); break; \
23 case 23: operation(2,3); break; \
24 case 24: operation(2,4); break; }
26 #define SET_DIGITAL_OUTPUT(port, pin) { \
27 P##port##_##pin = value; \
28 P##port##DIR |= (1<<pin); }
30 #define SET_DIGITAL_INPUT(port, pin) { \
31 if (pulled){ P##port##INP &= ~(1<<pin); } else { P##port##INP |= (1<<pin); } \
32 P##port##DIR &= ~(1<<pin); }
34 #define IS_DIGITAL_INPUT_HIGH(port, pin) { return P##port##_##pin; }
38 PIN_SWITCH(SET_DIGITAL_OUTPUT);
43 PIN_SWITCH(SET_DIGITAL_INPUT);
48 PIN_SWITCH(IS_DIGITAL_INPUT_HIGH);
54 if (pullType){ P2INP &= ~(1<<5); }
55 else { P2INP |= (1<<5); }
60 if (pullType){ P2INP &= ~(1<<6); }
61 else { P2INP |= (1<<6); }
66 if (pullType){ P2INP &= ~(1<<7); }
67 else { P2INP |= (1<<7); }
void setPort0PullType(BIT pullType) __reentrant
void setDigitalInput(uint8 pinNumber, BIT pulled) __reentrant
Configures the specified pin as an input.
void setPort1PullType(BIT pullType) __reentrant
void setDigitalOutput(uint8 pinNumber, BIT value) __reentrant
Configures the specified pin as a digital output.
BIT isPinHigh(uint8 pinNumber) __reentrant
Returns the current input or output value of the pin.
void setPort2PullType(BIT pullType) __reentrant