SDR: Turn TX power off if requested by network

The power level is ramped smoothly within 1 ms up or down.

R2000, AMPS and C-Netz turn off power when voice channel is not i use.

C-Netz turns off power between OgK timeslots.
This commit is contained in:
Andreas Eversberg
2017-08-19 12:27:05 +02:00
parent 1c2e9180a2
commit 743d147d16
17 changed files with 221 additions and 116 deletions

View File

@@ -1,16 +1,27 @@
#include "../common/iir_filter.h"
enum fm_mod_state {
MOD_STATE_OFF, /* transmitter off, no IQ vector */
MOD_STATE_ON, /* transmitter on, FM modulated IQ vector */
MOD_STATE_RAMP_UP, /* use half cos to ramp up IQ vector */
MOD_STATE_RAMP_DOWN, /* use half cos to ramp down IQ vector */
};
typedef struct fm_mod {
double samplerate; /* sample rate of in and out */
double offset; /* offset to calculated center frequency */
double amplitude; /* how much amplitude to add to the buff */
double phase; /* current phase of FM (used to shift and modulate ) */
double *sin_tab; /* sine/cosine table for modulation */
enum fm_mod_state state;/* state of transmit power */
double *ramp_tab; /* half cosine ramp up */
int ramp; /* current ramp position */
int ramp_length; /* number of values in ramp */
} fm_mod_t;
int fm_mod_init(fm_mod_t *mod, double samplerate, double offset, double amplitude);
void fm_mod_exit(fm_mod_t *mod);
void fm_modulate_complex(fm_mod_t *mod, sample_t *frequency, int num, float *baseband);
void fm_modulate_complex(fm_mod_t *mod, sample_t *frequency, uint8_t *power, int num, float *baseband);
typedef struct fm_demod {
double samplerate; /* sample rate of in and out */