From 10f618ac608b219306f062a7e453ac14fbd3df39 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 4 Jul 2011 20:22:53 -0300 Subject: [PATCH] tools/atrf-rssi/gui.c (gui): accept keyboard input both from stdin and SDL --- tools/atrf-rssi/gui.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/atrf-rssi/gui.c b/tools/atrf-rssi/gui.c index 2cc510f..bb72c1f 100644 --- a/tools/atrf-rssi/gui.c +++ b/tools/atrf-rssi/gui.c @@ -23,6 +23,7 @@ #include "at86rf230.h" #include "atrf.h" #include "misctxrx.h" +#include "getkey.h" #include "zgrid.h" #include "digit.h" @@ -262,6 +263,8 @@ void gui(struct atrf_dsc *dsc) } atexit(SDL_Quit); + get_key_init(); + surf = SDL_SetVideoMode(XRES, YRES, 0, SDL_SWSURFACE); if (!surf) { 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); sweep(dsc, z);