Skip to content

Commit e11a39a

Browse files
author
Alrik Vidstrom
committed
Separate setResolutionWithZoom() and setResolution()
Adds back the setResolution() function to the camera drivers by calling setResolutionWithZoom() with default parameters.
1 parent ef80ad4 commit e11a39a

File tree

10 files changed

+37
-12
lines changed

10 files changed

+37
-12
lines changed

libraries/Camera/src/camera.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ int Camera::setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, i
545545
}
546546
HAL_DCMI_ConfigCROP(&hdcmi, 0, 0, bpl - 1, restab[final_resolution][1] - 1);
547547

548-
if (this->sensor->setResolution(resolution, zoom_resolution, zoom_x, zoom_y) == 0) {
548+
if (this->sensor->setResolutionWithZoom(resolution, zoom_resolution, zoom_x, zoom_y) == 0) {
549549
this->resolution = final_resolution;
550550
return 0;
551551
}

libraries/Camera/src/camera.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ class ImageSensor {
7171
virtual bool getMono() = 0;
7272
virtual uint32_t getClockFrequency() = 0;
7373
virtual int setFrameRate(int32_t framerate) = 0;
74-
virtual int setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y) = 0;
74+
virtual int setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y) = 0;
75+
virtual int setResolution(int32_t resolution) = 0;
7576
virtual int setPixelFormat(int32_t pixelformat) = 0;
7677
virtual int enableMotionDetection(md_callback_t callback) = 0;
7778
virtual int disableMotionDetection() = 0;
@@ -144,7 +145,7 @@ class Camera {
144145
int zoomTo(int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
145146
int zoomToCenter(int32_t zoom_resolution);
146147
int setVerticalFlip(bool flip_enable);
147-
int setHorizontalMirror(bool mirror_enable;
148+
int setHorizontalMirror(bool mirror_enable);
148149
uint32_t getResolutionWidth();
149150
uint32_t getResolutionHeight();
150151
void debug(Stream &stream);

libraries/GC2145/gc2145.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,12 @@ int GC2145::setHorizontalMirror(bool mirror_enable)
787787
return ((0 == retVal) ? 0 : -1);
788788
}
789789

790-
int GC2145::setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
790+
int GC2145::setResolution(int32_t resolution)
791+
{
792+
setResolutionWithZoom(resolution, resolution, 0, 0);
793+
}
794+
795+
int GC2145::setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
791796
{
792797
int ret = 0;
793798

libraries/GC2145/gc2145.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class GC2145: public ImageSensor {
3939
bool getMono() { return false; };
4040
uint32_t getClockFrequency() { return 12000000; };
4141
int setFrameRate(int32_t framerate);
42-
int setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
42+
int setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
43+
int setResolution(int32_t resolution);
4344
int setPixelFormat(int32_t pixformat);
4445
int enableMotionDetection(md_callback_t callback) { return 0; };
4546
int disableMotionDetection() { return 0; };
@@ -50,5 +51,5 @@ class GC2145: public ImageSensor {
5051
int setHorizontalMirror(bool mirror_enable);
5152
void debug(Stream &stream);
5253
};
53-
54+
5455
#endif /* __GC2145_H */

libraries/Himax_HM01B0/himax.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,12 @@ int HM01B0::setHorizontalMirror(bool mirror_enable)
351351
return -1;
352352
}
353353

354-
int HM01B0::setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
354+
int HM01B0::setResolution(int32_t resolution)
355+
{
356+
setResolutionWithZoom(resolution, resolution, 0, 0);
357+
}
358+
359+
int HM01B0::setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
355360
{
356361
int ret = 0;
357362

libraries/Himax_HM01B0/himax.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class HM01B0: public ImageSensor {
4040
bool getMono() { return true; };
4141
uint32_t getClockFrequency() { return 6000000; };
4242
int setFrameRate(int32_t framerate);
43-
int setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
43+
int setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
44+
int setResolution(int32_t resolution);
4445
int setPixelFormat(int32_t pixformat);
4546
int setTestPattern(bool enable, bool walking) override;
4647
int enableMotionDetection(md_callback_t callback=NULL);

libraries/Himax_HM0360/hm0360.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,12 @@ int HM0360::setHorizontalMirror(bool mirror_enable)
596596
return -1;
597597
}
598598

599-
int HM0360::setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
599+
int HM0360::setResolution(int32_t resolution)
600+
{
601+
setResolutionWithZoom(resolution, resolution, 0, 0);
602+
}
603+
604+
int HM0360::setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
600605
{
601606
int ret = 0;
602607

libraries/Himax_HM0360/hm0360.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class HM0360: public ImageSensor {
4040
bool getMono() { return true; };
4141
uint32_t getClockFrequency() { return 24000000; };
4242
int setFrameRate(int32_t framerate);
43-
int setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
43+
int setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
44+
int setResolution(int32_t resolution);
4445
int setPixelFormat(int32_t pixformat);
4546
int setTestPattern(bool enable, bool walking) override;
4647
int enableMotionDetection(md_callback_t callback=NULL);

libraries/OV7670/ov7670.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,12 @@ int OV7670::setHorizontalMirror(bool mirror_enable)
707707
return -1;
708708
}
709709

710-
int OV7670::setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
710+
int OV7670::setResolution(int32_t resolution)
711+
{
712+
setResolutionWithZoom(resolution, resolution, 0, 0);
713+
}
714+
715+
int OV7670::setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y)
711716
{
712717
int ret = 0;
713718

libraries/OV7670/ov767x.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class OV7670: public ImageSensor {
4545
bool getMono() { return false; };
4646
uint32_t getClockFrequency() { return 12000000; };
4747
int setFrameRate(int32_t framerate);
48-
int setResolution(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
48+
int setResolutionWithZoom(int32_t resolution, int32_t zoom_resolution, uint32_t zoom_x, uint32_t zoom_y);
49+
int setResolution(int32_t resolution);
4950
int setPixelFormat(int32_t pixformat);
5051
int enableMotionDetection(md_callback_t callback) { return 0; };
5152
int disableMotionDetection() { return 0; };

0 commit comments

Comments
 (0)