Commit 6d70ab1b authored by ahoms's avatar ahoms
Browse files

* 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 9e2d174b
SRCS = EspiaBase.cpp EspiaDev.cpp EspiaAcq.cpp EspiaSerialLine.cpp \
EspiaBufferMgr.cpp EspiaFocla.cpp FoclaHwInterface.cpp
espia-objs = EspiaBase.o EspiaDev.o EspiaAcq.o EspiaSerialLine.o \
EspiaBufferMgr.o EspiaFocla.o FoclaHwInterface.o
SRCS = $(espia-objs:.o=.cpp)
include ../include/espia.inc
CXXFLAGS = -I../include \
......
SRCS = testfocla.cpp testfoclahwinterface.cpp
focla-objs = ../src/Espia.o \
../../../../hardware/src/Hw.o ../../../../common/src/Common.o
ct-objs = ../../../../control/src/Ct.o
SRCS = testfocla.cpp testfoclahwinterface.cpp
include ../../../common/espia/include/espia.inc
LDFLAGS = -pthread -L$(ESPIA_DRV_LIB)
LDLIBS = -lespia
HWINTER_LDFLAGS = -L../../../../third-party/Processlib/build -lprocesslib
CXXFLAGS = -I../include \
-I../../../../hardware/include -I../../../../common/include \
......@@ -20,9 +23,8 @@ all: testfocla testfoclahwinterface
testfocla: testfocla.o $(focla-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
testfoclahwinterface: testfoclahwinterface.o $(focla-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS) ../../../../control/src/Ct.o \
-L../../../../third-party/Processlib/build -lprocesslib
testfoclahwinterface: testfoclahwinterface.o $(focla-objs) $(ct-objs)
$(CXX) $(LDFLAGS) $(HWINTER_LDFLAGS) -o $@ $+ $(LDLIBS)
clean:
rm -f *.o testfocla testfoclahwinterface
......
......@@ -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);
......
SRCS = MaxipixReconstruction.cpp
maxipix-objs := MaxipixReconstruction.o
SRCS = $(maxipix-objs:.o=.cpp)
INCLUDES = -I../include \
-I../../../third-party/Processlib/core/include
......
SRCS = FrameBuilder.cpp Simulator.cpp SimuHwInterface.cpp
simu-objs = FrameBuilder.o Simulator.o SimuHwInterface.o
SRCS = $(simu-objs:.o=.cpp)
CXX = g++
INC = -I../include -I../../../common/include -I../../../hardware/include
CXXFLAGS += $(INC) -Wall -pthread -fPIC -g
......
SRCS = test.cpp testsimulator.cpp testsimuhwinterface.cpp
std-objs = ../../../common/src/Common.o ../../../hardware/src/Hw.o
simu-objs = ../src/Simu.o
......@@ -12,20 +11,24 @@ testsimulator-ext-objs = $(simu-objs) $(std-objs)
testsimuhwinterface-objs = testsimuhwinterface.o
testsimuhwinterface-ext-objs = $(simu-objs) $(std-objs)
SRCS = $(test-objs:.o=.cpp) $(testsimulator-objs:.o=.cpp) \
$(testsimuhwinterface-objs:.o=.cpp)
INC = -I../include -I../../../common/include -I../../../hardware/include
CXXFLAGS += $(INC) -Wall -pthread -g
LDFLAGS = -pthread
all: test testsimulator testsimuhwinterface
test: $(test-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(test-ext-objs) $(std-objs)
test: $(test-objs) $(test-ext-objs) $(std-objs)
$(CXX) $(LDFLAGS) -o $@ $+
testsimulator: $(testsimulator-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(testsimulator-ext-objs)
testsimulator: $(testsimulator-objs) $(testsimulator-ext-objs)
$(CXX) $(LDFLAGS) -o $@ $+
testsimuhwinterface: $(testsimuhwinterface-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(testsimuhwinterface-ext-objs)
testsimuhwinterface: $(testsimuhwinterface-objs) \
$(testsimuhwinterface-ext-objs)
$(CXX) $(LDFLAGS) -o $@ $+
clean:
rm -f $(test-objs) test *.edf
......
......@@ -32,6 +32,8 @@ inline bool IsPowerOf2(int x)
class Point
{
public:
int x, y;
Point() : x(0), y(0) {}
Point(int i) : x(i), y(i) {}
Point(int x0, int y0) : x(x0), y(y0) {}
......@@ -62,8 +64,6 @@ class Point
{ return (p.x <= x) && (p.y <= y); }
void alignTo(const Point& p, AlignDir align_dir);
int x, y;
};
inline Point operator +(const Point& p1, const Point& p2)
......@@ -302,6 +302,39 @@ inline Point Bin::checkValid(const Point& p)
std::ostream& operator <<(std::ostream& os, const Bin& bin);
/*******************************************************************
* \class Flip
* \brief Class specifying horizontal and vertical flip modes
*
*******************************************************************/
class Flip
{
public:
bool x, y;
Flip() : x(false), y(false) {}
Flip(bool b) : x(b), y(b) {}
Flip(bool x0, bool y0) : x(x0), y(y0) {}
Flip(const Flip& f) : x(f.x), y(f.y) {}
operator Point() const
{ return Point(x, y); }
Corner getRefCorner() const
{ return Corner(x ? Right : Left, y ? Bottom : Top); }
Flip& operator &=(const Flip& f)
{ x ^= f.x; y ^= f.y; return *this; }
};
inline Flip operator &(const Flip& f1, const Flip& f2)
{
Flip flip = f1;
return flip &= f2;
}
/*******************************************************************
* \class Roi
* \brief Class specifying a rectangular region-of-interest
......
......@@ -6,6 +6,9 @@ class Point
#include <SizeUtils.h>
%End
public:
int x;
int y;
Point();
Point(int i);
Point(int x0, int y0);
......@@ -26,9 +29,6 @@ class Point
bool contains(const Point& p) const;
void alignTo(const Point& p, AlignDir align_dir);
int x;
int y;
};
enum XBorder {
......@@ -119,6 +119,29 @@ using namespace lima;
Bin& operator /=(const Point& p);
};
class Flip
{
%TypeHeaderCode
#include <SizeUtils.h>
using namespace lima;
%End
public:
bool x;
bool y;
Flip();
Flip(bool b);
Flip(bool x0, bool y0);
Flip(const Flip& f);
operator Point() const;
Corner getRefCorner() const;
Flip& operator &=(const Flip& f);
};
class Roi
{
%TypeHeaderCode
......
ct-objs := SoftOpInternalMgr.o SoftOpExternalMgr.o SoftOpId.o
SRCS=SoftOpInternalMgr.cpp SoftOpExternalMgr.cpp SoftOpId.cpp
SRCS = $(ct-objs:.o=.cpp)
INCLUDES=-I../include -I../../../third-party/Processlib/core/include -I../../../third-party/Processlib/tasks/include -I../../../common/include
......
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