Hardware Reference
In-Depth Information
236 rc = read(tty,&ch,1);
237 if ( rc != 1 )
238 break;
239 if ( islower (ch) )
240 ch = toupper(ch);
241
242 write(1,&ch,1);
243 write(1,"\n",1);
244
245 /*
246 * Process command char :
247 */
248 switch ( ch ) {
249 case '1' : /* One phase mode */
250 stop_cmd();
251 set_mode(0);
252 break;
253 case '2' : /* Two phase mode */
254 stop_cmd();
255 set_mode(1);
256 break;
257 case '3' : /* Half step mode */
258 stop_cmd();
259 set_mode(2);
260 break;
261 case '<' : /* Make steps slower */
262 step_time *= 2.0;
263 printf("Step time is now %.3f ms\n",step_
time*1000.0);
264 break;
265 case '>' : /* Make steps faster */
266 step_time /= 2.0;
267 printf("Step time is now %.3f ms\n",step_
time*1000.0);
268 break;
269 case 'F' : /* Forward : run motor */
270 if ( !stopped && lcmd != 'R' ) {
271 stop_cmd(); /* Stop due to toggle */
272 lcmd = 0;
273 } else {
274 op_cmd(); /* Stop prior to change direction */
275 queue_cmd(lcmd='F');
276 }
277 break;
278 case 'R' : /* Reverse : run motor */
Search WWH ::




Custom Search