1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-07-05 02:22:21 +03:00
ben-wpan/tools/atrf-path/sweep.h
Werner Almesberger a1fc867bf2 atrf-path: option -P to load a min/max profile; pass/fail indication in GUI
- sweep.h (MIN_DIFF, MAX_DIFF, struct sweep): added min/max profile
- sweep.h (do_sweep), atrf-path.c (do_half_sweep, do_sweep): compare
  result against limits and return pass/fail decision
- sweep.h (N_CHAN), atrf-path.c (do_half_sweep, do_sweeps), gui.c
  (N_CHAN): declare number of channels in one central place instead of
  scattering it all around the program
- atrf-path.c (do_read_profile, read_profile, usage, main): new option -P
  to read a min/max profile
- gui.c (indicate, main): moved indicator to separate function and
  improved blink logic
- gui.c (OVER_RGBA, UNDER_RGBA, indicate, main): change color to indicate
  pass/fail
2011-04-13 18:40:39 -03:00

57 lines
1.1 KiB
C

/*
* atrf-path/sweep.h - Measure path characteristics
*
* Written 2011 by Werner Almesberger
* Copyright 2011 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef SWEEP_H
#define SWEEP_H
#include <stdint.h>
#include "atrf.h"
#define N_CHAN 16
#define MIN_DIFF -97.0 /* RSSI(min)-TX(max) = -94 - 3 */
#define MAX_DIFF 7.0 /* RSSI(max)-TX(min) = -10 - (-17) */
struct sweep {
struct atrf_dsc *tx;
struct atrf_dsc *rx;
int trim_tx;
int trim_rx;
int power;
uint8_t cont_tx;
int samples;
double min[N_CHAN];
double max[N_CHAN];
};
struct sample {
double avg;
double min, max;
};
/*
* do_sweep returns whether the signal is within the limits:
*
* 1: at least one sample is above the maximum
* 0: all samples are between minimum and maximum
* -1: at least one sample below the minimum, and none above the maximum
*/
int do_sweep(const struct sweep *sweep, struct sample *res);
#endif /* !SWEEP_H */