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 a5ab9bbf0f0749f37c144d7fe4586dbd67c72093 created 6 years 9 months ago. By Werner Almesberger, atusb/: use page layout similar to eeschema's traditional default | |
|---|---|
| 1 | /* |
| 2 | * atrf-path/sweep.h - Measure path characteristics |
| 3 | * |
| 4 | * Written 2011 by Werner Almesberger |
| 5 | * Copyright 2011 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 | #ifndef SWEEP_H |
| 15 | #define SWEEP_H |
| 16 | |
| 17 | #include <stdint.h> |
| 18 | |
| 19 | #include "atrf.h" |
| 20 | |
| 21 | |
| 22 | #define N_CHAN 16 |
| 23 | |
| 24 | #define MIN_DIFF -97.0 /* RSSI(min)-TX(max) = -94 - 3 */ |
| 25 | #define MAX_DIFF 7.0 /* RSSI(max)-TX(min) = -10 - (-17) */ |
| 26 | |
| 27 | |
| 28 | struct sweep { |
| 29 | struct atrf_dsc *tx; |
| 30 | struct atrf_dsc *rx; |
| 31 | int trim_tx; |
| 32 | int trim_rx; |
| 33 | int power; |
| 34 | uint8_t cont_tx; |
| 35 | int samples; |
| 36 | double min[N_CHAN]; |
| 37 | double max[N_CHAN]; |
| 38 | }; |
| 39 | |
| 40 | struct sample { |
| 41 | double avg; |
| 42 | double min, max; |
| 43 | }; |
| 44 | |
| 45 | |
| 46 | /* |
| 47 | * do_sweep returns whether the signal is within the limits: |
| 48 | * |
| 49 | * 1: at least one sample is above the maximum |
| 50 | * 0: all samples are between minimum and maximum |
| 51 | * -1: at least one sample below the minimum, and none above the maximum |
| 52 | */ |
| 53 | |
| 54 | int do_sweep(const struct sweep *sweep, struct sample *res); |
| 55 | |
| 56 | void print_sweep(const struct sweep *sweep, const struct sample *res); |
| 57 | |
| 58 | #endif /* !SWEEP_H */ |
| 59 | |
