Date:2010-11-09 17:53:04 (8 years 10 months ago)
Author:Werner Almesberger
Commit:256da91e0407b82ad12aa63673c58d164ed2403b
Message:atspi-rssid: for color and geometry, use #defines instead of literals

- atspi-rssid/gui.c (sweep, label_channels): moved geometry values to
#defines
- atspi-rssid/gui.c (CBIG, CSMALL, label_channels): moved color values to
#defines
Files: tools/atspi-rssi/gui.c (4 diffs)

Change Details

tools/atspi-rssi/gui.c
3636#define N_TIME 64
3737
3838
39#define FG_RGBA 0xffffff00 /* grid foreround color */
40#define BG_RGBA 0x00408080 /* grid background color */
41#define CHAN_RGBA 0xff4040ff /* channel number color */
42#define FREQ_RGBA 0x20ff00ff /* frequency color */
43
44#define X_STEP 17 /* grid x step */
45#define Y_STEP 2 /* grid y step */
46#define Z_STEP 3 /* z multiplier */
47#define X_STEP_Y 1 /* x shift for each y step */
48#define X_OFFSET 7 /* x coordinate of lower left grid corner */
49#define Y_OFFSET 40 /* y coordinate of lower left grid corner */
50
51
3952static struct timeval t0;
4053
4154
...... 
6376        /* 150 us, according to AVR2001 section 3.5 */
6477        wait_for_interrupt(dsc, IRQ_PLL_LOCK, IRQ_PLL_LOCK, 10, 20);
6578
66        *z++ = 3*atspi_reg_read(dsc, REG_PHY_RSSI) & RSSI_MASK;
79        *z++ = Z_STEP*atspi_reg_read(dsc, REG_PHY_RSSI) & RSSI_MASK;
6780#if 0
6881        if (chan >= 13 && chan <= 19 )
6982            z[-1] = 3*28-(chan-16)*(chan-16)*(chan-16)*(chan-16);
...... 
7992
8093
8194#define CBIG(pos) \
82    x-5+(pos)*6, x-1+(pos)*6, y+8, y+4, y, 0xff4040ff
95    x-5+(pos)*6, x-1+(pos)*6, y+8, y+4, y, CHAN_RGBA
8396#define CSMALL(pos) \
84    x-7+(pos)*4, x-5+(pos)*4, y+15, y+13, y+11, 0x20ff00ff
97    x-7+(pos)*4, x-5+(pos)*4, y+15, y+13, y+11, FREQ_RGBA
8598
8699
87100static void label_channels(SDL_Surface *s, int sx, int x0, int y0)
...... 
142155
143156        clear(surf);
144157        zgrid_draw(surf, z, N_CHAN, N_TIME,
145            17, 2, 1,
146            7, 40,
147            0xffffff00, 0x00408080);
148        label_channels(surf, 17, 7, 40);
158            X_STEP, Y_STEP, X_STEP_Y,
159            X_OFFSET, Y_OFFSET,
160            FG_RGBA, BG_RGBA);
161        label_channels(surf, X_STEP, X_OFFSET, Y_OFFSET);
149162
150163        SDL_UnlockSurface(surf);
151164        SDL_UpdateRect(surf, 0, 0, 0, 0);

Archive Download the corresponding diff file



interactive