From 43c05731470c679e8b77744642310420b1005301 Mon Sep 17 00:00:00 2001 From: Sebastian Romero Date: Thu, 11 Jan 2024 22:20:51 +0100 Subject: [PATCH] Implement vflip and mirror for OV camera --- libraries/OV7670/ov7670.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/OV7670/ov7670.cpp b/libraries/OV7670/ov7670.cpp index f6fd3255b..15c1caa9d 100644 --- a/libraries/OV7670/ov7670.cpp +++ b/libraries/OV7670/ov7670.cpp @@ -699,12 +699,16 @@ int OV7670::setFrameRate(int32_t framerate) int OV7670::setVerticalFlip(bool flip_enable) { - return -1; + uint8_t currentRegisterValue = regRead(getID(), MVFP); + uint8_t newRegisterValue = flip_enable ? currentRegisterValue | MVFP_VFLIP : currentRegisterValue & ~MVFP_VFLIP; + return regWrite(getID(), MVFP, newRegisterValue); } int OV7670::setHorizontalMirror(bool mirror_enable) { - return -1; + uint8_t currentRegisterValue = regRead(getID(), MVFP); + uint8_t newRegisterValue = mirror_enable ? currentRegisterValue | MVFP_MIRROR : currentRegisterValue & ~MVFP_MIRROR; + return regWrite(getID(), MVFP, newRegisterValue); } int OV7670::setResolution(int32_t resolution)