function [neg_on_err] = pb_dds_load(data, device)
% FUNCTION NAME:
%   pb_dds_load
%
% DESCRIPTION:
%   Load the DDS with the given waveform. There are two different waveforms 
%   that can be loaded. Note that for PBDDS-II-300 AWG boards, this function
%   should be used only after using pb_select_dds() to select which DDS
%   channel (0 or 1) that you wish to program.
% 
%   DEVICE_DDS - This is for the DDS module itself. By default, it is loaded
%                with a sine wave, and if you don't wish to change that or use shaped
%                pulses, you do not need to use this function. Otherwise this waveform can
%                be loaded with any arbitrary waveform that will be used instead of a sine 
%                wave.
%
%   DEVICE_SHAPE - This waveform is for the shape function. This controls the 
%                  shape used, if you enable the use_shape parameters of 
%                  pb_inst_radio_shape() or pb_inst_dds2_shape(). For example, if you wish
%                  to use soft pulses, this could be loaded with the values for the sinc
%                  function.
%
% INPUTS:
%   data - This should be an array of 1024 floats that represent a single 
%          period of the waveform you want to have loaded. The range for each data
%          point is from -1.0 to 1.0
%
%   device - Device you wish to program the waveform to. Can be DEVICE_SHAPE
%            or DEVICE_DDS
%
% 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(device,'char'))
    device = upper(device);
end

switch device
	case {'DEVICE_SHAPE', 'device_shape'}
		device = '99000';
    case {'DEVICE_DDS', 'device_dds'}
		device = '99001';
end

if(isnumeric(device))
else
    device = hex2dec(device);
end

neg_on_err = calllib(SPINAPI_DLL_NAME, 'pb_dds_load', data, device);

end