IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
Source at commit 8e842bab8efb0f6d40497e2f0ced4a41041ebd85 created 13 years 1 month ago. By Werner Almesberger, atusb.brd: ground zone adjustments; corrected date code location | |
---|---|
1 | /* |
2 | * atrf-rssi/atrf-rssi.c - ben-wpan AT86RF230 spectrum scan |
3 | * |
4 | * Written 2010 by Werner Almesberger |
5 | * Copyright 2010 Werner Almesberger |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | */ |
12 | |
13 | |
14 | #include <stdlib.h> |
15 | #include <stdio.h> |
16 | #include <string.h> |
17 | |
18 | #include "atrf.h" |
19 | |
20 | |
21 | static void usage(const char *name) |
22 | { |
23 | fprintf(stderr, |
24 | "usage: %s [-a|-t]\n\n" |
25 | " -a reset the MCU and transceiver\n" |
26 | " -t reset transceiver (default)\n" |
27 | , name); |
28 | exit(1); |
29 | } |
30 | |
31 | |
32 | int main(int argc, const char **argv) |
33 | { |
34 | struct atrf_dsc *dsc; |
35 | int txrx = 1; |
36 | |
37 | switch (argc) { |
38 | case 1: |
39 | break; |
40 | case 2: |
41 | if (!strcmp(argv[1], "-t")) |
42 | break; |
43 | txrx = 0; |
44 | if (!strcmp(argv[1], "-a")) |
45 | break; |
46 | /* fall through */ |
47 | default: |
48 | usage(*argv); |
49 | } |
50 | |
51 | dsc = atrf_open(); |
52 | if (!dsc) |
53 | return 1; |
54 | |
55 | if (txrx) |
56 | atrf_reset_rf(dsc); |
57 | else |
58 | atrf_reset(dsc); |
59 | return 0; |
60 | } |
61 | |
62 |