IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2010-11-11 06:44:33 (9 years 1 month 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 | ||
---|---|---|
191 | 191 | static void usage(const char *name) |
192 | 192 | { |
193 | 193 | 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" | |
196 | 196 | " -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); | |
202 | 205 | exit(1); |
203 | 206 | } |
204 | 207 | |
... | ... | |
210 | 213 | int trim = 0, times = 1; |
211 | 214 | uint8_t cont_tx = 0; |
212 | 215 | char *end; |
213 | int c; | |
216 | int c, freq; | |
214 | 217 | struct atspi_dsc *dsc; |
215 | 218 | |
216 | while ((c = getopt(argc, argv, "c:p:t:T:")) != EOF) | |
219 | while ((c = getopt(argc, argv, "c:f:p:t:T:")) != EOF) | |
217 | 220 | switch (c) { |
218 | 221 | case 'c': |
219 | 222 | channel = strtoul(optarg, &end, 0); |
... | ... | |
222 | 225 | if (channel < 11 || channel > 26) |
223 | 226 | usage(*argv); |
224 | 227 | 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; | |
225 | 238 | case 'p': |
226 | 239 | power = strtod(optarg, &end); |
227 | 240 | if (*end) |