|
189 | 189 | '', 'RFBandwidth'); |
190 | 190 | end |
191 | 191 | obj.RFBandwidth = value; |
192 | | - if obj.ConnectedToDevice |
| 192 | + if obj.ConnectedToDevice && ~obj.EnableCustomFilter |
193 | 193 | id = 'voltage0'; |
194 | 194 | obj.setAttributeLongLong(id,'rf_bandwidth',value,strcmp(obj.Type,'Tx'),30); |
195 | 195 | end |
|
207 | 207 | end |
208 | 208 |
|
209 | 209 | obj.SamplingRate = value; |
210 | | - if obj.ConnectedToDevice |
| 210 | + if obj.ConnectedToDevice && ~obj.EnableCustomFilter |
211 | 211 | if libisloaded('libad9361') |
212 | 212 | calllib('libad9361','ad9361_set_bb_rate',obj.iioDevPHY,int32(value)); |
213 | 213 | else |
@@ -294,27 +294,36 @@ function setupInit(obj) |
294 | 294 | % Do writes directly to hardware without using set methods. |
295 | 295 | % This is required sine Simulink support doesn't support |
296 | 296 | % modification to nontunable variables at SetupImpl |
| 297 | + |
| 298 | + % Gains |
297 | 299 | obj.setAttributeRAW('voltage0','gain_control_mode',obj.GainControlModeChannel0,false); |
298 | 300 | if obj.channelCount>2 |
299 | 301 | obj.setAttributeRAW('voltage1','gain_control_mode',obj.GainControlModeChannel1,false); |
300 | 302 | end |
| 303 | + if strcmp(obj.GainControlModeChannel0,'manual') |
| 304 | + obj.setAttributeLongLong('voltage0','hardwaregain',obj.GainChannel0,false); |
| 305 | + end |
| 306 | + if strcmp(obj.GainControlModeChannel1,'manual') && (obj.channelCount>2) |
| 307 | + obj.setAttributeLongLong('voltage1','hardwaregain',obj.GainChannel1,false); |
| 308 | + end |
| 309 | + % Trackings |
301 | 310 | obj.setAttributeBool('voltage0','quadrature_tracking_en',obj.EnableQuadratureTracking,false); |
302 | 311 | obj.setAttributeBool('voltage0','rf_dc_offset_tracking_en',obj.EnableRFDCTracking,false); |
303 | 312 | obj.setAttributeBool('voltage0','bb_dc_offset_tracking_en',obj.EnableBasebandDCTracking,false); |
304 | 313 | id = sprintf('altvoltage%d',strcmp(obj.Type,'Tx')); |
305 | 314 | obj.setAttributeLongLong(id,'frequency',obj.CenterFrequency ,true,4); |
306 | | - if libisloaded('libad9361') |
307 | | - calllib('libad9361','ad9361_set_bb_rate',obj.iioDevPHY,int32(obj.SamplingRate)); |
| 315 | + % Sample rates and RF bandwidth |
| 316 | + if ~obj.EnableCustomFilter |
| 317 | + if libisloaded('libad9361') |
| 318 | + calllib('libad9361','ad9361_set_bb_rate',obj.iioDevPHY,int32(obj.SamplingRate)); |
| 319 | + else |
| 320 | + obj.setAttributeLongLong('voltage0','sampling_frequency',obj.SamplingRate,true,4); |
| 321 | + obj.setAttributeLongLong('voltage0','rf_bandwidth',obj.RFBandwidth ,strcmp(obj.Type,'Tx')); |
| 322 | + end |
308 | 323 | else |
309 | | - obj.setAttributeLongLong('voltage0','sampling_frequency',obj.SamplingRate,true,4); |
310 | | - obj.setAttributeLongLong('voltage0','rf_bandwidth',obj.RFBandwidth ,strcmp(obj.Type,'Tx')); |
311 | | - end |
312 | | - if strcmp(obj.GainControlModeChannel0,'manual') |
313 | | - obj.setAttributeLongLong('voltage0','hardwaregain',obj.GainChannel0,false); |
314 | | - end |
315 | | - if strcmp(obj.GainControlModeChannel1,'manual') && (obj.channelCount>2) |
316 | | - obj.setAttributeLongLong('voltage1','hardwaregain',obj.GainChannel1,false); |
| 324 | + writeFilterFile(obj); |
317 | 325 | end |
| 326 | + |
318 | 327 | end |
319 | 328 |
|
320 | 329 | end |
|
0 commit comments