/*  pwscal.h
    contains prototypes and macros for use with Galileo PWS LRS calibrations
*/

#ifndef _pwscal_h_

int pwscal_init (int type);
/*  reads calibration tables and initializes
    returns 0 for success and errno for failure
    type is the requested calibration units to be returned
      1 is either Volts or nano-Tesla
      2 is either E or B field squared (V^2/m^2 or nT^2)
      3 is spectral density, either V^2/m^2/Hz or nT^2/Hz
*/

float pwscal_SA (int dn, int chan, int antenna);
/*  calibrates spectrum analyzer data
    returns float calibrated type specified in pwscal_init
    dn is uncalibrated 8-bit data number (0 - 255)
    chan is SA channel number (1 - 4)
    antenna is 0 for electric and 1 for magnetic
*/

float pwscal_SFR (int dn, int chan, int antenna);
/*  calibrates sweep frequency receiver data
    returns float calibrated type specified in pwscal_init
    dn is uncalibrated 8-bit data number (0 - 255)
    chan is SFR channel number (1 - 112)
    antenna is 0 for electric and 1 for magnetic
*/

float pwscal_HFR (int dn, int chan);
/*  calibrates electric high frequency receiver data
    returns float calibrated type specified in pwscal_init
    dn is uncalibrated 8-bit data number (0 - 255)
    chan is HFR channel number (1 - 42)
*/

#define CALIBRATED 1
#define FIELDSQUARED  2
#define SPECTRALDENSITY 3

#define ELECTRIC 0
#define MAGNETIC 1

#define _pwscal_h_
#endif
