function [neg_on_err] = pb_set_radio_control(control)
% FUNCTION NAME:
%   pb_set_radio_control
%
% DESCRIPTION:
%   The RadioProcessor contains internal registers which can be used to modify 
%   the way the board works. These settings are mainly for debugging purposes and 
%   not generally used during normal operation. 
% 
% INPUTS:
%   control - BYPASS_MULT
%             BYPASS_CIC
%             BYPASS_FIR
%             SELECT_AUX_DDS
%             SELECT_INTERNAL_DDS
%             DAC_FEEDTHROUGH
%             BNC0_CLK (for boards that have selectable clock output on BNC0)
%             FORCE_AVG (for boards that support averaging across separate scan calls)
%
% OUTPUTS:
%   neg_on_err - A negative number is returned on failure, and spinerr is set
%                to a description of the error. 0 is returned on success. 
%
% $Revision: R2017a$ 
% $Author: SpinCore Technologies, Inc.$
% $Date: November 17, 2023$
% ------------------------------------------------------------------------------

global SPINAPI_DLL_NAME;

if(isa(control,'char'))
    control = upper(control);
else 
    op_code = control;
end

switch control
	case {'BYPASS_MULT',512}
		op_code = 512;
	case {'BYPASS_CIC',128}
		op_code = 128;
	case {'SELECT_AUX_DDS',1024}
		op_code = 1024;
	case {'SELECT_INTERNAL_DDS',4096}
		op_code = 4096;
	case {'DAC_FEEDTHROUGH',8192}
		op_code = 8192;
	case {'BNC0_CLK',32} %(for boards that have selectable clock output on BNC0)
		op_code = 32;
	case {'FORCE_AVG',16} % (for boards that support averaging across separate scan calls)
		op_code = 16;
    case {'RAM_DIRECT',33664}
		op_code = 33664;
end

neg_on_err = calllib(SPINAPI_DLL_NAME, 'pb_set_radio_control', op_code);

end