function [msg] = prijemigor(delka)
%PRIJEM Summary of this function goes here
%   Detailed explanation goes here
if ~(exist('delka'))
    delka=500;end
if ~(libisloaded('lib'))
loadlibrary AVR309 usb.h alias lib
%calllib('lib', 'DoSetRS232Baud',500000);
calllib('lib', 'DoSetRS232Baud',125000);
calllib('lib', 'DoSetRS232StopBits',1);
calllib('lib', 'DoSetRS232DataBits',8);
calllib('lib', 'DoSetRS232Parity',0);
end


xp = libpointer('uint8Ptr',zeros(1,delka));
cp = libpointer('int32Ptr',delka);
 
calllib('lib', 'DoGetRS232Buffer',xp,5,cp);
msg=[];
if cp.Value
msg=char(xp.Value(1:cp.Value));
end

end
