2 * Copyright 2010 Michael Ossmann
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street,
17 * Boston, MA 02110-1301, USA.
20 #define u8 unsigned char
21 #define u16 unsigned int
22 #define u32 unsigned long
25 * There is one channel per column of the display. The radio is tuned to one
26 * channel at a time and RSSI is displayed for that channel.
28 //#define NUM_CHANNELS 132
29 #define NUM_CHANNELS 10
32 * wide mode (default): 44 MHz on screen, 333 kHz per channel
33 * narrow mode: 6.6 MHz on screen, 50 kHz per channel
40 * short mode (default): displays RSSI >> 2
41 * tall mode: displays RSSI
46 /* vertical scrolling */
49 #define MAX_VSCROLL 208
52 /* frequencies in MHz */
53 #define DEFAULT_FREQ 915
56 #define ULTRAWIDE_STEP 20
57 #define WIDE_MARGIN 13
58 #define NARROW_MARGIN 3
59 #define ULTRAWIDE_MARGIN 42
61 /* frequency bands supported by device */
66 /* band limits in MHz */
74 /* band transition points in MHz */
78 /* VCO transition points in Hz */
79 #define MID_300 318000000
80 #define MID_400 424000000
81 #define MID_900 848000000
83 /* channel spacing in Hz */
84 #define WIDE_SPACING 199952
85 #define NARROW_SPACING 49988
86 #define ULTRAWIDE_SPACING 666504
88 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
89 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
92 /* Keeping track of all this for each channel allows us to tune faster. */
94 /* frequency setting */
99 /* frequency calibration */
104 /* signal strength */
111 void putchar(char c);
117 void set_radio_freq(u32 freq);
118 void calibrate_freq(u32 freq, u8 ch);
119 u16 set_center_freq(u16 freq);
121 void set_width(u8 w);
122 void poll_keyboard();