Hardware Reference
In-Depth Information
167 rc = tcgetattr(tty,&sv_ios); /
Save current settings
/
168 assert(!rc);
169 ios = sv_ios;
170 cfmakeraw(&ios); /
Make into a raw config
/
171 ios.c_oflag = OPOST | ONLCR; /
Keep output editing
/
172 rc = tcsetattr(tty,TCSAFLUSH,& ios); /
Put terminal into
raw mode
/
173 assert(!rc);
174
175 gpio_init(); /
Initialize GPIO access
/
176 drive(0); /
Turn off output
/
177 for ( x=0; x<4; ++x )
178 gpio_config(gpios[x],Output); /
Set GPIO pin as Output
/
179
180 help();
181
182 set_mode(drive_mode);
183 printf("Step time: %6.3f seconds\n",step_time);
184
185 while ( !quit ) {
186 write(1," : ",2);
187 rc = read(tty,&ch,1); /
Read char
/
188 if ( rc != 1 )
189 break;
190 if ( islower(ch) )
191 ch = toupper(ch);
192
193 write(1,&ch,1);
194 write(1,"\n",1);
195
196 switch ( ch ) {
197 case 'Q': /
Quit
/
198 quit = 1;
199 break;
200 case '<' : /
Go slower
/
201 step_time
= 2.0;
202 printf ("Step time : %6.3 f seconds \n",
step_time);
203 break;
204 case '>': /
Go faster
/
205 step_time /= 2.0;
206 printf ("Step time: %6.3 f seconds \n",
step_time);
207 break;
208 case '?': /
Provide help
/
209 case 'H':
210 help ();
Search WWH ::




Custom Search