Commit eeb76891 authored by ahoms's avatar ahoms
Browse files

* first implementation of Frelon::Interface; tested BufferCtrlMgr

* added binning range checking
* removed Frelon::getCameraType, added isFrelon2k16/4M and hasTaper
* added PixelSize map for Atmel and Kodak chips



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@82 45c4679d-1946-429d-baad-37912b19538b
parent 4f5a823f
......@@ -93,6 +93,18 @@ extern TimeUnitFactorMapType TimeUnitFactorMap;
extern const FrameDim MaxFrameDim;
enum ChipType {
Atmel,
Kodak,
};
typedef std::map<ChipType, double> ChipPixelSizeMapType;
extern ChipPixelSizeMapType ChipPixelSizeMap;
enum {
MaxBinX = 8,
MaxBinY = 1024,
};
} // namespace Frelon
......
......@@ -23,7 +23,10 @@ class Camera
void getVersion(std::string& ver);
void getComplexSerialNb(int& complex_ser_nb);
void getCameraType(int& type);
void getSerialNb(int& ser_nb);
void isFrelon2k16(bool& is_frelon_2k16);
void isFrelon4M(bool& is_frelon_4m);
void hasTaper(bool& has_taper);
void setInputChan(InputChan input_chan);
void getInputChan(InputChan& input_chan);
......@@ -48,8 +51,8 @@ class Camera
void setRoi(const Roi& set_roi);
void getRoi(Roi& hw_roi);
void setTriggerMode(TrigMode trig_mode);
void getTriggerMode(TrigMode& trig_mode);
void setTrigMode(TrigMode trig_mode);
void getTrigMode(TrigMode& trig_mode);
void setExpTime(double exp_time);
void getExpTime(double& exp_time);
......@@ -67,6 +70,7 @@ class Camera
static const double HorzBinSleepTime;
void sendCmd(Cmd cmd);
void getSerialNbParam(SerNbParam param, int& val);
void setChanMode(int chan_mode);
......
......@@ -114,3 +114,10 @@ lima::Frelon::TimeUnitFactorMap(C_LIST_ITERS(TimeUnitFactorCList));
const FrameDim lima::Frelon::MaxFrameDim(2048, 2048, Bpp16);
typedef pair<ChipType, double> ChipSizePair;
static const ChipSizePair ChipPixelSizeCList[] = {
ChipSizePair(Atmel, 14e-6),
ChipSizePair(Kodak, 24e-6),
};
ChipPixelSizeMapType
lima::Frelon::ChipPixelSizeMap(C_LIST_ITERS(ChipPixelSizeCList));
......@@ -65,11 +65,30 @@ void Camera::getSerialNbParam(SerNbParam param, int& val)
val = complex_ser_nb & int(param);
}
void Camera::getCameraType(int& type)
void Camera::getSerialNb(int& ser_nb)
{
getSerialNbParam(SerNb, ser_nb);
}
void Camera::isFrelon2k16(bool& is_frelon_2k16)
{
int frelon_2k16;
getSerialNbParam(F2k16, frelon_2k16);
type = frelon_2k16 ? 2016 : 2014;
is_frelon_2k16 = bool(frelon_2k16);
}
void Camera::isFrelon4M(bool& is_frelon_4m)
{
int f4m;
getSerialNbParam(F4M, f4m);
is_frelon_4m = bool(f4m);
}
void Camera::hasTaper(bool& has_taper)
{
int taper;
getSerialNbParam(Taper, taper);
has_taper = bool(taper);
}
void Camera::setChanMode(int chan_mode)
......@@ -178,6 +197,9 @@ void Camera::getFlip(Point& flip)
void Camera::setBin(const Bin& bin)
{
if ((bin.getX() > 8) || (bin.getY() > 1024))
throw LIMA_HW_EXC(InvalidValue, "Bin must be <= 8x1024");
Bin curr_bin;
getBin(curr_bin);
if (bin == curr_bin)
......@@ -431,12 +453,12 @@ void Camera::getRoi(Roi& hw_roi)
getFinalRoi(image_roi, m_roi_offset, hw_roi);
}
void Camera::setTriggerMode(TrigMode trig_mode)
void Camera::setTrigMode(TrigMode trig_mode)
{
m_trig_mode = trig_mode;
}
void Camera::getTriggerMode(TrigMode& trig_mode)
void Camera::getTrigMode(TrigMode& trig_mode)
{
trig_mode = m_trig_mode;
}
......@@ -502,7 +524,7 @@ void Camera::getLatTime(double& lat_time)
void Camera::setNbFrames(int nb_frames)
{
TrigMode trig_mode;
getTriggerMode(trig_mode);
getTrigMode(trig_mode);
int cam_nb_frames = (trig_mode == ExtTrigMult) ? 1 : nb_frames;
writeRegister(NbFrames, cam_nb_frames);
m_nb_frames = nb_frames;
......@@ -516,7 +538,7 @@ void Camera::getNbFrames(int& nb_frames)
void Camera::start()
{
TrigMode trig_mode;
getTriggerMode(trig_mode);
getTrigMode(trig_mode);
if (trig_mode == IntTrig)
sendCmd(Start);
}
......@@ -524,7 +546,7 @@ void Camera::start()
void Camera::stop()
{
TrigMode trig_mode;
getTriggerMode(trig_mode);
getTrigMode(trig_mode);
if (trig_mode != ExtGate)
sendCmd(Stop);
}
......
include ../../common/espia/include/espia.inc
frelon-objs = FrelonBase.o FrelonSerialLine.o FrelonCamera.o
frelon-objs = FrelonBase.o FrelonSerialLine.o FrelonCamera.o FrelonInterface.o
CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
......
......@@ -11,10 +11,13 @@ CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
-I$(ESPIA_DRV_INCL) -Wall -pthread
all: clean testfrelon
all: clean testfrelon testfreloninterface
testfrelon: testfrelon.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfreloninterface: testfreloninterface.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
clean:
rm -f *.o testfrelon
rm -f *.o testfrelon testfreloninterface
......@@ -112,6 +112,7 @@ void test_frelon(bool do_reset)
Espia::SerialLine espia_ser_line(espia_dev);
Frelon::SerialLine frelon_ser_line(espia_ser_line);
Frelon::Camera frelon_cam(espia_ser_line);
BufferCtrlMgr buffer_mgr(espia_buffer_mgr);
string msg;
......@@ -201,23 +202,29 @@ void test_frelon(bool do_reset)
FrameDim frame_dim;
frelon_cam.getFrameDim(frame_dim);
frame_dim /= bin;
int max_nb_buffers = espia_buffer_mgr.getMaxNbBuffers(frame_dim);
cout << "MaxNbBuffers " << max_nb_buffers << endl;
int nb_buffers = max_nb_buffers;
buffer_mgr.setFrameDim(frame_dim);
int max_nb_buffers;
buffer_mgr.getMaxNbBuffers(max_nb_buffers);
cout << "MaxNbBuffers " << max_nb_buffers << endl;
int nb_concat_frames = 1;
espia_buffer_mgr.allocBuffers(nb_buffers, nb_concat_frames, frame_dim);
espia_buffer_mgr.getNbBuffers(nb_buffers);
espia_buffer_mgr.getNbConcatFrames(nb_concat_frames);
cout << "NbBuffers " << nb_buffers << ", "
buffer_mgr.setNbConcatFrames(nb_concat_frames);
int nb_buffers = max_nb_buffers;
buffer_mgr.setNbBuffers(nb_buffers);
buffer_mgr.getFrameDim(frame_dim);
buffer_mgr.getNbBuffers(nb_buffers);
buffer_mgr.getNbConcatFrames(nb_concat_frames);
cout << "FrameDim " << frame_dim << ", "
<< "NbBuffers " << nb_buffers << ", "
<< "NbConcatFrames " << nb_concat_frames << endl;
TrigMode trig_mode;
frelon_cam.getTriggerMode(trig_mode);
frelon_cam.getTrigMode(trig_mode);
cout << "TrigMode " << trig_mode << endl;
trig_mode = IntTrig;
frelon_cam.setTriggerMode(trig_mode);
frelon_cam.getTriggerMode(trig_mode);
frelon_cam.setTrigMode(trig_mode);
frelon_cam.getTrigMode(trig_mode);
cout << "TrigMode " << trig_mode << endl;
int nb_frames;
......@@ -238,7 +245,7 @@ void test_frelon(bool do_reset)
Cond acq_finished;
FrelonFrameCb frame_cb(nb_frames, acq_finished);
espia_buffer_mgr.registerFrameCallback(frame_cb);
buffer_mgr.registerFrameCallback(frame_cb);
espia_acq.start();
frelon_cam.start();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment