Commit 712811bb authored by ahoms's avatar ahoms

* using SRCS=$(xxx-objs:.o=.cpp) in Makefiles to include dependencies

* fixed some object dependency problems in Makefiles
* added Flip class in SizeUtils, used by Frelon::Camera 
* added HwFlipCtrlObj and Frelon::FlipControlObj



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@189 45c4679d-1946-429d-baad-37912b19538b
parent 01520263
......@@ -18,7 +18,7 @@ enum Reg {
ChanMode, TimeUnit, RoiEnable, RoiFast,
AntiBloom, BinVert, BinHorz, ConfigHD,
RoiKinetic, ShutEnable, HardTrigDisable,
PixelFreq, LineFreq, Flip, IntCalib,
PixelFreq, LineFreq, FlipMode, IntCalib,
DisplayImage, AdcFloatDiode, AdcSignal,
DarkPixelCalib, DarkPixelMode, ChanControl, Mire,
AoiLineBegin, AoiLineWidth, AoiPixelBegin, AoiPixelWidth,
......
......@@ -41,8 +41,9 @@ class Camera
bool isChanActive(InputChan chan);
void setFlip(const Point& flip);
void getFlip(Point& flip);
void checkFlip(Flip& flip);
void setFlip(const Flip& flip);
void getFlip(Flip& flip);
void checkBin(Bin& bin);
void setBin(const Bin& bin);
......
......@@ -171,9 +171,31 @@ class RoiCtrlObj : public HwRoiCtrlObj
RoiCtrlObj(Camera& cam);
virtual ~RoiCtrlObj();
virtual void checkRoi(const Roi& set_roi, Roi& hw_roi);
virtual void setRoi(const Roi& set_roi);
virtual void getRoi(Roi& hw_roi);
virtual void checkRoi(const Roi& set_roi, Roi& hw_roi);
private:
Camera& m_cam;
};
/*******************************************************************
* \class FlipCtrlObj
* \brief Control object providing Frelon flip interface
*******************************************************************/
class FlipCtrlObj : public HwFlipCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "FlipCtrlObj", "Frelon");
public:
FlipCtrlObj(Camera& cam);
virtual ~FlipCtrlObj();
virtual void setFlip(const Flip& flip);
virtual void getFlip(Flip& flip);
virtual void checkFlip(Flip& flip);
private:
Camera& m_cam;
......@@ -213,6 +235,7 @@ class Interface : public HwInterface
SyncCtrlObj m_sync;
BinCtrlObj m_bin;
RoiCtrlObj m_roi;
FlipCtrlObj m_flip;
};
......
......@@ -13,7 +13,7 @@ enum Reg {
ChanMode, TimeUnit, RoiEnable, RoiFast,
AntiBloom, BinVert, BinHorz, ConfigHD,
RoiKinetic, ShutEnable, HardTrigDisable,
PixelFreq, LineFreq, Flip, IntCalib,
PixelFreq, LineFreq, FlipMode, IntCalib,
DisplayImage, AdcFloatDiode, AdcSignal,
DarkPixelCalib, DarkPixelMode, ChanControl, Mire,
AoiLineBegin, AoiLineWidth, AoiPixelBegin, AoiPixelWidth,
......
......@@ -41,8 +41,9 @@ class Camera
bool isChanActive(Frelon::InputChan chan);
void setFlip(const Point& flip);
void getFlip(Point& flip /Out/);
void checkFlip(Flip& flip /InOut/);
void setFlip(const Flip& flip);
void getFlip(Flip& flip /Out/);
void checkBin(Bin& bin /InOut/);
void setBin(const Bin& bin);
......
......@@ -139,6 +139,24 @@ class RoiCtrlObj : HwRoiCtrlObj
};
class FlipCtrlObj : HwFlipCtrlObj
{
%TypeHeaderCode
#include "FrelonInterface.h"
#include <algorithm>
%End
public:
FlipCtrlObj(Frelon::Camera& cam);
virtual ~FlipCtrlObj();
virtual void setFlip(const Flip& flip);
virtual void getFlip(Flip& flip);
virtual void checkFlip(Flip& flip);
};
class Interface : HwInterface
{
......@@ -148,7 +166,8 @@ class Interface : HwInterface
%End
public:
Interface(Espia::Acq& acq, BufferCtrlMgr& buffer_mgr, Frelon::Camera& cam);
Interface(Espia::Acq& acq, BufferCtrlMgr& buffer_mgr,
Frelon::Camera& cam);
virtual ~Interface();
// virtual const HwInterface::CapList& getCapList() const;
......
......@@ -30,7 +30,7 @@ static const RegPair RegStrCList[] = {
RegPair(PixelFreq, "P"),
RegPair(LineFreq, "L"),
RegPair(Flip, "FLI"),
RegPair(FlipMode, "FLI"),
RegPair(IntCalib, "IE"),
RegPair(DisplayImage, "X"),
RegPair(AdcFloatDiode, "ADS"),
......
......@@ -286,25 +286,33 @@ void Camera::setFlipMode(int flip_mode)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(flip_mode);
writeRegister(Flip, flip_mode);
writeRegister(FlipMode, flip_mode);
}
void Camera::getFlipMode(int& flip_mode)
{
DEB_MEMBER_FUNCT();
readRegister(Flip, flip_mode);
readRegister(FlipMode, flip_mode);
DEB_RETURN() << DEB_VAR1(flip_mode);
}
void Camera::setFlip(const Point& flip)
void Camera::checkFlip(Flip& flip)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(flip);
int flip_mode = (bool(flip.x) << 1) | (bool(flip.y) << 0);
DEB_TRACE() << "All standard flip modes are supported";
DEB_RETURN() << DEB_VAR1(flip);
}
void Camera::setFlip(const Flip& flip)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(flip);
int flip_mode = (flip.x << 1) | (flip.y << 0);
setFlipMode(flip_mode);
}
void Camera::getFlip(Point& flip)
void Camera::getFlip(Flip& flip)
{
DEB_MEMBER_FUNCT();
......@@ -442,28 +450,28 @@ void Camera::xformChanCoords(const Point& point, Point& chan_point,
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(point);
Point flip;
getFlip(flip);
Flip chan_flip;
getFlip(chan_flip);
Point mirror;
getMirror(mirror);
Size chan_size;
getChanSize(chan_size);
bool good_xchan = isChanActive(Chan1) || isChanActive(Chan3);
bool good_ychan = isChanActive(Chan1) || isChanActive(Chan2);
DEB_TRACE() << DEB_VAR2(good_xchan, good_ychan);
Flip readout_flip;
readout_flip.x = !(isChanActive(Chan1) || isChanActive(Chan3));
readout_flip.y = !(isChanActive(Chan1) || isChanActive(Chan2));
DEB_TRACE() << DEB_VAR2(chan_flip, readout_flip);
XBorder ref_xb = (bool(flip.x) == !good_xchan) ? Left : Right;
YBorder ref_yb = (bool(flip.y) == !good_ychan) ? Top : Bottom;
DEB_TRACE() << "After flip: " << DEB_VAR2(ref_xb, ref_yb);
Flip effect_flip = chan_flip & readout_flip;
DEB_TRACE() << "After flip: " << DEB_VAR1(effect_flip);
if (mirror.x)
ref_xb = (point.x < chan_size.getWidth()) ? Left : Right;
effect_flip.x = (point.x >= chan_size.getWidth());
if (mirror.y)
ref_yb = (point.y < chan_size.getHeight()) ? Top : Bottom;
DEB_TRACE() << "After mirror: " << DEB_VAR2(ref_xb, ref_yb);
effect_flip.y = (point.y >= chan_size.getHeight());
DEB_TRACE() << "After mirror: " << DEB_VAR1(effect_flip);
ref_corner.set(ref_xb, ref_yb);
ref_corner = effect_flip.getRefCorner();
Size ccd_size;
getCcdSize(ccd_size);
......
......@@ -388,6 +388,40 @@ void RoiCtrlObj::getRoi(Roi& roi)
}
/*******************************************************************
* \brief FlipCtrlObj constructor
*******************************************************************/
FlipCtrlObj::FlipCtrlObj(Camera& cam)
: m_cam(cam)
{
DEB_CONSTRUCTOR();
}
FlipCtrlObj::~FlipCtrlObj()
{
DEB_DESTRUCTOR();
}
void FlipCtrlObj::setFlip(const Flip& flip)
{
DEB_MEMBER_FUNCT();
m_cam.setFlip(flip);
}
void FlipCtrlObj::getFlip(Flip& flip)
{
DEB_MEMBER_FUNCT();
m_cam.getFlip(flip);
}
void FlipCtrlObj::checkFlip(Flip& flip)
{
DEB_MEMBER_FUNCT();
m_cam.checkFlip(flip);
}
/*******************************************************************
* \brief Hw Interface constructor
*******************************************************************/
......@@ -396,7 +430,7 @@ Interface::Interface(Acq& acq, BufferCtrlMgr& buffer_mgr,
Camera& cam)
: m_acq(acq), m_buffer_mgr(buffer_mgr), m_cam(cam),
m_det_info(cam), m_buffer(buffer_mgr), m_sync(acq, cam, m_buffer),
m_bin(cam), m_roi(cam)
m_bin(cam), m_roi(cam), m_flip(cam)
{
DEB_CONSTRUCTOR();
......@@ -415,6 +449,9 @@ Interface::Interface(Acq& acq, BufferCtrlMgr& buffer_mgr,
HwRoiCtrlObj *roi = &m_roi;
m_cap_list.push_back(HwCap(roi));
HwFlipCtrlObj *flip = &m_flip;
m_cap_list.push_back(HwCap(flip));
reset(SoftReset);
}
......@@ -443,7 +480,8 @@ void Interface::reset(ResetLevel reset_level)
m_cam.setFrameTransferMode(FFM);
m_cam.setInputChan(Chan1234);
m_cam.setFlip(Point(0));
m_flip.setFlip(Flip(false));
m_sync.setNbFrames(1);
m_sync.setExpTime(1.0);
......
include ../../common/espia/include/espia.inc
SRCS = FrelonBase.cpp FrelonSerialLine.cpp FrelonCamera.cpp FrelonInterface.cpp
frelon-objs = FrelonBase.o FrelonSerialLine.o FrelonCamera.o FrelonInterface.o
SRCS = $(frelon-objs:.o=.cpp)
CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
-I$(ESPIA_DRV_INCL) -Wall -pthread -fPIC -g
......
SRCS = ./src/Frelon.cpp ../../common/espia/src/Espia.cpp \
../../../hardware/src/Hw.cpp ../../../common/src/Common.cpp
frelon-objs = ../src/Frelon.o ../../common/espia/src/Espia.o \
../../../hardware/src/Hw.o ../../../common/src/Common.o
SRCS = testfrelon.cpp testfreloninterface.cpp testfrelonspectroscopy.cpp
include ../../common/espia/include/espia.inc
LDFLAGS = -pthread -L$(ESPIA_DRV_LIB) -L../../../third-party/Processlib/build
......@@ -23,13 +22,13 @@ testfrelon: testfrelon.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfreloninterface: testfreloninterface.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS) ../../../control/src/Ct.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfrelonspectroscopy: testfrelonspectroscopy.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS) ../../../control/src/Ct.o
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
clean:
rm -f *.o *.P testfrelon testfreloninterface
rm -f *.o *.P testfrelon testfreloninterface testfrelonspectroscopy
%.o : %.cpp
$(COMPILE.cpp) -MD $(CXXFLAGS) -o $@ $<
......
......@@ -140,11 +140,18 @@ void test_frelon_spectroscopy()
HwRoiCtrlObj *hw_roi;
hw_inter.getHwCtrlObj(hw_roi);
HwFlipCtrlObj *hw_flip;
hw_inter.getHwCtrlObj(hw_flip);
hw_buffer->registerFrameCallback(cb);
DEB_ALWAYS() << "Setting Chans 3 & 4";
cam.setInputChan(Frelon::Chan34);
Flip flip(true, true);
DEB_ALWAYS() << "Setting flip mode to " << flip;
hw_flip->setFlip(flip);
Bin bin(1, 64);
DEB_ALWAYS() << "Setting binning to " << bin;
hw_bin->setBin(bin);
......
Markdown is supported
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