Skip to content

Commit

Permalink
Store Tx and Rx number of taps in separate variables. Fixes analogdev…
Browse files Browse the repository at this point in the history
…icesinc#28.

Signed-off-by: Alexander Vickberg <[email protected]>
  • Loading branch information
kylex2 committed Feb 11, 2022
1 parent 924f0cd commit e7ec8a2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions AD9361_Filter_Wizard.m
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ function save2noos_Callback(hObject, eventdata, handles)
coefficients = sprintf('%.0f,', flip(rot90(handles.rfirtaps)));
coefficients = coefficients(1:end-1); % strip final comma
fprintf(fid, '\t{%s}, // rx_coef[128]\n', coefficients);
fprintf(fid, '\t%d, // rx_coef_size\n', handles.nfirtaps);
fprintf(fid, '\t%d, // rx_coef_size\n', handles.nrfirtaps);
fprintf(fid, '\t{%.0f,%.0f,%.0f,%.0f,%.0f,%.0f}, // rx_path_clks[6]\n', ...
PLL_rate, rx_HB3_rate, rx_HB2_rate, rx_HB1_rate, rx_FIR_rate, handles.rx.Rdata);
fprintf(fid, '\t%.0f // rx_bandwidth\n', rx_RFbw_hw);
Expand All @@ -759,7 +759,7 @@ function save2noos_Callback(hObject, eventdata, handles)
coefficients = sprintf('%.0f,', flip(rot90(handles.tfirtaps)));
coefficients = coefficients(1:end-1); % strip final comma
fprintf(fid, '\t{%s}, // tx_coef[128]\n', coefficients);
fprintf(fid, '\t%d, // tx_coef_size\n', handles.nfirtaps);
fprintf(fid, '\t%d, // tx_coef_size\n', handles.ntfirtaps);
fprintf(fid, '\t{%.0f,%.0f,%.0f,%.0f,%.0f,%.0f}, // tx_path_clks[6]\n', ...
PLL_rate, tx_HB3_rate, tx_HB2_rate, tx_HB1_rate, tx_FIR_rate, handles.tx.Rdata);
fprintf(fid, '\t%.0f // tx_bandwidth\n', tx_RFbw_hw);
Expand Down Expand Up @@ -812,7 +812,7 @@ function save2coefficients_Callback(hObject, eventdata, handles)
coefficients = flip(rot90(vertcat(handles.tfirtaps, handles.rfirtaps)));

% output all non-zero coefficients since they're padded to 128 with zeros
for i = 1:handles.nfirtaps
for i = 1:max(handles.ntfirtaps, handles.nrfirtaps)
fprintf(fid, '%d,%d\r\n', coefficients(i,:));
end

Expand Down Expand Up @@ -840,7 +840,7 @@ function save2target_Callback(hObject, eventdata, handles)
coefficients = flip(rot90(vertcat(handles.tfirtaps, handles.rfirtaps)));

% output all non-zero coefficients since they're padded to 128 with zeros
for i = 1:handles.nfirtaps
for i = 1:max(handles.ntfirtaps, handles.nrfirtaps)
fir_filter_str = strcat(fir_filter_str, sprintf('\n%d,%d', coefficients(i,:)));
end

Expand Down Expand Up @@ -1199,6 +1199,7 @@ function create_filter(hObject, handles)
addStage(handles.plutofilter, hf);
addStage(handles.plotpluto, hf);
handles.rfirtaps = int32(filter_result.firtaps);
handles.nrfirtaps = filter_result.nfirtaps;

% values used for saving to a filter file or pushing to the target directly
handles.rx = filter_result;
Expand All @@ -1225,6 +1226,7 @@ function create_filter(hObject, handles)
addStage(handles.plutofilter, hf, 1);
addStage(handles.plotpluto, hf, 1);
handles.tfirtaps = int32(filter_result.firtaps);
handles.ntfirtaps = filter_result.nfirtaps;

% values used for saving to a filter file or pushing to the target directly
handles.tx = filter_result;
Expand All @@ -1236,7 +1238,6 @@ function create_filter(hObject, handles)
set(handles.target_delay, 'String', num2str(filter_input.phEQ, 8));
end

handles.nfirtaps = filter_result.nfirtaps;
handles.Hmiddle = filter_result.Hmiddle;

set(handles.FVTool_deeper, 'Visible', 'on');
Expand Down Expand Up @@ -1270,7 +1271,7 @@ function create_filter(hObject, handles)
set(handles.results_taps, 'Visible', 'on');
set(handles.results_group_delay, 'Visible', 'on');

set(handles.results_taps, 'String', [num2str(handles.nfirtaps) ' ']);
set(handles.results_taps, 'String', [num2str(filter_result.nfirtaps) ' ']);
set(handles.RFbw, 'String', num2str(Hz2value(handles, handles.freq_units, RFbw)));

G = 8192;
Expand Down

0 comments on commit e7ec8a2

Please sign in to comment.