Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AdcQuality and PixelBitDepth (ICATHALES-58) #2

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 131 additions & 125 deletions include/PrincetonInterface.h
Original file line number Diff line number Diff line change
@@ -1,125 +1,131 @@
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2020
// European Synchrotron Radiation Facility
// CS40220 38043 Grenoble Cedex 9
// FRANCE
//
// Contact: lima@esrf.fr
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef PRINCETONINTERFACE_H
#define PRINCETONINTERFACE_H
#include <string>
#include <list>

#include "PrincetonCompatibility.h"
#include <picam.h>
#include <picam_advanced.h>

#include "lima/HwInterface.h"

namespace lima
{
namespace Princeton
{
class DetInfoCtrlObj;
class SyncCtrlObj;
class BinCtrlObj;
class RoiCtrlObj;
class ShutterCtrlObj;

struct Process
{
unsigned int id;
std::string name;
};

PicamError AcquisitionUpdatedCallback(PicamHandle device,
const PicamAvailableData* available,
const PicamAcquisitionStatus* status);

class PRINCETON_EXPORT Interface : public HwInterface
{
DEB_CLASS_NAMESPC(DebModCamera, "PrincetonInterface", "Princeton");

public:
enum Status {Ready, Running, Fault};
enum TemperatureStatus {Temp_Fault,Temp_Locked,Temp_Unlocked};
enum GainType {Gain_Fault, Gain_Low, Gain_Medium, Gain_High};

Interface(const std::string& camera_serial = "");
virtual ~Interface();
//- From HwInterface
virtual void getCapList(CapList&) const;
virtual void reset(ResetLevel reset_level);
virtual void prepareAcq();
virtual void startAcq();
virtual void stopAcq();
virtual void getStatus(StatusType& status);
virtual int getNbHwAcquiredFrames();


void newFrameReady(const PicamAvailableData* available, const PicamAcquisitionStatus* status);

//Temperature management - temperature attribute
float getSensorTemperature() const; ///< current sensor temperature
Interface::TemperatureStatus getSensorTemperatureStatus() const; ///< get regulation status

// Get/Set temperature setpoint regulation - temperatureTarget attribute
float getSensorTemperatureSetpoint() const;
void setSensorTemperatureSetpoint(float temp);

// gain attribute
Interface::GainType Interface::getAdcAnalogGain() const;
//void setAdcAnalogGain(int gain);
void setAdcAnalogGain(Interface::GainType gain);

//adcRate attribute
float getAdcSpeed();
void setAdcSpeed(float adcSpeed);

private:
void _freePixelBuffer();

bool m_sdk_initialized;
const PicamCameraID* m_available_camera;
piint m_available_camera_number;
PicamHandle m_cam;
DetInfoCtrlObj* m_det_info;
SyncCtrlObj* m_sync;
BinCtrlObj* m_bin;
RoiCtrlObj* m_roi;
ShutterCtrlObj* m_shutter;

SoftBufferCtrlObj m_buffer_ctrl_obj;
CapList m_cap_list;

std::string m_cam_name;
int m_acq_frames;
Status m_status;
PicamAcquisitionBuffer m_pixel_stream; // double buffer
piint m_readout_stride;
piint m_frames_per_readout;
piint m_frame_stride;
piint m_frame_size;
Cond m_cond;
};

} // namespace Princeton
} // namespace lima

#endif // PRINCETONINTERFACE_H
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2020
// European Synchrotron Radiation Facility
// CS40220 38043 Grenoble Cedex 9
// FRANCE
//
// Contact: lima@esrf.fr
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef PRINCETONINTERFACE_H
#define PRINCETONINTERFACE_H
#include <string>
#include <list>

#include "PrincetonCompatibility.h"
#include <picam.h>
#include <picam_advanced.h>

#include "lima/HwInterface.h"

namespace lima
{
namespace Princeton
{
class DetInfoCtrlObj;
class SyncCtrlObj;
class BinCtrlObj;
class RoiCtrlObj;
class ShutterCtrlObj;

struct Process
{
unsigned int id;
std::string name;
};

PicamError AcquisitionUpdatedCallback(PicamHandle device,
const PicamAvailableData* available,
const PicamAcquisitionStatus* status);

class PRINCETON_EXPORT Interface : public HwInterface
{
DEB_CLASS_NAMESPC(DebModCamera, "PrincetonInterface", "Princeton");

public:
enum Status {Ready, Running, Fault};
enum TemperatureStatus {Temp_Fault,Temp_Locked,Temp_Unlocked};
enum GainType {Gain_Fault, Gain_Low, Gain_Medium, Gain_High};

Interface(const std::string& camera_serial = "");
virtual ~Interface();
//- From HwInterface
virtual void getCapList(CapList&) const;
virtual void reset(ResetLevel reset_level);
virtual void prepareAcq();
virtual void startAcq();
virtual void stopAcq();
virtual void getStatus(StatusType& status);
virtual int getNbHwAcquiredFrames();


void newFrameReady(const PicamAvailableData* available, const PicamAcquisitionStatus* status);

//Temperature management - temperature attribute
float getSensorTemperature() const; ///< current sensor temperature
Interface::TemperatureStatus getSensorTemperatureStatus() const; ///< get regulation status

// Get/Set temperature setpoint regulation - temperatureTarget attribute
float getSensorTemperatureSetpoint() const;
void setSensorTemperatureSetpoint(float temp);

// gain attribute
Interface::GainType getAdcAnalogGain() const;
//void setAdcAnalogGain(int gain);
void setAdcAnalogGain(Interface::GainType gain);

//adcRate attribute
float getAdcSpeed();
void setAdcSpeed(float adcSpeed);

int getAdcQuality() const;
void setAdcQuality(int quality);

short getAdcPixelBitDepth() const;
void setAdcPixelBitDepth(short pixelBitDepth);

private:
void _freePixelBuffer();

bool m_sdk_initialized;
const PicamCameraID* m_available_camera;
piint m_available_camera_number;
PicamHandle m_cam;
DetInfoCtrlObj* m_det_info;
SyncCtrlObj* m_sync;
BinCtrlObj* m_bin;
RoiCtrlObj* m_roi;
ShutterCtrlObj* m_shutter;

SoftBufferCtrlObj m_buffer_ctrl_obj;
CapList m_cap_list;

std::string m_cam_name;
int m_acq_frames;
Status m_status;
PicamAcquisitionBuffer m_pixel_stream; // double buffer
piint m_readout_stride;
piint m_frames_per_readout;
piint m_frame_stride;
piint m_frame_size;
Cond m_cond;
};

} // namespace Princeton
} // namespace lima

#endif // PRINCETONINTERFACE_H
42 changes: 42 additions & 0 deletions src/PrincetonInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,3 +487,45 @@ void Interface::_freePixelBuffer()
#endif
m_pixel_stream = {NULL,0};
}

int Interface::getAdcQuality() const
{
DEB_MEMBER_FUNCT();
piint quality;
CHECK_PICAM(Picam_GetParameterIntegerValue(m_cam,
PicamParameter_AdcQuality,
&quality));

return (int)quality;
}

void Interface::setAdcQuality(int quality)
{
DEB_MEMBER_FUNCT();

CHECK_PICAM(Picam_SetParameterIntegerValue(m_cam,
PicamParameter_AdcQuality,
quality));
}

// PixelBit Detph
short Interface::getAdcPixelBitDepth() const
{
DEB_MEMBER_FUNCT();
piint pixelBitDepth;
CHECK_PICAM(Picam_GetParameterIntegerValue(m_cam,
PicamParameter_PixelBitDepth,
&pixelBitDepth));

return (short)pixelBitDepth;
}

void Interface::setAdcPixelBitDepth(short pixelBitDepth)
{
DEB_MEMBER_FUNCT();

CHECK_PICAM(Picam_SetParameterIntegerValue(m_cam,
PicamParameter_PixelBitDepth,
pixelBitDepth));
}