package imseProc.arduinoComm;

import java.util.HashMap;
import java.util.Map;

public class SequenceConfig {
	public static final int EXPOSURE_PULSE_LENGTH_NS = 100000; //100µs	
	public static final int FAST_ADVANCE_PULSE_LENGTH_NS = 100000; //100µs
	
	/** Channel of Camera exposure start trigger */
	public static final int CH_CAM_TRIG = 0;
	public static final int CAM_TRIG_OFF = 0;
	public static final int CAM_TRIG_ON = (1 << CH_CAM_TRIG);
	
	/** Channel of fast advance line to Arduino */
	public static final int CH_FAST_ADV = 1;
	public static final int FAST_ADV_OFF = (1 << CH_FAST_ADV);
	public static final int FAST_ADV_ON = 0;
	
	/** PFI Channel of external sequence start trigger */
	public static final int PFI_START_TRIG = 0;

	/** FLC drive line low for entire scan */
	public static final int FLC_LOW = 0;

	/** FLC drive line high for entire scan */
	public static final int FLC_HIGH = 1;

	/** One exposure low and one exposure high in each frame, before stepping */
	public static final int FLC_INTERLACE = 2;

	public long startDelayUS;		
	public int nFrames;	
	public int flcMode;	
	public int nStepsPerFrame;	
	public long stepPeriodUS;	
	public long clockPeriodNS;	
	public boolean lineTrigger;
	public int startTriggerPFI;	
	public long exposureTimeUS;	
	public long postExposureTimeUS;	
	public boolean abortTrigAtEnd;	
	public long restartPeriodMS;
	
	//stuff filled in by calcSequence
	public long startPos;
	public long endPos;
	public int exposuresPerFrame;	
	public long exposureCLKs;
	public long postExposure1CLKs;
	public long postExposure2CLKs;	
	public long expPulseCLKs;
	public long advPulseCLKs;
	public long frameTimeCLKs;
	public long startDelayCLKs;
	public long fullLenCLKs;
	public long frameTimeUS;
	public long totalTimeUS;

	

	public Map<String, Object> toMap(String prefix) {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put(prefix + "/startDelayUS", startDelayUS);
		map.put(prefix + "/nFrames", nFrames);
		map.put(prefix + "/flcMode", flcMode);
		map.put(prefix + "/exposureTimeUS", exposureTimeUS);
		map.put(prefix + "/postExposureTimeUS", postExposureTimeUS);
		map.put(prefix + "/nStepsPerFrame", nStepsPerFrame);
		map.put(prefix + "/clockPeriodNS", clockPeriodNS);
		map.put(prefix + "/stepPeriodUS", stepPeriodUS);
		map.put(prefix + "/lineTrigger", lineTrigger);
		map.put(prefix + "/startTriggerPFI", startTriggerPFI);
		
		return map;
	}
/*	
	@Override
	protected  clone() throws CloneNotSupportedException {

		
		startDelayUS startDelayUS;
			
		nFrames;
		
		flcMode;
		
		nStepsPerFrame;
		
		stepPeriodUS;
		
		clockPeriodNS;
		
		lineTrigger = CONFIG;

		startTriggerPFI;
		
		exposureTimeUS;
		
		postExposureTimeUS;
		
		abortTrigAtEnd;
		
		restartPeriodMS;
	}
		*/
}
