Date:2010-11-11 06:44:33 (8 years 7 months ago)
Author:Werner Almesberger
Commit:1e78135bf4e2249030c6ee1e1bc690b7fbec1b1f
Message:atspi-txrx: new option -f to set the channel by frequency

- atspi-txrx/atspi-txrx.c (usage): rearranged description of -T
- atspi-txrx/atspi-txrx.c (usage, main): option -f freq to specify the
channel by frequency
Files: tools/atspi-txrx/atspi-txrx.c (3 diffs)

Change Details

tools/atspi-txrx/atspi-txrx.c
191191static void usage(const char *name)
192192{
193193    fprintf(stderr,
194"usage: %s [-c channel] [-p power] [-t trim] [message [repetitions]]\n"
195" %s [-c channel] [-p power] [-t trim] -T delta\n"
194"usage: %s [-c channel|-f freq] [-p power] [-t trim] [message [repetitions]]\n"
195" %s [-c channel|-f freq] [-p power] [-t trim] -T delta\n"
196196" -c channel channel number, 11 to 26 (default %d)\n"
197" -p power transmit power, -17.2 to 3.0 dBm (default %.1f)\n"
198" -t trim trim capacitor, 0 to 15 (default 0)\n"
199" -t trim trim capacitor, 0 to 15 (default 0)\n"
200" -T delta_MHz test mode. delta_MHz is -2, -0.5, or +0.5\n"
201        , name, name, DEFAULT_CHANNEL, DEFAULT_POWER);
197" -f freq frequency in MHz, 2405 to 2480 (default %d)\n"
198" -p power transmit power, -17.2 to 3.0 dBm (default %.1f)\n"
199" -t trim trim capacitor, 0 to 15 (default 0)\n"
200" -t trim trim capacitor, 0 to 15 (default 0)\n"
201" -T delta test mode. delta is the frequency offset of the constant wave\n"
202" in MHz: -2, -0.5, or +0.5\n"
203        , name, name, DEFAULT_CHANNEL, 2405+5*(DEFAULT_CHANNEL-11),
204        DEFAULT_POWER);
202205    exit(1);
203206}
204207
...... 
210213    int trim = 0, times = 1;
211214    uint8_t cont_tx = 0;
212215    char *end;
213    int c;
216    int c, freq;
214217    struct atspi_dsc *dsc;
215218
216    while ((c = getopt(argc, argv, "c:p:t:T:")) != EOF)
219    while ((c = getopt(argc, argv, "c:f:p:t:T:")) != EOF)
217220        switch (c) {
218221        case 'c':
219222            channel = strtoul(optarg, &end, 0);
...... 
222225            if (channel < 11 || channel > 26)
223226                usage(*argv);
224227            break;
228        case 'f':
229            freq = strtoul(optarg, &end, 0);
230            if (*end)
231                usage(*argv);
232            if (freq % 5)
233                usage(*argv);
234            channel = (freq-2405)/5+11;
235            if (channel < 11 || channel > 26)
236                usage(*argv);
237            break;
225238        case 'p':
226239            power = strtod(optarg, &end);
227240            if (*end)

Archive Download the corresponding diff file



interactive