diff --git a/src/main/java/de/embl/rieslab/microfpga/MicroFPGAController.java b/src/main/java/de/embl/rieslab/microfpga/MicroFPGAController.java index 1408b58..b20a9af 100644 --- a/src/main/java/de/embl/rieslab/microfpga/MicroFPGAController.java +++ b/src/main/java/de/embl/rieslab/microfpga/MicroFPGAController.java @@ -12,7 +12,7 @@ public class MicroFPGAController { private ArrayList lasers_; private ArrayList servos_; private ArrayList ais_; - private CameraTrigger cam_; + private CameraSync cam_; private boolean connected_; diff --git a/src/main/java/de/embl/rieslab/microfpga/devices/CameraParameters.java b/src/main/java/de/embl/rieslab/microfpga/devices/CameraParameters.java index d2dded5..12a6b6e 100644 --- a/src/main/java/de/embl/rieslab/microfpga/devices/CameraParameters.java +++ b/src/main/java/de/embl/rieslab/microfpga/devices/CameraParameters.java @@ -38,8 +38,8 @@ protected CameraParameters(int pulse, int delay, int exposure, int readout){ public void setPulseMs(double pulseMs){ pulse_ = (int) (pulseMs*1000+0.5); - if(pulse_ > CameraTrigger.Pulse.MAX) { - pulse_ = CameraTrigger.Pulse.MAX; + if(pulse_ > CameraSync.Pulse.MAX) { + pulse_ = CameraSync.Pulse.MAX; } else if(pulse_ < 0){ pulse_ = 0; } @@ -48,8 +48,8 @@ public void setPulseMs(double pulseMs){ public void setReadoutMs(double readoutMs){ readout_ = (int) (readoutMs*1000+0.5); - if(readout_ > CameraTrigger.Readout.MAX) { - readout_ = CameraTrigger.Readout.MAX; + if(readout_ > CameraSync.Readout.MAX) { + readout_ = CameraSync.Readout.MAX; } else if(readout_ < 0){ readout_ = 0; } @@ -58,8 +58,8 @@ public void setReadoutMs(double readoutMs){ public void setExposureMs(double exposureMs){ exposure_ = (int) (exposureMs*1000+0.5); - if(exposure_ > CameraTrigger.Exposure.MAX) { - exposure_ = CameraTrigger.Exposure.MAX; + if(exposure_ > CameraSync.Exposure.MAX) { + exposure_ = CameraSync.Exposure.MAX; } else if(exposure_ < 0){ exposure_ = 0; } @@ -68,8 +68,8 @@ public void setExposureMs(double exposureMs){ public void setDelayMs(double delayMs){ delay_ = (int) (delayMs*1000+0.5); - if(pulse_ > CameraTrigger.Exposure.MAX) { - pulse_ = CameraTrigger.Exposure.MAX; + if(pulse_ > CameraSync.Exposure.MAX) { + pulse_ = CameraSync.Exposure.MAX; } else if(pulse_ < 0){ pulse_ = 0; } diff --git a/src/main/java/de/embl/rieslab/microfpga/devices/CameraTrigger.java b/src/main/java/de/embl/rieslab/microfpga/devices/CameraSync.java similarity index 86% rename from src/main/java/de/embl/rieslab/microfpga/devices/CameraTrigger.java rename to src/main/java/de/embl/rieslab/microfpga/devices/CameraSync.java index a3d756f..65a5a33 100644 --- a/src/main/java/de/embl/rieslab/microfpga/devices/CameraTrigger.java +++ b/src/main/java/de/embl/rieslab/microfpga/devices/CameraSync.java @@ -4,7 +4,7 @@ import java.util.HashMap; -public class CameraTrigger { +public class CameraSync { public enum TriggerSyncMode { ACTIVE(1), PASSIVE(0); @@ -29,16 +29,16 @@ public static TriggerSyncMode getMode(int i){ } } - private static CameraTrigger cameraTrigger; - private final Mode syncMode_; + private static CameraSync cameraSync; + private final SyncMode syncSyncMode_; private final Start start_; private final Pulse pulse_; private final Readout readout_; private final Exposure exposure_; private final Delay delay_; - private CameraTrigger(RegisterInterface regInt){ - syncMode_ = new Mode(regInt); + private CameraSync(RegisterInterface regInt){ + syncSyncMode_ = new SyncMode(regInt); start_ = new Start(regInt); pulse_ = new Pulse(regInt); readout_ = new Readout(regInt); @@ -46,22 +46,22 @@ private CameraTrigger(RegisterInterface regInt){ delay_ = new Delay(regInt); } - public static CameraTrigger getInstance(RegisterInterface regInt){ - if(cameraTrigger == null){ - cameraTrigger = new CameraTrigger(regInt); + public static CameraSync getInstance(RegisterInterface regInt){ + if(cameraSync == null){ + cameraSync = new CameraSync(regInt); } - return cameraTrigger; + return cameraSync; } public boolean setActiveSync(){ - return syncMode_.setSyncMode(TriggerSyncMode.ACTIVE); + return syncSyncMode_.setSyncMode(TriggerSyncMode.ACTIVE); } public boolean setPassiveSync(){ - return syncMode_.setSyncMode(TriggerSyncMode.PASSIVE); + return syncSyncMode_.setSyncMode(TriggerSyncMode.PASSIVE); } - public boolean isActiveSync() {return syncMode_.getSyncMode() == TriggerSyncMode.ACTIVE.getValue();} + public boolean isActiveSync() {return syncSyncMode_.getSyncMode() == TriggerSyncMode.ACTIVE.getValue();} public boolean start(){ return start_.start(); @@ -104,11 +104,11 @@ public String getParametersPretty() { return getParameters().toString(); } - public class Mode extends Signal{ + public class SyncMode extends Signal{ public static final int MAX = 1; - protected Mode(RegisterInterface regInt) { + protected SyncMode(RegisterInterface regInt) { super(0, regInt, false); } diff --git a/src/main/java/de/embl/rieslab/microfpga/devices/DeviceFactory.java b/src/main/java/de/embl/rieslab/microfpga/devices/DeviceFactory.java index d08473b..6a1c061 100644 --- a/src/main/java/de/embl/rieslab/microfpga/devices/DeviceFactory.java +++ b/src/main/java/de/embl/rieslab/microfpga/devices/DeviceFactory.java @@ -55,10 +55,10 @@ public AnalogInput getAI() { return null; } - public CameraTrigger getCameraTrigger(){ + public CameraSync getCameraTrigger(){ if(counterCamera_ < 1){ counterCamera_++; - return CameraTrigger.getInstance(regInt_); + return CameraSync.getInstance(regInt_); } return null; } diff --git a/src/main/java/de/embl/rieslab/microfpga/devices/LaserTrigger.java b/src/main/java/de/embl/rieslab/microfpga/devices/LaserTrigger.java index e85d7de..6f01389 100644 --- a/src/main/java/de/embl/rieslab/microfpga/devices/LaserTrigger.java +++ b/src/main/java/de/embl/rieslab/microfpga/devices/LaserTrigger.java @@ -144,7 +144,7 @@ public int getBaseAddress() { public class Duration extends Signal{ - public static final int MAX = 65535; + public static final int MAX = 1048575; protected Duration(int id, RegisterInterface regint) { super(id, regint, false);