30 printf(
"Note: port prefix is optional\n"
31 "port read pins [A-D]\n"
32 "port read latch [A-D]\n"
33 "port read ddr [A-D]\n"
34 "port write latch [A-D] val\n"
35 "port write pins [A-D] val\n"
55 if(
MATCH(ptr,
"port") )
58 if ( !ptr ||
MATCH(ptr,
"help") )
65 if(
MATCHI(argv[ind],
"read") )
67 if(
MATCHI(argv[ind+1],
"pins") )
69 if(
MATCHI(argv[ind+2],
"A"))
71 printf(
"Port pins A RD:[%02XH]\n", 0xff & GPIO_PORT_PINS_RD(PORTA) );
74 if(
MATCHI(argv[ind+2],
"B"))
76 printf(
"Port pins B RD:[%02XH]\n", 0xff & GPIO_PORT_PINS_RD(PORTB) );
79 if(
MATCHI(argv[ind+2],
"C"))
81 printf(
"Port pins C RD:[%02XH]\n", 0xff & GPIO_PORT_PINS_RD(PORTC) );
84 if(
MATCHI(argv[ind+2],
"D"))
86 printf(
"Port pins D RD:[%02XH]\n", 0xff & GPIO_PORT_PINS_RD(PORTD) );
90 if(
MATCHI(argv[ind+1],
"latch") )
92 if(
MATCHI(argv[ind+2],
"A"))
94 printf(
"Port latch A RD:[%02XH]\n", 0xff & GPIO_PORT_LATCH_RD(PORTA) );
97 if(
MATCHI(argv[ind+2],
"B"))
99 printf(
"Port latch B RD:[%02XH]\n", 0xff & GPIO_PORT_LATCH_RD(PORTB) );
102 if(
MATCHI(argv[ind+2],
"C"))
104 printf(
"Port latch C RD:[%02XH]\n", 0xff & GPIO_PORT_LATCH_RD(PORTC) );
107 if(
MATCHI(argv[ind+2],
"D"))
109 printf(
"Port latch D RD:[%02XH]\n", 0xff & GPIO_PORT_LATCH_RD(PORTD) );
113 if(
MATCHI(argv[ind+1],
"ddr") )
115 if(
MATCHI(argv[ind+2],
"A"))
117 printf(
"Port ddr A RD:[%02XH]\n", 0xff & GPIO_PORT_DDR_RD(PORTA) );
120 if(
MATCHI(argv[ind+2],
"B"))
122 printf(
"Port ddr B RD:[%02XH]\n", 0xff & GPIO_PORT_DDR_RD(PORTB) );
125 if(
MATCHI(argv[ind+2],
"C"))
127 printf(
"Port ddr C RD:[%02XH]\n", 0xff & GPIO_PORT_DDR_RD(PORTC) );
130 if(
MATCHI(argv[ind+2],
"D"))
132 printf(
"Port ddr D RD:[%02XH]\n", 0xff & GPIO_PORT_DDR_RD(PORTD) );
139 if(
MATCHI(argv[ind],
"write") )
142 if(
MATCHI(argv[ind+1],
"pins") )
146 if(
MATCHI(argv[ind+2],
"A"))
148 GPIO_PORT_WR(PORTA,val);
151 if(
MATCHI(argv[ind+2],
"B"))
153 GPIO_PORT_WR(PORTB,val);
156 if(
MATCHI(argv[ind+2],
"C"))
158 GPIO_PORT_WR(PORTC,val);
161 if(
MATCHI(argv[ind+2],
"D"))
163 GPIO_PORT_WR(PORTD,val);
167 if(
MATCHI(argv[ind+1],
"latch") )
172 if(
MATCHI(argv[ind+2],
"A"))
174 GPIO_PORT_LATCH_WR(PORTA,val);
177 if(
MATCHI(argv[ind+2],
"B"))
179 GPIO_PORT_LATCH_WR(PORTB,val);
182 if(
MATCHI(argv[ind+2],
"C"))
184 GPIO_PORT_LATCH_WR(PORTC,val);
187 if(
MATCHI(argv[ind+2],
"D"))
189 GPIO_PORT_LATCH_WR(PORTD,val);
193 if(
MATCHI(argv[ind+1],
"ddr") )
198 if(
MATCHI(argv[ind+2],
"A"))
200 GPIO_PORT_DDR_WR(PORTA,val);
203 if(
MATCHI(argv[ind+2],
"B"))
205 GPIO_PORT_DDR_WR(PORTB,val);
208 if(
MATCHI(argv[ind+2],
"C"))
210 GPIO_PORT_DDR_WR(PORTC,val);
213 if(
MATCHI(argv[ind+2],
"D"))
215 GPIO_PORT_DDR_WR(PORTD,val);