Update FIR update to handle errors and remove unnecessary rate update

Signed-off-by: Travis Collins <travis.collins@analog.com>
master
Travis Collins 2019-02-22 20:31:59 -05:00
parent f8c43e1ca1
commit 86ddac67f1
No known key found for this signature in database
GPG Key ID: CCF21E1A1D8A8EDC
1 changed files with 13 additions and 8 deletions

View File

@ -333,14 +333,19 @@ classdef iio_sys_obj_matlab
function ret = writeFirData(obj, fir_data_file) function ret = writeFirData(obj, fir_data_file)
fir_data_str = fileread(fir_data_file); fir_data_str = fileread(fir_data_file);
% Force sample rate to a value not requiring a FIR to prevent loading errors ret = writeAttributeString(obj.libiio_ctrl_dev, 'in_out_voltage_filter_fir_en', '0');
r0 = writeAttributeString(obj.libiio_ctrl_dev, 'in_voltage_sampling_frequency', '3000000'); if ret<0
r1 = writeAttributeString(obj.libiio_ctrl_dev, 'in_out_voltage_filter_fir_en', '0'); return;
r2 = writeAttributeString(obj.libiio_ctrl_dev, 'filter_fir_config', fir_data_str); end
r3 = writeAttributeString(obj.libiio_ctrl_dev, 'in_out_voltage_filter_fir_en', '1'); ret = writeAttributeString(obj.libiio_ctrl_dev, 'filter_fir_config', fir_data_str);
if any([r0, r1, r2, r3]<0) if ret<0
ret = -1; return;
end
ret = writeAttributeString(obj.libiio_ctrl_dev, 'in_out_voltage_filter_fir_en', '1');
if ret<0
return;
end end
end end
end end
end end