% Support file for CustomCtrlSignalsExample.m 
% No DSP license required with VHT. Save the logic analyzer code to be able
% to recreate the image if necessary, but don't include it in the example. 
% Run this script after running CustomCtrlSignalsExample. 

la = dsp.LogicAnalyzer('NumInputPorts',20);
addWave(la,'InputChannel',1,'Name','FIn');
addWave(la,'InputChannel',2,'Name','LIn');
addWave(la,'InputChannel',3,'Name','DIn');
addWave(la,'InputChannel',4,'Name','pixIn','Radix','Unsigned decimal');
addWave(la,'InputChannel',5,'Name','hStart','Color','Green');
addWave(la,'InputChannel',6,'Name','hEnd','Color','Green');
addWave(la,'InputChannel',7,'Name','vStart','Color','Green');
addWave(la,'InputChannel',8,'Name','vEnd','Color','Green');
addWave(la,'InputChannel',9,'Name','valid','Color','Green');
addWave(la,'InputChannel',10,'Name','pixel_d','Color','Green','Radix','Unsigned decimal');
addWave(la,'InputChannel',11,'Name','hStartOut','Color','White');
addWave(la,'InputChannel',12,'Name','hEndOut','Color','White');
addWave(la,'InputChannel',13,'Name','vStartOut','Color','White');
addWave(la,'InputChannel',14,'Name','vEndOut','Color','White');
addWave(la,'InputChannel',15,'Name','validOut','Color','White');
addWave(la,'InputChannel',16,'Name','pixOut','Color','White','Radix','Unsigned decimal');
addWave(la,'InputChannel',17,'Name','FOut');
addWave(la,'InputChannel',18,'Name','LOut');
addWave(la,'InputChannel',19,'Name','DOut');
addWave(la,'InputChannel',20,'Name','pixOut_d','Radix','Unsigned decimal');

for p = 1:numPixelsPerFrame  
  [hStart,hEnd,vStart,vEnd,valid] = pixelcontrolsignals(ctrl(p));
  [hStartOut,hEndOut,vStartOut,vEndOut,validOut] = pixelcontrolsignals(ctrlOut(p));
  la(logical(F(p)),logical(L(p)),logical(D(p)),pixel(p),hStart,hEnd,vStart,vEnd,valid,pixel_d(p),hStartOut,hEndOut,vStartOut,vEndOut,validOut,pixOut(p),FOut(p),LOut(p),DOut(p),pixOut_d(p));
end