1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 06:08:27 +02:00

tools/atrf-rssi/gui.c (gui): accept keyboard input both from stdin and SDL

This commit is contained in:
Werner Almesberger 2011-07-04 20:22:53 -03:00
parent 56f8b2d038
commit 10f618ac60

View File

@ -23,6 +23,7 @@
#include "at86rf230.h" #include "at86rf230.h"
#include "atrf.h" #include "atrf.h"
#include "misctxrx.h" #include "misctxrx.h"
#include "getkey.h"
#include "zgrid.h" #include "zgrid.h"
#include "digit.h" #include "digit.h"
@ -262,6 +263,8 @@ void gui(struct atrf_dsc *dsc)
} }
atexit(SDL_Quit); atexit(SDL_Quit);
get_key_init();
surf = SDL_SetVideoMode(XRES, YRES, 0, SDL_SWSURFACE); surf = SDL_SetVideoMode(XRES, YRES, 0, SDL_SWSURFACE);
if (!surf) { if (!surf) {
fprintf(stderr, "SDL_SetVideoMode: %s\n", SDL_GetError()); fprintf(stderr, "SDL_SetVideoMode: %s\n", SDL_GetError());
@ -295,6 +298,26 @@ void gui(struct atrf_dsc *dsc)
} }
} }
switch (get_key()) {
case 'J':
case 'j':
wlan_area = area_jp;
break;
case 'E':
case 'e':
wlan_area = area_eu;
break;
case 'U':
case 'u':
wlan_area = area_us;
break;
case 'Q':
case 'q':
return;
default:
break;
}
shift_grid(z, N_CHAN, N_TIME); shift_grid(z, N_CHAN, N_TIME);
sweep(dsc, z); sweep(dsc, z);