summaryrefslogtreecommitdiff
path: root/gr-uhd/grc/gen_uhd_usrp_blocks.py
diff options
context:
space:
mode:
authorPeter Witkowski <pete@deepwavedigital.com>2019-04-15 15:03:56 -0600
committerMartin Braun <martin.braun@ettus.com>2019-05-17 21:15:46 -0700
commit4e4f44c726556496c420bceb87ccafe6843916f7 (patch)
tree9efa4a511e6ecaea19c1700d8dbaad24b076473f /gr-uhd/grc/gen_uhd_usrp_blocks.py
parent96b1eec42dcfade96d15320b44b2936561f9fb9c (diff)
uhd: Add set_rx_agc() API call and GRC bindings
This adds the set_rx_agc() call from UHD to the USRP source.
Diffstat (limited to 'gr-uhd/grc/gen_uhd_usrp_blocks.py')
-rw-r--r--gr-uhd/grc/gen_uhd_usrp_blocks.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index 3139a5e6b3..db83b4203a 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -170,11 +170,26 @@ templates:
% for n in range(max_nchan):
${'%'} if context.get('nchan')() > ${n}:
self.${'$'}{id}.set_center_freq(${'$'}{${'center_freq' + str(n)}}, ${n})
+ % if sourk == 'source':
+ ${'%'} if context.get('rx_agc${n}')() == 'Enabled':
+ self.${'$'}{id}.set_rx_agc(True, ${n})
+ ${'%'} elif context.get('rx_agc${n}')() == 'Disabled':
+ self.${'$'}{id}.set_rx_agc(False, ${n})
+ ${'%'} endif
+ ${'%'} if context.get('rx_agc${n}')() != 'Enabled':
${'%'} if bool(eval(context.get('norm_gain' + '${n}')())):
self.${'$'}{id}.set_normalized_gain(${'$'}{${'gain' + str(n)}}, ${n})
${'%'} else:
self.${'$'}{id}.set_gain(${'$'}{${'gain' + str(n)}}, ${n})
${'%'} endif
+ ${'%'} endif
+ % else:
+ ${'%'} if bool(eval(context.get('norm_gain' + '${n}')())):
+ self.${'$'}{id}.set_normalized_gain(${'$'}{${'gain' + str(n)}}, ${n})
+ ${'%'} else:
+ self.${'$'}{id}.set_gain(${'$'}{${'gain' + str(n)}}, ${n})
+ ${'%'} endif
+ % endif
${'%'} if context.get('ant${n}')():
self.${'$'}{id}.set_antenna(${'$'}{${'ant' + str(n)}}, ${n})
${'%'} endif
@@ -202,7 +217,14 @@ templates:
- set_samp_rate(${'$'}{samp_rate})
% for n in range(max_nchan):
- set_center_freq(${'$'}{${'center_freq' + str(n)}}, ${n})
+ % if sourk == 'source':
+ - ${'$'}{'set_rx_agc(True, ${n})' if context.get('rx_agc${n}')() == 'Enabled' else ''}
+ - ${'$'}{'set_rx_agc(False, ${n})' if context.get('rx_agc${n}')() == 'Disabled' else ''}
+ - ${'$'}{'set_gain(${'$'}{${'gain' + str(n)}}, ${n})' if not bool(eval(context.get('norm_gain${n}')())) and context.get('rx_agc${n}')() != 'Enabled' else ''}
+ - ${'$'}{'set_normalized_gain(${'$'}{${'gain' + str(n)}}, ${n})' if bool(eval(context.get('norm_gain${n}')())) and context.get('rx_agc${n}')() != 'Enabled' else ''}
+ % else:
- self.${'$'}{id}.set_${'$'}{'normalized_' if bool(eval(context.get('norm_gain${n}')())) else ''}gain(${'$'}{${'gain' + str(n)}}, ${n})
+ % endif
- ${'$'}{'set_lo_source(' + lo_source${n} + ', uhd.ALL_LOS, ${n})' if show_lo_controls else ''}
- ${'$'}{'set_lo_export_enabled(' + lo_export${n} + ', uhd.ALL_LOS, ${n})' if show_lo_controls else ''}
- set_antenna(${'$'}{${'ant' + str(n)}}, ${n})
@@ -296,12 +318,26 @@ PARAMS_TMPL = """
dtype: real
default: '0'
hide: ${'$'}{ 'none' if (nchan > ${n}) else 'all' }
+% if sourk == 'source':
+- id: rx_agc${n}
+ label: 'Ch${n}: AGC'
+ category: RF Options
+ dtype: string
+ default: 'Default'
+ options: ['Default', 'Disabled', 'Enabled']
+ option_labels: [Default, Disabled, Enabled]
+ hide: ${'$'}{ 'none' if (nchan > ${n}) else 'all' }
+% endif
- id: gain${n}
label: 'Ch${n}: Gain Value'
category: RF Options
dtype: float
default: '0'
+% if sourk == 'source':
+ hide: ${'$'}{ 'none' if nchan > ${n} and rx_agc${n} != 'Enabled' else 'all' }
+% else:
hide: ${'$'}{ 'none' if nchan > ${n} else 'all' }
+% endif
- id: norm_gain${n}
label: 'Ch${n}: Gain Type'
category: RF Options
@@ -309,7 +345,11 @@ PARAMS_TMPL = """
default: 'False'
options: ['False', 'True']
option_labels: [Absolute (dB), Normalized]
+% if sourk == 'source':
+ hide: ${'$'}{ 'all' if nchan <= ${n} or rx_agc${n} == 'Enabled' else ('none' if bool(eval('norm_gain' + str(${n}))) else 'part')}
+% else:
hide: ${'$'}{ 'all' if nchan <= ${n} else ('none' if bool(eval('norm_gain' + str(${n}))) else 'part')}
+% endif
- id: ant${n}
label: 'Ch${n}: Antenna'
category: RF Options