<?xml version="1.0"?>
<block>
    <name>Funcube Dongle Source</name>
    <key>fcd_source_c</key>
    <category>[Core]/FCD</category>
    <flags>throttle</flags>
    <import>from gnuradio import fcd</import>
    <make>fcd.source_c($device_name)
#if $lna() != 20.0
self.$(id).set_lna_gain($lna)
#end if
#if $mixer() != +12.0
self.$(id).set_mixer_gain($mixer)
#end if
#if $ppm() != -120
self.$(id).set_freq_corr($ppm)
#end if
#if ($dci() != 0.0) or ($dcq() != 0.0)
self.$(id).set_dc_corr($dci,$dcq)
#end if
#if ($iq_phase() != 0.0) or ($iq_gain() != 1.0)
self.$(id).set_iq_corr($iq_gain,$iq_phase)
#end if
self.$(id).set_freq($freq)
    </make>
    <callback>set_freq($freq)</callback>
    <callback>set_lna_gain($lna)</callback>
    <callback>set_mixer_gain($mixer)</callback>
    <callback>set_freq_corr($ppm)</callback>
    <callback>set_dc_corr($dci,$dcq)</callback>
    <callback>set_iq_corr($iq_gain,$iq_phase)</callback>
    <param>
        <name>Device Name</name>
        <key>device_name</key>
        <value>hw:1</value>
        <type>string</type>
        <hide>#if $device_name() then 'none' else 'part'#</hide>
    </param>
    <param>
        <name>Frequency (Hz)</name>
        <key>freq</key>
        <value>145500000</value>
        <type>real</type>
    </param>
    <param>
        <name>LNA Gain (dB)</name>
        <key>lna</key>
        <value>20.0</value>
        <type>real</type>
    </param>
    <param>
        <name>Mixer Gain (dB)</name>
        <key>mixer</key>
        <value>+12</value>
        <type>real</type>
    </param>
    <param>
        <name>Frequency corr. (ppm)</name>
        <key>ppm</key>
        <value>-120</value>
        <type>int</type>
    </param>
    <param>
        <name>DC I offset</name>
        <key>dci</key>
        <value>0.0</value>
        <type>real</type>
    </param>
    <param>
        <name>DC Q offset</name>
        <key>dcq</key>
        <value>0.0</value>
        <type>real</type>
    </param>
    <param>
        <name>IQ phase balance</name>
        <key>iq_phase</key>
        <value>0.0</value>
        <type>real</type>
    </param>
    <param>
        <name>IQ gain balance</name>
        <key>iq_gain</key>
        <value>1.0</value>
        <type>real</type>
    </param>
    <check>($freq &gt;= 50e6) and ($freq &lt;= 2e9)</check>
    <check>($dci &gt;= -1.0) and ($dci &lt;= 1.0)</check>
    <check>($dcq &gt;= -1.0) and ($dcq &lt;= 1.0)</check>
    <check>($iq_phase &gt;= -1.0) and ($iq_phase &lt;= 1.0)</check>
    <check>($iq_gain &gt;= -1.0) and ($iq_gain &lt;= 1.0)</check>
    <source>
      <name>out</name>
      <type>complex</type>
    </source>
    <doc>
This block wraps the Funcube Dongle USB audio input and the USB HID control interface \
into one convenient GNU Radio source block.

The sample rate is fixed at 96 ksps.

To find the device name on Linux type:
   cat /proc/asound/cards

The LNA gain is a set of discrete values between -5 to 30 dB with 2.5 dB step, but you can \
use any float value and it will be rounded to the nearest valid value.

The Mixer gain can be set either to +4 or +12 dB, but you can use any float value \
and it will be rounded to the nearest valid value.

The FCD block can autmatically apply frequency correction:
  - For FCD v1.0 you can leave at -120 ppm
  - For FCD v1.1 with serial number 810 or greater use -12 ppm

The DC offset and IQ balance parameters can have range -1.0 to 1.0.
	</doc>
</block>
