Skip to content

Commit

Permalink
increase duration range
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeschamps committed Mar 22, 2022
1 parent 247dd77 commit 0e33411
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class MicroFPGAController {
private ArrayList<LaserTrigger> lasers_;
private ArrayList<Servo> servos_;
private ArrayList<AnalogInput> ais_;
private CameraTrigger cam_;
private CameraSync cam_;

private boolean connected_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.util.HashMap;

public class CameraTrigger {
public class CameraSync {

public enum TriggerSyncMode {
ACTIVE(1), PASSIVE(0);
Expand All @@ -29,39 +29,39 @@ 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);
exposure_ = new Exposure(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();
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0e33411

Please sign in to comment.