1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-05 04:38:26 +02:00

atrf-path.c (do_half_sweep, do_sweep): don't duplicate the loop - use a function

This commit is contained in:
Werner Almesberger 2011-04-13 13:47:41 -03:00
parent d263ffcb8b
commit 598582c26a

View File

@ -106,29 +106,26 @@ static void sample(const struct sweep *sweep, int cont_tx,
}
void do_sweep(const struct sweep *sweep, struct sample *res)
static void do_half_sweep(const struct sweep *sweep, int cont_tx,
struct sample *res)
{
struct sample *r;
int chan;
r = res;
for (chan = 11; chan <= 26; chan++) {
set_channel(sweep->rx, chan);
set_channel(sweep->tx, chan);
usleep(155); /* table 7-2, tTR19 */
sample(sweep, CONT_TX_M500K, r, chan == 11);
r += 2;
sample(sweep, cont_tx, res, chan == 11);
res += 2;
}
r = res+1;
for (chan = 11; chan <= 26; chan++) {
set_channel(sweep->rx, chan);
set_channel(sweep->tx, chan);
usleep(155); /* table 7-2, tTR19 */
}
sample(sweep, CONT_TX_P500K, r, chan == 11);
r += 2;
}
void do_sweep(const struct sweep *sweep, struct sample *res)
{
do_half_sweep(sweep, CONT_TX_M500K, res);
do_half_sweep(sweep, CONT_TX_P500K, res+1);
}