Skip to content

Commit

Permalink
Revert "init camera in AbstraceCamera"
Browse files Browse the repository at this point in the history
This reverts commit ef86a44.
  • Loading branch information
deanlee committed Sep 12, 2022
1 parent 5fa151e commit 09a23c0
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 172 deletions.
2 changes: 1 addition & 1 deletion system/camerad/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ libs = ['m', 'pthread', common, 'jpeg', 'OpenCL', 'yuv', cereal, messaging, 'zmq
cenv = env.Clone()
cenv['CPPPATH'].append('include/')

camera_obj = cenv.Object(['cameras/camera_qcom2.cc', 'cameras/camera.cc', 'cameras/camera_ar0231.cc','cameras/camera_ox03c10.cc','cameras/camera_common.cc', 'cameras/camera_util.cc'])
camera_obj = cenv.Object(['cameras/camera_qcom2.cc', 'cameras/camera_ar0231.cc','cameras/camera_ox03c10.cc','cameras/camera_common.cc', 'cameras/camera_util.cc'])
cenv.Program('camerad', [
'main.cc',
camera_obj,
Expand Down
129 changes: 0 additions & 129 deletions system/camerad/cameras/camera.cc

This file was deleted.

16 changes: 1 addition & 15 deletions system/camerad/cameras/camera.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <cassert>
#include <map>
#include <mutex>
#include <optional>
Expand All @@ -14,9 +13,6 @@
#include "media/cam_sensor.h"
#include "media/cam_sensor_cmn_header.h"
#include "media/cam_sync.h"

#include "common/util.h"
#include "system/camerad/cameras/camera_util.h"
#include "system/camerad/cameras/sensor2_i2c.h"

#define CAMERA_ID_IMX298 0
Expand Down Expand Up @@ -49,12 +45,8 @@ class AbstractCamera {
virtual ~AbstractCamera(){};
virtual std::vector<struct i2c_random_wr_payload> getExposureVector(int new_g, bool dc_gain_enabled, int exposure_time, int dc_gain_weight) const = 0;
virtual void processRegisters(void *addr, cereal::FrameData::Builder &framed) {}
virtual int getSlaveAddress(int port) = 0;
static std::unique_ptr<AbstractCamera> initCamera(int video0_fd, int sensor_fd, int camera_num);

CameraInfo ci;
MemoryManager mm;

int id;
float dc_gain_factor;
int dc_gain_max_weight;
Expand All @@ -68,15 +60,11 @@ class AbstractCamera {
float min_ev, max_ev;
int registers_offset = 0;
float sensor_analog_gains[16];
uint32_t in_port_info_dt;

camera_sensor_i2c_type i2c_type;
std::vector<struct i2c_random_wr_payload> start_reg_array;
std::vector<struct i2c_random_wr_payload> init_array;

protected:
bool init(int video0_fd, int sensor_fd, int camera_num);

uint32_t in_port_info_dt;
uint32_t reg_addr;
uint32_t expected_data;
uint32_t config_val_low;
Expand All @@ -86,7 +74,6 @@ class CameraAR0231 : public AbstractCamera {
public:
CameraAR0231();
~CameraAR0231();
int getSlaveAddress(int port) override;
std::vector<struct i2c_random_wr_payload> getExposureVector(int new_g, bool dc_gain_enabled, int exposure_time, int dc_gain_weight) const override;
void processRegisters(void *addr, cereal::FrameData::Builder &framed) override;

Expand All @@ -100,6 +87,5 @@ class CameraOX03C10 : public AbstractCamera {
public:
CameraOX03C10();
~CameraOX03C10();
int getSlaveAddress(int port) override;
std::vector<struct i2c_random_wr_payload> getExposureVector(int new_g, bool dc_gain_enabled, int exposure_time, int dc_gain_weight) const override;
};
5 changes: 0 additions & 5 deletions system/camerad/cameras/camera_ar0231.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ CameraAR0231::~CameraAR0231() {

}

int CameraAR0231::getSlaveAddress(int port) {
assert(port >=0 && port <= 2);
return (int[]){0x20, 0x30, 0x20}[port];
}

std::vector<struct i2c_random_wr_payload> CameraAR0231::getExposureVector(int new_g, bool dc_gain_enabled, int exposure_time, int dc_gain_weight) const {
uint16_t analog_gain_reg = 0xFF00 | (new_g << 4) | new_g;
return {
Expand Down
5 changes: 0 additions & 5 deletions system/camerad/cameras/camera_ox03c10.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ CameraOX03C10::CameraOX03C10() {
CameraOX03C10::~CameraOX03C10() {
}

int CameraOX03C10::getSlaveAddress(int port) {
assert(port >=0 && port <= 2);
return (int[]){0x6C, 0x20, 0x6C}[port];
}

std::vector<struct i2c_random_wr_payload> CameraOX03C10::getExposureVector(int new_g, bool dc_gain_enabled, int exposure_time, int dc_gain_weight) const {
static constexpr uint32_t ox03c10_analog_gains_reg[] = {
0x100, 0x140, 0x150, 0x190,
Expand Down
Loading

0 comments on commit 09a23c0

Please sign in to comment.