agc_rrrf

Variants: agc_crcf, agc_rrrf

Automatic gain control (agc) for level correction and signal detection

Public Functions

agc_rrrf agc_rrrf_create()
agc_rrrf agc_rrrf_copy(agc_rrrf _q)
int agc_rrrf_destroy(agc_rrrf _q)
int agc_rrrf_print(agc_rrrf _q)
int agc_rrrf_reset(agc_rrrf _q)
int agc_rrrf_execute(agc_rrrf _q, float _x, float * _y)
int agc_rrrf_execute_block(agc_rrrf _q, float * _x, unsigned int _n, float * _y)
int agc_rrrf_lock(agc_rrrf _q)
int agc_rrrf_unlock(agc_rrrf _q)
int agc_rrrf_is_locked(agc_rrrf _q)
int agc_rrrf_set_bandwidth(agc_rrrf _q, float _bt)
float agc_rrrf_get_bandwidth(agc_rrrf _q)
float agc_rrrf_get_signal_level(agc_rrrf _q)
int agc_rrrf_set_signal_level(agc_rrrf _q, float _x2)
float agc_rrrf_get_rssi(agc_rrrf _q)
int agc_rrrf_set_rssi(agc_rrrf _q, float _rssi)
float agc_rrrf_get_gain(agc_rrrf _q)
int agc_rrrf_set_gain(agc_rrrf _q, float _gain)
float agc_rrrf_get_scale(agc_rrrf _q)
int agc_rrrf_set_scale(agc_rrrf _q, float _scale)
int agc_rrrf_init(agc_rrrf _q, float * _x, unsigned int _n)
int agc_rrrf_squelch_enable(agc_rrrf _q)
int agc_rrrf_squelch_disable(agc_rrrf _q)
int agc_rrrf_squelch_is_enabled(agc_rrrf _q)
int agc_rrrf_squelch_set_threshold(agc_rrrf _q, float _thresh)
float agc_rrrf_squelch_get_threshold(agc_rrrf _q)
int agc_rrrf_squelch_set_timeout(agc_rrrf _q, unsigned int _timeout)
unsigned int agc_rrrf_squelch_get_timeout(agc_rrrf _q)
int agc_rrrf_squelch_get_status(agc_rrrf _q)

Interfaces

agc_rrrf agc_rrrf_create()

Create automatic gain control object.

agc_rrrf agc_rrrf_copy(agc_rrrf _q)

Copy object including all internal objects and state

int agc_rrrf_destroy(agc_rrrf _q)

Destroy object, freeing all internally-allocated memory.

int agc_rrrf_print(agc_rrrf _q)

Print object properties to stdout, including received signal strength indication (RSSI), loop bandwidth, lock status, and squelch status.

int agc_rrrf_reset(agc_rrrf _q)

Reset internal state of agc object, including gain estimate, input signal level estimate, lock status, and squelch mode If the squelch mode is disabled, it stays disabled, but all enabled modes (e.g. LIQUID_AGC_SQUELCH_TIMEOUT) resets to just LIQUID_AGC_SQUELCH_ENABLED.

int agc_rrrf_execute(agc_rrrf _q, float _x, float * _y)

Execute automatic gain control on an single input sample

  • _q : automatic gain control object
  • _x : input sample
  • _y : output sample

int agc_rrrf_execute_block(agc_rrrf _q, float * _x, unsigned int _n, float * _y)

Execute automatic gain control on block of samples pointed to by _x and store the result in the array of the same length _y.

  • _q : automatic gain control object
  • _x : input data array, shape: (_n, 1)
  • _n : number of input, output samples
  • _y : output data array, shape: (_n, 1)

int agc_rrrf_lock(agc_rrrf _q)

Lock agc object. When locked, the agc object still makes an estimate of the signal level, but the gain setting is fixed and does not change. This is useful for providing coarse input signal level correction and quickly detecting a packet burst but not distorting signals with amplitude variation due to modulation.

int agc_rrrf_unlock(agc_rrrf _q)

Unlock agc object, and allow amplitude correction to resume.

int agc_rrrf_is_locked(agc_rrrf _q)

Get lock state of agc object

int agc_rrrf_set_bandwidth(agc_rrrf _q, float _bt)

Set loop filter bandwidth: attack/release time.

  • _q : automatic gain control object
  • _bt : bandwidth-time constant, 0 < _bt

float agc_rrrf_get_bandwidth(agc_rrrf _q)

Get the agc object's loop filter bandwidth.

float agc_rrrf_get_signal_level(agc_rrrf _q)

Get the input signal's estimated energy level, relative to unity. The result is a linear value.

int agc_rrrf_set_signal_level(agc_rrrf _q, float _x2)

Set the agc object's estimate of the input signal by specifying an explicit linear value. This is useful for initializing the agc object with a preliminary estimate of the signal level to help gain convergence.

  • _q : automatic gain control object
  • _x2 : signal level of input, 0 < _x2

float agc_rrrf_get_rssi(agc_rrrf _q)

Get the agc object's estimated received signal strength indication (RSSI) on the input signal. This is similar to getting the signal level (above), but returns the result in dB rather than on a linear scale.

int agc_rrrf_set_rssi(agc_rrrf _q, float _rssi)

Set the agc object's estimated received signal strength indication (RSSI) on the input signal by specifying an explicit value in dB.

  • _q : automatic gain control object
  • _rssi : signal level of input [dB]

float agc_rrrf_get_gain(agc_rrrf _q)

Get the gain value currently being applied to the input signal (linear).

int agc_rrrf_set_gain(agc_rrrf _q, float _gain)

Set the agc object's internal gain by specifying an explicit linear value.

  • _q : automatic gain control object
  • _gain : gain to apply to input signal, 0 < _gain

float agc_rrrf_get_scale(agc_rrrf _q)

Get the output scaling applied to each sample (linear).

int agc_rrrf_set_scale(agc_rrrf _q, float _scale)

Set the agc object's output scaling (linear). Note that this does affect the response of the AGC.

  • _q : automatic gain control object
  • _scale :

int agc_rrrf_init(agc_rrrf _q, float * _x, unsigned int _n)

Estimate signal level and initialize internal gain on an input array.

  • _q : automatic gain control object
  • _x : input data array, shape: (_n, 1)
  • _n : number of input, output samples

int agc_rrrf_squelch_enable(agc_rrrf _q)

Enable squelch mode.

int agc_rrrf_squelch_disable(agc_rrrf _q)

Disable squelch mode.

int agc_rrrf_squelch_is_enabled(agc_rrrf _q)

Return flag indicating if squelch is enabled or not.

int agc_rrrf_squelch_set_threshold(agc_rrrf _q, float _thresh)

Set threshold for enabling/disabling squelch.

  • _q : automatic gain control object
  • _thresh : threshold for enabling squelch [dB]

float agc_rrrf_squelch_get_threshold(agc_rrrf _q)

Get squelch threshold (value in dB)

int agc_rrrf_squelch_set_timeout(agc_rrrf _q, unsigned int _timeout)

Set timeout before enabling squelch.

  • _q : automatic gain control object
  • _timeout : timeout before enabling squelch [samples]

unsigned int agc_rrrf_squelch_get_timeout(agc_rrrf _q)

Get squelch timeout (number of samples)

int agc_rrrf_squelch_get_status(agc_rrrf _q)

Get squelch status (e.g. LIQUID_AGC_SQUELCH_TIMEOUT)