Skip to content

Commit 5af0bd7

Browse files
authored
Merge pull request #827 from sebromero/sebromero/ov-flip-mirror
Implement vflip and mirror for OV cameras
2 parents f2af60a + 43c0573 commit 5af0bd7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libraries/OV7670/ov7670.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,16 @@ int OV7670::setFrameRate(int32_t framerate)
699699

700700
int OV7670::setVerticalFlip(bool flip_enable)
701701
{
702-
return -1;
702+
uint8_t currentRegisterValue = regRead(getID(), MVFP);
703+
uint8_t newRegisterValue = flip_enable ? currentRegisterValue | MVFP_VFLIP : currentRegisterValue & ~MVFP_VFLIP;
704+
return regWrite(getID(), MVFP, newRegisterValue);
703705
}
704706

705707
int OV7670::setHorizontalMirror(bool mirror_enable)
706708
{
707-
return -1;
709+
uint8_t currentRegisterValue = regRead(getID(), MVFP);
710+
uint8_t newRegisterValue = mirror_enable ? currentRegisterValue | MVFP_MIRROR : currentRegisterValue & ~MVFP_MIRROR;
711+
return regWrite(getID(), MVFP, newRegisterValue);
708712
}
709713

710714
int OV7670::setResolution(int32_t resolution)

0 commit comments

Comments
 (0)