FreeCalypso > hg > fc-rfcal-tools
view autocal/txlevels.c @ 82:a094db1453b1
fc-rfcal-txband: implemented computation of APC from basis
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 15 Jul 2017 22:48:29 +0000 |
parents | |
children | 45ef4a06edfc |
line wrap: on
line source
/* * The calibration of Tx power levels is implemented here. */ #include <stdio.h> #include <stdlib.h> #include <rvinterf/l1tm.h> #include <rvinterf/exitcodes.h> #include "txband.h" extern double tx_power_meas(); extern vout_t dbm_to_vout(); extern struct txcal_band *txcal_band; extern struct tx_basis_point tx_basis[MAX_BASIS_POINTS]; extern unsigned num_basis_points; extern struct tx_level tx_levels[MAX_TX_LEVELS]; unsigned find_apc_for_target(target_dbm) double target_dbm; { vout_t target_vout; unsigned n; int apc_delta; target_vout = dbm_to_vout(target_dbm); for (n = 0; n < num_basis_points - 1; n++) if (target_vout < tx_basis[n+1].vout) break; apc_delta = (target_vout - tx_basis[n].vout) / tx_basis[n].slope; return tx_basis[n].apc + apc_delta; }