function [DatiBaro,DatiBaroT] = conv_grezziBL(rBL,ADCBaro,tempBaro,DCalBLTot,FileName)

text = 'conv_grezziBL function started';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);

caBaro = DCalBLTot(:,1);
intBaro = DCalBLTot(:,2);
caT = DCalBLTot(:,3);
intT = DCalBLTot(:,4);

% Conversione dei punti ADC in dati di pressione
[rP,~] = size(ADCBaro);
mBar = zeros(rP,rBL);
DatiBaro = zeros(rP,rBL);
DatiBaroT = zeros(rP,rBL);

% Barometro
for i=1:rBL
    mBar(:,i) = caBaro(i,1)*ADCBaro(:,i)+intBaro(i,1); % conversione in mBar
    DatiBaro(:,i) = mBar(:,i)*100; % vado in Pascal
    DatiBaroT(:,i) = caT(i,1)*tempBaro(:,i)+intT(i,1); % conversione in gradi
end

text = 'Raw Data of Baro Link converted into physical units correctly. conv_grezziBL function closed';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);
fclose(fileID);

end