Sync inav to Gitea
Make sure docs are updated / settings_md (push) Canceled after 0s
Build firmware / test (push) Canceled after 0s
Build firmware / build-SITL-Windows (push) Canceled after 0s
Build firmware / build-SITL-Mac (push) Canceled after 0s
Build firmware / build-SITL-Linux (push) Canceled after 0s
Build firmware / build-SITL-Linux-arm64 (push) Canceled after 0s
Build firmware / upload-artifacts (push) Canceled after 0s
Build firmware / build-single-target (push) Canceled after 0s
Build firmware / build (9) (push) Canceled after 0s
Build firmware / build (8) (push) Canceled after 0s
Build firmware / build (7) (push) Canceled after 0s
Build firmware / build (6) (push) Canceled after 0s
Build firmware / build (5) (push) Canceled after 0s
Build firmware / build (4) (push) Canceled after 0s
Build firmware / build (3) (push) Canceled after 0s
Build firmware / build (2) (push) Canceled after 0s
Build firmware / build (14) (push) Canceled after 0s
Build firmware / build (13) (push) Canceled after 0s
Build firmware / build (12) (push) Canceled after 0s
Build firmware / build (11) (push) Canceled after 0s
Build firmware / build (10) (push) Canceled after 0s
Build firmware / build (1) (push) Canceled after 0s
Build firmware / build (0) (push) Canceled after 0s
Build firmware / detect (push) Canceled after 0s
Build pre-release / build (push) Canceled after 0s
Build pre-release / Release (push) Canceled after 0s

This commit is contained in:
2026-08-03 16:37:40 +08:00
commit dac37fd077
14095 changed files with 5603119 additions and 0 deletions
@@ -0,0 +1,37 @@
---
name: 'Bug report'
about: 'Create a report to help us improve the quality of our software'
title: ''
labels: ''
assignees: ''
---
**Caution**
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the **ST Community** in the STM32 MCUs dedicated [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
**Describe the set-up**
* The board (either ST RPN reference or your custom board)
* IDE or at least the compiler and its version
**Describe the bug (skip if none)**
A clear and concise description of what the bug is.
**How to reproduce the bug (skip if none)**
1. Indicate the global behavior of your application project
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
3. Describe the use case that generates the problem
4. How we can reproduce the problem
**Additional context**
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
**Screenshots**
If applicable, add screenshots to help explain your problem.
@@ -0,0 +1,3 @@
## IMPORTANT INFORMATION
Pull-requests are **not** accepted on this repository. Please use issues to report any bug or request.
@@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team via this [link](https://www.st.com/content/st_com/en/contact-us.html).
All complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4,
available [here](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
For answers to common questions about this code of conduct, see the [FAQ section](https://www.contributor-covenant.org/faq).
@@ -0,0 +1,28 @@
## Contributing guide
This document serves as a checklist before contributing to this repository.
It includes links to read up on if topics are unclear to you.
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
### 1. Before opening an issue
To report a bug or a request please file an issue in the right repository
(example for [ov5640](https://github.com/STMicroelectronics/ov5640/issues/new/choose)).
Please check the following boxes before posting an issue:
- [ ] `Make sure you are using the latest commit (major releases are tagged, but corrections are available as new commits).`
- [ ] `Make sure your issue is a question/feedback/suggestions RELATED TO the software provided in this repository.` Otherwise, it should be submitted to the ST Community under the MCU topic [page](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
### 2. Posting the issue
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository.
### 3. Pull Requests
Pull-requests are **not** accepted on this repository. Please use **issues** to report any bug or request.
### 4. How to proceed
* We recommend to engage first a communication thru an issue, in order to present your proposal. Just to confirm that it corresponds to STMicroelectronics domain or scope.
* Then fork the project to your GitHub account to further develop your contribution. Please use the latest commit version.
* Please, submit one Pull Request for one new feature or proposal. This will ease the analysis and the final merge if accepted.
@@ -0,0 +1,3 @@
# Copyright (c) 2019 STMicroelectronics
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
@@ -0,0 +1,40 @@
# BSP OV5640 Component
## Overview
**STM32Cube** is an STMicroelectronics original initiative to ease the developers life by reducing efforts, time and cost.
**STM32Cube** covers the overall STM32 products portfolio. It includes a comprehensive embedded software platform delivered for each STM32 series.
* The CMSIS modules (core and device) corresponding to the ARM(tm) core implemented in this STM32 product.
* The STM32 HAL-LL drivers, an abstraction layer offering a set of APIs ensuring maximized portability across the STM32 portfolio.
* The BSP drivers of each evaluation, demonstration or nucleo board provided for this STM32 series.
* A consistent set of middleware components such as RTOS, USB, FatFS, graphics, touch sensing library...
* A full set of software projects (basic examples, applications, and demonstrations) for each board provided for this STM32 series.
Two models of publication are proposed for the STM32Cube embedded software:
* The monolithic **MCU Package**: all STM32Cube software modules of one STM32 series are present (Drivers, Middleware, Projects, Utilities) in the repository (usual name **STM32Cubexx**, xx corresponding to the STM32 series).
* The **MCU component**: each STM32Cube software module being part of the STM32Cube MCU Package, is delivered as an individual repository, allowing the user to select and get only the required software functions.
## Description
This **ov5640** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **OV5640** BSP CAMERA component part.
## License
Copyright (c) 2019 STMicroelectronics
This software component is licensed by STMicroelectronics under the **BSD-3-Clause** license. You may not use this software except in compliance with this license. You may obtain a copy of the license [here](https://opensource.org/licenses/BSD-3-Clause).
## Release note
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/ov5640/blob/main/Release_Notes.html).
## Compatibility information
Please refer to the repository of the BSP **board** driver you are using to know which version of this BSP component driver to use. It is **crucial** that you use a consistent set of versions. It is **crucial** that you use a consistent set of versions as indicated.
## Troubleshooting
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/ov5640/issues/new/choose).
For any other question related to the product, the tools, the environment, you can submit a topic to the [ST Community](https://community.st.com/s/).
@@ -0,0 +1,140 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for OV5640 Component Driver</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="_htmresc/mini-st_2020.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
<link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<center>
<h1 id="release-notes-for-ov5640-component-driver">Release Notes for <mark>OV5640</mark> Component Driver</h1>
<p>Copyright © 2020 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo_2020.png" alt="ST logo" /></a>
</center>
<h1 id="license">License</h1>
This software component is licensed by ST under BSD 3-Clause license, the “License”; You may not use this component except in compliance with the License. You may obtain a copy of the License at:
<center>
<a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a>
</center>
<h1 id="purpose">Purpose</h1>
<p>This driver provides a set of camera functions offered by OV5640 component</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section5" checked aria-hidden="true"> <label for="collapse-section5" aria-hidden="true"><strong>V3.2.0 / 26-january-2021</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Set default Pixel clock to 12Mhz</li>
<li>Add OV5640_SetPixelClock() API</li>
<li>Set HTS and VTS timings to get 7.5fps when using default PCLK=12MHz</li>
<li>Check Misra-C 2012 coding rules compliancy</li>
<li>Formatting update</li>
</ul>
<h2 id="section"></h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V3.1.0 / 11-December-2020</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Add support of RGB888, YUV422, Y8 and JPEG formats</li>
<li>Add support gradual vertical colorbar</li>
<li>Codespell miss-spelling errors correction.</li>
</ul>
<h2 id="section-1"></h2>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V3.0.0 / 17-April-2020</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Second Official Release of OV5640 Camera Component drivers in line with legacy BSP drivers development guidelines</li>
<li>Add Support of the following features:
<ul>
<li>OV5640 SetPolarities</li>
<li>OV5640 GetPolarities</li>
<li>OV5640 ColorBar handling</li>
<li>OV5640 Embedded Synchronization mode</li>
</ul></li>
</ul>
<h2 id="dependencies">Dependencies</h2>
<p>This software release is compatible with:</p>
<ul>
<li>BSP Common version v6.0.0 or above</li>
</ul>
<h2 id="backward-compatibility">Backward compatibility</h2>
<ul>
<li>This software breaks the compatibility with previous version v2.0.0</li>
<li>This software is compatible with version v1.0.0</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V2.0.0 / 07-February-2020</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>Official Release of OV5640 Camera Component drivers in line with legacy BSP drivers development guidelines<br />
</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: ov5640.h/.c</li>
</ul></li>
</ul>
<h2 id="dependencies-1">Dependencies</h2>
<p>This software release is compatible with:</p>
<ul>
<li>BSP Common version v5.1.2 or lower versions</li>
</ul>
<h2 id="backward-compatibility-1">Backward compatibility</h2>
<ul>
<li>This software breaks the compatibility with previous version v1.0.0</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 30-0ctober-2019</strong></label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<ul>
<li>First Official Release of OV5640 Camera Component drivers in line with STM32Cube BSP drivers development guidelines (UM2298)<br />
</li>
<li>The component drivers are composed of
<ul>
<li>component core drivers files: ov5640.h/.c</li>
<li>component register drivers files: ov5640_regs.h/.c</li>
</ul></li>
</ul>
<h2 id="dependencies-2">Dependencies</h2>
<p>This software release is compatible with:</p>
<ul>
<li>BSP Common v6.0.0 or above</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <span style="font-color: blue;"><a href="http://www.st.com/STM32">www.st.com</a></span>
</footer>
</body>
</html>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><g fill="#13254a"><path d="M100 .212C44.868.212 0 44.889 0 99.788c0 55.132 44.868 100 100 100s100-44.868 100-100C200 44.889 155.132.212 100 .212zm0 181.164c-44.974 0-81.587-36.614-81.587-81.587 0-44.762 36.614-81.164 81.587-81.164 44.995 0 81.587 36.402 81.587 81.164 0 44.973-36.592 81.587-81.587 81.587z" style="fill: #e6007e;"/><path d="M141.1 88.127h-29.439V58.688c0-6.392-5.185-11.598-11.598-11.598-6.413 0-11.619 5.206-11.619 11.598v29.439H58.476c-6.392 0-11.598 5.185-11.598 11.598 0 6.413 5.206 11.619 11.598 11.619h29.968v29.968c0 6.392 5.206 11.598 11.619 11.598 6.413 0 11.598-5.206 11.598-11.598v-29.968H141.1c6.392 0 11.598-5.206 11.598-11.619 0-6.413-5.206-11.598-11.598-11.598z" style="fill: #e6007e;"/></g></svg>

After

Width:  |  Height:  |  Size: 830 B

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><g fill="#03234b"><path d="M170.934 64.569l-.04-.055-29.049 40.038-.057.079h14.867a59.366 59.366 0 0 1-1.488 15.615c-1.158 5.318-3.807 13.448-9.848 21.977-2.766 4.118-6.375 7.726-9.208 10.408-3.426 2.857-7.461 6.095-12 8.376-8.121 4.568-17.881 7.138-28.225 7.432-10.907.248-20.201-2.61-26.072-5.052-8.283-3.479-14.111-7.807-16.85-10.078-1.254-.956-2.25-1.907-3.057-2.676a28.662 28.662 0 0 0-1.157-1.069 158.874 158.874 0 0 0-1.479-1.362l-4.435-3.956 3.569 4.81.183.243c.2.263.548.722 1.048 1.389.276.334.579.747.93 1.226l.008.01c.689.939 1.546 2.107 2.664 3.322 3 3.536 8.178 8.801 15.808 13.801 5.969 3.866 15.672 8.901 28.001 10.935a79.05 79.05 0 0 0 12.485.998c7.97 0 15.651-1.228 22.828-3.649 6.366-1.877 12.192-4.981 17.053-7.771 6.16-3.936 10.817-7.586 14.654-11.488 8.084-7.899 14.884-17.913 19.15-28.199 3.259-7.594 5.456-15.727 6.529-24.175l.055-.425.083-.641H200l-29.066-40.063zM58.159 99.232l-12.655.563c-.097-.881-.159-1.986-.227-3.474a59.184 59.184 0 0 1 1.446-16.56c1.157-5.316 3.804-13.444 9.848-21.977 2.168-3.228 5.009-6.44 9.208-10.415 3.41-2.849 7.432-6.08 12.005-8.375 8.114-4.568 17.87-7.138 28.213-7.432 10.9-.25 20.196 2.607 26.072 5.045 8.258 3.473 14.105 7.812 16.857 10.091 1.257.951 2.253 1.904 3.057 2.673l.017.016c.43.411.801.766 1.136 1.051.475.438.841.777 1.091 1.01l.138.128.248.229 4.04 3.613-3.165-4.456c-.058-.083-.312-.417-.73-.971l-.507-.67a28.922 28.922 0 0 1-.901-1.192l-.02-.027c-.69-.945-1.548-2.121-2.677-3.346-3.002-3.537-8.182-8.803-15.813-13.801-5.964-3.865-15.662-8.9-27.997-10.935-8.484-1.363-21.496-2.009-35.313 2.651-6.355 1.88-12.186 4.983-17.054 7.772-6.163 3.944-10.82 7.595-14.654 11.488-8.079 7.894-14.882 17.909-19.155 28.2-3.268 7.624-5.463 15.757-6.523 24.173-.436 3.281-.642 5.421-.664 6.926L0 101.831l30.683 38.727.042.053 27.38-41.298.054-.081z" style="fill: #e6007e;"/></g></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

File diff suppressed because it is too large Load Diff
@@ -0,0 +1,251 @@
/**
******************************************************************************
* @file ov5640.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the ov5640.c
* driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef OV5640_H
#define OV5640_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "ov5640_reg.h"
#include <stddef.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ov5640
* @{
*/
/** @defgroup OV5640_Exported_Types
* @{
*/
typedef int32_t (*OV5640_Init_Func)(void);
typedef int32_t (*OV5640_DeInit_Func)(void);
typedef int32_t (*OV5640_GetTick_Func)(void);
typedef int32_t (*OV5640_Delay_Func)(uint32_t);
typedef int32_t (*OV5640_WriteReg_Func)(uint16_t, uint16_t, uint8_t *, uint16_t);
typedef int32_t (*OV5640_ReadReg_Func)(uint16_t, uint16_t, uint8_t *, uint16_t);
typedef struct
{
OV5640_Init_Func Init;
OV5640_DeInit_Func DeInit;
uint16_t Address;
OV5640_WriteReg_Func WriteReg;
OV5640_ReadReg_Func ReadReg;
OV5640_GetTick_Func GetTick;
} OV5640_IO_t;
typedef struct
{
OV5640_IO_t IO;
ov5640_ctx_t Ctx;
uint8_t IsInitialized;
} OV5640_Object_t;
typedef struct
{
uint8_t FrameStartCode; /*!< Specifies the code of the frame start delimiter. */
uint8_t LineStartCode; /*!< Specifies the code of the line start delimiter. */
uint8_t LineEndCode; /*!< Specifies the code of the line end delimiter. */
uint8_t FrameEndCode; /*!< Specifies the code of the frame end delimiter. */
} OV5640_SyncCodes_t;
typedef struct
{
uint32_t Config_Resolution;
uint32_t Config_LightMode;
uint32_t Config_SpecialEffect;
uint32_t Config_Brightness;
uint32_t Config_Saturation;
uint32_t Config_Contrast;
uint32_t Config_HueDegree;
uint32_t Config_MirrorFlip;
uint32_t Config_Zoom;
uint32_t Config_NightMode;
} OV5640_Capabilities_t;
typedef struct
{
int32_t (*Init)(OV5640_Object_t *, uint32_t, uint32_t);
int32_t (*DeInit)(OV5640_Object_t *);
int32_t (*ReadID)(OV5640_Object_t *, uint32_t *);
int32_t (*GetCapabilities)(OV5640_Object_t *, OV5640_Capabilities_t *);
int32_t (*SetLightMode)(OV5640_Object_t *, uint32_t);
int32_t (*SetColorEffect)(OV5640_Object_t *, uint32_t);
int32_t (*SetBrightness)(OV5640_Object_t *, int32_t);
int32_t (*SetSaturation)(OV5640_Object_t *, int32_t);
int32_t (*SetContrast)(OV5640_Object_t *, int32_t);
int32_t (*SetHueDegree)(OV5640_Object_t *, int32_t);
int32_t (*MirrorFlipConfig)(OV5640_Object_t *, uint32_t);
int32_t (*ZoomConfig)(OV5640_Object_t *, uint32_t);
int32_t (*SetResolution)(OV5640_Object_t *, uint32_t);
int32_t (*GetResolution)(OV5640_Object_t *, uint32_t *);
int32_t (*SetPixelFormat)(OV5640_Object_t *, uint32_t);
int32_t (*GetPixelFormat)(OV5640_Object_t *, uint32_t *);
int32_t (*NightModeConfig)(OV5640_Object_t *, uint32_t);
} OV5640_CAMERA_Drv_t;
/**
* @}
*/
/** @defgroup OV5640_Exported_Constants
* @{
*/
#define OV5640_OK (0)
#define OV5640_ERROR (-1)
/**
* @brief OV5640 Features Parameters
*/
/* Camera resolutions */
#define OV5640_R160x120 0x00U /* QQVGA Resolution */
#define OV5640_R320x240 0x01U /* QVGA Resolution */
#define OV5640_R480x272 0x02U /* 480x272 Resolution */
#define OV5640_R640x480 0x03U /* VGA Resolution */
#define OV5640_R800x480 0x04U /* WVGA Resolution */
/* Camera Pixel Format */
#define OV5640_RGB565 0x00U /* Pixel Format RGB565 */
#define OV5640_RGB888 0x01U /* Pixel Format RGB888 */
#define OV5640_YUV422 0x02U /* Pixel Format YUV422 */
#define OV5640_Y8 0x07U /* Pixel Format Y8 */
#define OV5640_JPEG 0x08U /* Compressed format JPEG */
/* Polarity */
#define OV5640_POLARITY_PCLK_LOW 0x00U /* Signal Active Low */
#define OV5640_POLARITY_PCLK_HIGH 0x01U /* Signal Active High */
#define OV5640_POLARITY_HREF_LOW 0x00U /* Signal Active Low */
#define OV5640_POLARITY_HREF_HIGH 0x01U /* Signal Active High */
#define OV5640_POLARITY_VSYNC_LOW 0x01U /* Signal Active Low */
#define OV5640_POLARITY_VSYNC_HIGH 0x00U /* Signal Active High */
/* Mirror/Flip */
#define OV5640_MIRROR_FLIP_NONE 0x00U /* Set camera normal mode */
#define OV5640_FLIP 0x01U /* Set camera flip config */
#define OV5640_MIRROR 0x02U /* Set camera mirror config */
#define OV5640_MIRROR_FLIP 0x03U /* Set camera mirror and flip */
/* Zoom */
#define OV5640_ZOOM_x8 0x00U /* Set zoom to x8 */
#define OV5640_ZOOM_x4 0x11U /* Set zoom to x4 */
#define OV5640_ZOOM_x2 0x22U /* Set zoom to x2 */
#define OV5640_ZOOM_x1 0x44U /* Set zoom to x1 */
/* Special Effect */
#define OV5640_COLOR_EFFECT_NONE 0x00U /* No effect */
#define OV5640_COLOR_EFFECT_BLUE 0x01U /* Blue effect */
#define OV5640_COLOR_EFFECT_RED 0x02U /* Red effect */
#define OV5640_COLOR_EFFECT_GREEN 0x04U /* Green effect */
#define OV5640_COLOR_EFFECT_BW 0x08U /* Black and White effect */
#define OV5640_COLOR_EFFECT_SEPIA 0x10U /* Sepia effect */
#define OV5640_COLOR_EFFECT_NEGATIVE 0x20U /* Negative effect */
/* Light Mode */
#define OV5640_LIGHT_AUTO 0x00U /* Light Mode Auto */
#define OV5640_LIGHT_SUNNY 0x01U /* Light Mode Sunny */
#define OV5640_LIGHT_OFFICE 0x02U /* Light Mode Office */
#define OV5640_LIGHT_HOME 0x04U /* Light Mode Home */
#define OV5640_LIGHT_CLOUDY 0x08U /* Light Mode Claudy */
/* Night Mode */
#define NIGHT_MODE_DISABLE 0x00U /* Disable night mode */
#define NIGHT_MODE_ENABLE 0x01U /* Enable night mode */
/* Colorbar Mode */
#define COLORBAR_MODE_DISABLE 0x00U /* Disable colorbar mode */
#define COLORBAR_MODE_ENABLE 0x01U /* 8 bars W/Y/C/G/M/R/B/Bl */
#define COLORBAR_MODE_GRADUALV 0x02U /* Gradual vertical colorbar */
/* Pixel Clock */
#define OV5640_PCLK_7M 0x00U /* Pixel Clock set to 7Mhz */
#define OV5640_PCLK_8M 0x01U /* Pixel Clock set to 8Mhz */
#define OV5640_PCLK_9M 0x02U /* Pixel Clock set to 9Mhz */
#define OV5640_PCLK_12M 0x04U /* Pixel Clock set to 12Mhz */
#define OV5640_PCLK_24M 0x08U /* Pixel Clock set to 24Mhz */
/**
* @}
*/
/** @defgroup OV5640_Exported_Functions OV5640 Exported Functions
* @{
*/
int32_t OV5640_RegisterBusIO(OV5640_Object_t *pObj, OV5640_IO_t *pIO);
int32_t OV5640_Init(OV5640_Object_t *pObj, uint32_t Resolution, uint32_t PixelFormat);
int32_t OV5640_DeInit(OV5640_Object_t *pObj);
int32_t OV5640_ReadID(OV5640_Object_t *pObj, uint32_t *Id);
int32_t OV5640_GetCapabilities(OV5640_Object_t *pObj, OV5640_Capabilities_t *Capabilities);
int32_t OV5640_SetLightMode(OV5640_Object_t *pObj, uint32_t LightMode);
int32_t OV5640_SetColorEffect(OV5640_Object_t *pObj, uint32_t Effect);
int32_t OV5640_SetBrightness(OV5640_Object_t *pObj, int32_t Level);
int32_t OV5640_SetSaturation(OV5640_Object_t *pObj, int32_t Level);
int32_t OV5640_SetContrast(OV5640_Object_t *pObj, int32_t Level);
int32_t OV5640_SetHueDegree(OV5640_Object_t *pObj, int32_t Degree);
int32_t OV5640_MirrorFlipConfig(OV5640_Object_t *pObj, uint32_t Config);
int32_t OV5640_ZoomConfig(OV5640_Object_t *pObj, uint32_t Zoom);
int32_t OV5640_SetResolution(OV5640_Object_t *pObj, uint32_t Resolution);
int32_t OV5640_GetResolution(OV5640_Object_t *pObj, uint32_t *Resolution);
int32_t OV5640_SetPixelFormat(OV5640_Object_t *pObj, uint32_t PixelFormat);
int32_t OV5640_GetPixelFormat(OV5640_Object_t *pObj, uint32_t *PixelFormat);
int32_t OV5640_SetPolarities(OV5640_Object_t *pObj, uint32_t PclkPolarity, uint32_t HrefPolarity,
uint32_t VsyncPolarity);
int32_t OV5640_GetPolarities(OV5640_Object_t *pObj, uint32_t *PclkPolarity, uint32_t *HrefPolarity,
uint32_t *VsyncPolarity);
int32_t OV5640_NightModeConfig(OV5640_Object_t *pObj, uint32_t Cmd);
int32_t OV5640_ColorbarModeConfig(OV5640_Object_t *pObj, uint32_t Cmd);
int32_t OV5640_EmbeddedSynchroConfig(OV5640_Object_t *pObj, OV5640_SyncCodes_t *pSyncCodes);
int32_t OV5640_SetPCLK(OV5640_Object_t *pObj, uint32_t ClockValue);
/* CAMERA driver structure */
extern OV5640_CAMERA_Drv_t OV5640_CAMERA_Driver;
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* OV5640_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,76 @@
/**
******************************************************************************
* @file ov5640_reg.c
* @author MCD Application Team
* @brief This file provides unitary register function to control the OV5640
* Camera driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "ov5640_reg.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup OV5640
* @brief This file provides a set of functions needed to drive the
* OV5640 Camera sensor.
* @{
*/
/**
* @brief Read OV5640 component registers
* @param ctx component contex
* @param reg Register to read from
* @param pdata Pointer to data buffer
* @param length Number of data to read
* @retval Component status
*/
int32_t ov5640_read_reg(ov5640_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length)
{
return ctx->ReadReg(ctx->handle, reg, pdata, length);
}
/**
* @brief Write OV5640 component registers
* @param ctx component contex
* @param reg Register to write to
* @param pdata Pointer to data buffer
* @param length Number of data to write
* @retval Component status
*/
int32_t ov5640_write_reg(ov5640_ctx_t *ctx, uint16_t reg, uint8_t *data, uint16_t length)
{
return ctx->WriteReg(ctx->handle, reg, data, length);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,760 @@
/**
******************************************************************************
* @file ov5640_reg.h
* @author MCD Application Team
* @brief Header of ov5640_reg.c
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef OV5640_REG_H
#define OV5640_REG_H
#include <cmsis_compiler.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup OV5640
* @{
*/
/** @defgroup OV5640_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup OV5640_Exported_Constants OV5640 Exported Constants
* @{
*/
/**
* @brief OV5640 ID
*/
#define OV5640_ID 0x5640U
/**
* @brief OV5640 Registers
*/
/* system and IO pad control [0x3000 ~ 0x3052] */
#define OV5640_SYSREM_RESET00 0x3000U
#define OV5640_SYSREM_RESET01 0x3001U
#define OV5640_SYSREM_RESET02 0x3002U
#define OV5640_SYSREM_RESET03 0x3003U
#define OV5640_CLOCK_ENABLE00 0x3004U
#define OV5640_CLOCK_ENABLE01 0x3005U
#define OV5640_CLOCK_ENABLE02 0x3006U
#define OV5640_CLOCK_ENABLE03 0x3007U
#define OV5640_SYSTEM_CTROL0 0x3008U
#define OV5640_CHIP_ID_HIGH_BYTE 0x300AU
#define OV5640_CHIP_ID_LOW_BYTE 0x300BU
#define OV5640_MIPI_CONTROL00 0x300EU
#define OV5640_PAD_OUTPUT_ENABLE00 0x3016U
#define OV5640_PAD_OUTPUT_ENABLE01 0x3017U
#define OV5640_PAD_OUTPUT_ENABLE02 0x3018U
#define OV5640_PAD_OUTPUT_VALUE00 0x3019U
#define OV5640_PAD_OUTPUT_VALUE01 0x301AU
#define OV5640_PAD_OUTPUT_VALUE02 0x301BU
#define OV5640_PAD_SELECT00 0x301CU
#define OV5640_PAD_SELECT01 0x301DU
#define OV5640_PAD_SELECT02 0x301EU
#define OV5640_CHIP_REVISION 0x302AU
#define OV5640_PAD_CONTROL00 0x301CU
#define OV5640_SC_PWC 0x3031U
#define OV5640_SC_PLL_CONTRL0 0x3034U
#define OV5640_SC_PLL_CONTRL1 0x3035U
#define OV5640_SC_PLL_CONTRL2 0x3036U
#define OV5640_SC_PLL_CONTRL3 0x3037U
#define OV5640_SC_PLL_CONTRL4 0x3038U
#define OV5640_SC_PLL_CONTRL5 0x3039U
#define OV5640_SC_PLLS_CTRL0 0x303AU
#define OV5640_SC_PLLS_CTRL1 0x303BU
#define OV5640_SC_PLLS_CTRL2 0x303CU
#define OV5640_SC_PLLS_CTRL3 0x303DU
#define OV5640_IO_PAD_VALUE00 0x3050U
#define OV5640_IO_PAD_VALUE01 0x3051U
#define OV5640_IO_PAD_VALUE02 0x3052U
/* SCCB control [0x3100 ~ 0x3108] */
#define OV5640_SCCB_ID 0x3100U
#define OV5640_SCCB_SYSTEM_CTRL0 0x3102U
#define OV5640_SCCB_SYSTEM_CTRL1 0x3103U
#define OV5640_SYSTEM_ROOT_DIVIDER 0x3108U
/* SRB control [0x3200 ~ 0x3213] */
#define OV5640_GROUP_ADDR0 0x3200U
#define OV5640_GROUP_ADDR1 0x3201U
#define OV5640_GROUP_ADDR2 0x3202U
#define OV5640_GROUP_ADDR3 0x3203U
#define OV5640_SRM_GROUP_ACCESS 0x3212U
#define OV5640_SRM_GROUP_STATUS 0x3213U
/* AWB gain control [0x3400 ~ 0x3406] */
#define OV5640_AWB_R_GAIN_MSB 0x3400U
#define OV5640_AWB_R_GAIN_LSB 0x3401U
#define OV5640_AWB_G_GAIN_MSB 0x3402U
#define OV5640_AWB_G_GAIN_LSB 0x3403U
#define OV5640_AWB_B_GAIN_MSB 0x3404U
#define OV5640_AWB_B_GAIN_LSB 0x3405U
#define OV5640_AWB_MANUAL_CONTROL 0x3406U
/* AEC/AGC control [0x3500 ~ 0x350D] */
#define OV5640_AEC_PK_EXPOSURE_19_16 0x3500U
#define OV5640_AEC_PK_EXPOSURE_HIGH 0x3501U
#define OV5640_AEC_PK_EXPOSURE_LOW 0x3502U
#define OV5640_AEC_PK_MANUAL 0x3503U
#define OV5640_AEC_PK_REAL_GAIN_9_8 0x350AU
#define OV5640_AEC_PK_REAL_GAIN_LOW 0x350BU
#define OV5640_AEC_PK_VTS_HIGH 0x350CU
#define OV5640_AEC_PK_VTS_LOW 0x350DU
/* VCM control [0x3600 ~ 0x3606] */
#define OV5640_VCM_CONTROL_0 0x3602U
#define OV5640_VCM_CONTROL_1 0x3603U
#define OV5640_VCM_CONTROL_2 0x3604U
#define OV5640_VCM_CONTROL_3 0x3605U
#define OV5640_VCM_CONTROL_4 0x3606U
/* timing control [0x3800 ~ 0x3821] */
#define OV5640_TIMING_HS_HIGH 0x3800U
#define OV5640_TIMING_HS_LOW 0x3801U
#define OV5640_TIMING_VS_HIGH 0x3802U
#define OV5640_TIMING_VS_LOW 0x3803U
#define OV5640_TIMING_HW_HIGH 0x3804U
#define OV5640_TIMING_HW_LOW 0x3805U
#define OV5640_TIMING_VH_HIGH 0x3806U
#define OV5640_TIMING_VH_LOW 0x3807U
#define OV5640_TIMING_DVPHO_HIGH 0x3808U
#define OV5640_TIMING_DVPHO_LOW 0x3809U
#define OV5640_TIMING_DVPVO_HIGH 0x380AU
#define OV5640_TIMING_DVPVO_LOW 0x380BU
#define OV5640_TIMING_HTS_HIGH 0x380CU
#define OV5640_TIMING_HTS_LOW 0x380DU
#define OV5640_TIMING_VTS_HIGH 0x380EU
#define OV5640_TIMING_VTS_LOW 0x380FU
#define OV5640_TIMING_HOFFSET_HIGH 0x3810U
#define OV5640_TIMING_HOFFSET_LOW 0x3811U
#define OV5640_TIMING_VOFFSET_HIGH 0x3812U
#define OV5640_TIMING_VOFFSET_LOW 0x3813U
#define OV5640_TIMING_X_INC 0x3814U
#define OV5640_TIMING_Y_INC 0x3815U
#define OV5640_HSYNC_START_HIGH 0x3816U
#define OV5640_HSYNC_START_LOW 0x3817U
#define OV5640_HSYNC_WIDTH_HIGH 0x3818U
#define OV5640_HSYNC_WIDTH_LOW 0x3819U
#define OV5640_TIMING_TC_REG20 0x3820U
#define OV5640_TIMING_TC_REG21 0x3821U
/* AEC/AGC power down domain control [0x3A00 ~ 0x3A25] */
#define OV5640_AEC_CTRL00 0x3A00U
#define OV5640_AEC_CTRL01 0x3A01U
#define OV5640_AEC_CTRL02 0x3A02U
#define OV5640_AEC_CTRL03 0x3A03U
#define OV5640_AEC_CTRL04 0x3A04U
#define OV5640_AEC_CTRL05 0x3A05U
#define OV5640_AEC_CTRL06 0x3A06U
#define OV5640_AEC_CTRL07 0x3A07U
#define OV5640_AEC_B50_STEP_HIGH 0x3A08U
#define OV5640_AEC_B50_STEP_LOW 0x3A09U
#define OV5640_AEC_B60_STEP_HIGH 0x3A0AU
#define OV5640_AEC_B60_STEP_LOW 0x3A0BU
#define OV5640_AEC_AEC_CTRL0C 0x3A0CU
#define OV5640_AEC_CTRL0D 0x3A0DU
#define OV5640_AEC_CTRL0E 0x3A0EU
#define OV5640_AEC_CTRL0F 0x3A0FU
#define OV5640_AEC_CTRL10 0x3A10U
#define OV5640_AEC_CTRL11 0x3A11U
#define OV5640_AEC_CTRL13 0x3A13U
#define OV5640_AEC_MAX_EXPO_HIGH 0x3A14U
#define OV5640_AEC_MAX_EXPO_LOW 0x3A15U
#define OV5640_AEC_CTRL17 0x3A17U
#define OV5640_AEC_GAIN_CEILING_HIGH 0x3A18U
#define OV5640_AEC_GAIN_CEILING_LOW 0x3A19U
#define OV5640_AEC_DIFF_MIN 0x3A1AU
#define OV5640_AEC_CTRL1B 0x3A1BU
#define OV5640_LED_ADD_ROW_HIGH 0x3A1CU
#define OV5640_LED_ADD_ROW_LOW 0x3A1DU
#define OV5640_AEC_CTRL1E 0x3A1EU
#define OV5640_AEC_CTRL1F 0x3A1FU
#define OV5640_AEC_CTRL20 0x3A20U
#define OV5640_AEC_CTRL21 0x3A21U
#define OV5640_AEC_CTRL25 0x3A25U
/* strobe control [0x3B00 ~ 0x3B0C] */
#define OV5640_STROBE_CTRL 0x3B00U
#define OV5640_FREX_EXPOSURE02 0x3B01U
#define OV5640_FREX_SHUTTER_DLY01 0x3B02U
#define OV5640_FREX_SHUTTER_DLY00 0x3B03U
#define OV5640_FREX_EXPOSURE01 0x3B04U
#define OV5640_FREX_EXPOSURE00 0x3B05U
#define OV5640_FREX_CTRL07 0x3B06U
#define OV5640_FREX_MODE 0x3B07U
#define OV5640_FREX_RQST 0x3B08U
#define OV5640_FREX_HREF_DLY 0x3B09U
#define OV5640_FREX_RST_LENGTH 0x3B0AU
#define OV5640_STROBE_WIDTH_HIGH 0x3B0BU
#define OV5640_STROBE_WIDTH_LOW 0x3B0CU
/* 50/60Hz detector control [0x3C00 ~ 0x3C1E] */
#define OV5640_5060HZ_CTRL00 0x3C00U
#define OV5640_5060HZ_CTRL01 0x3C01U
#define OV5640_5060HZ_CTRL02 0x3C02U
#define OV5640_5060HZ_CTRL03 0x3C03U
#define OV5640_5060HZ_CTRL04 0x3C04U
#define OV5640_5060HZ_CTRL05 0x3C05U
#define OV5640_LIGHTMETER1_TH_HIGH 0x3C06U
#define OV5640_LIGHTMETER1_TH_LOW 0x3C07U
#define OV5640_LIGHTMETER2_TH_HIGH 0x3C08U
#define OV5640_LIGHTMETER2_TH_LOW 0x3C09U
#define OV5640_SAMPLE_NUMBER_HIGH 0x3C0AU
#define OV5640_SAMPLE_NUMBER_LOW 0x3C0BU
#define OV5640_SIGMA_DELTA_CTRL0C 0x3C0CU
#define OV5640_SUM50_BYTE4 0x3C0DU
#define OV5640_SUM50_BYTE3 0x3C0EU
#define OV5640_SUM50_BYTE2 0x3C0FU
#define OV5640_SUM50_BYTE1 0x3C10U
#define OV5640_SUM60_BYTE4 0x3C11U
#define OV5640_SUM60_BYTE3 0x3C12U
#define OV5640_SUM60_BYTE2 0x3C13U
#define OV5640_SUM60_BYTE1 0x3C14U
#define OV5640_SUM5060_HIGH 0x3C15U
#define OV5640_SUM5060_LOW 0x3C16U
#define OV5640_BLOCK_CNTR_HIGH 0x3C17U
#define OV5640_BLOCK_CNTR_LOW 0x3C18U
#define OV5640_B6_HIGH 0x3C19U
#define OV5640_B6_LOW 0x3C1AU
#define OV5640_LIGHTMETER_OUTPUT_BYTE3 0x3C1BU
#define OV5640_LIGHTMETER_OUTPUT_BYTE2 0x3C1CU
#define OV5640_LIGHTMETER_OUTPUT_BYTE1 0x3C1DU
#define OV5640_SUM_THRESHOLD 0x3C1EU
/* OTP control [0x3D00 ~ 0x3D21] */
/* MC control [0x3F00 ~ 0x3F0D] */
/* BLC control [0x4000 ~ 0x4033] */
#define OV5640_BLC_CTRL00 0x4000U
#define OV5640_BLC_CTRL01 0x4001U
#define OV5640_BLC_CTRL02 0x4002U
#define OV5640_BLC_CTRL03 0x4003U
#define OV5640_BLC_CTRL04 0x4004U
#define OV5640_BLC_CTRL05 0x4005U
/* frame control [0x4201 ~ 0x4202] */
#define OV5640_FRAME_CTRL01 0x4201U
#define OV5640_FRAME_CTRL02 0x4202U
/* format control [0x4300 ~ 0x430D] */
#define OV5640_FORMAT_CTRL00 0x4300U
#define OV5640_FORMAT_CTRL01 0x4301U
#define OV5640_YMAX_VAL_HIGH 0x4302U
#define OV5640_YMAX_VAL_LOW 0x4303U
#define OV5640_YMIN_VAL_HIGH 0x4304U
#define OV5640_YMIN_VAL_LOW 0x4305U
#define OV5640_UMAX_VAL_HIGH 0x4306U
#define OV5640_UMAX_VAL_LOW 0x4307U
#define OV5640_UMIN_VAL_HIGH 0x4308U
#define OV5640_UMIN_VAL_LOW 0x4309U
#define OV5640_VMAX_VAL_HIGH 0x430AU
#define OV5640_VMAX_VAL_LOW 0x430BU
#define OV5640_VMIN_VAL_HIGH 0x430CU
#define OV5640_VMIN_VAL_LOW 0x430DU
/* JPEG control [0x4400 ~ 0x4431] */
#define OV5640_JPEG_CTRL00 0x4400U
#define OV5640_JPEG_CTRL01 0x4401U
#define OV5640_JPEG_CTRL02 0x4402U
#define OV5640_JPEG_CTRL03 0x4403U
#define OV5640_JPEG_CTRL04 0x4404U
#define OV5640_JPEG_CTRL05 0x4405U
#define OV5640_JPEG_CTRL06 0x4406U
#define OV5640_JPEG_CTRL07 0x4407U
#define OV5640_JPEG_ISI_CTRL1 0x4408U
#define OV5640_JPEG_CTRL09 0x4409U
#define OV5640_JPEG_CTRL0A 0x440AU
#define OV5640_JPEG_CTRL0B 0x440BU
#define OV5640_JPEG_CTRL0C 0x440CU
#define OV5640_JPEG_QT_DATA 0x4410U
#define OV5640_JPEG_QT_ADDR 0x4411U
#define OV5640_JPEG_ISI_DATA 0x4412U
#define OV5640_JPEG_ISI_CTRL2 0x4413U
#define OV5640_JPEG_LENGTH_BYTE3 0x4414U
#define OV5640_JPEG_LENGTH_BYTE2 0x4415U
#define OV5640_JPEG_LENGTH_BYTE1 0x4416U
#define OV5640_JFIFO_OVERFLOW 0x4417U
/* VFIFO control [0x4600 ~ 0x460D] */
#define OV5640_VFIFO_CTRL00 0x4600U
#define OV5640_VFIFO_HSIZE_HIGH 0x4602U
#define OV5640_VFIFO_HSIZE_LOW 0x4603U
#define OV5640_VFIFO_VSIZE_HIGH 0x4604U
#define OV5640_VFIFO_VSIZE_LOW 0x4605U
#define OV5640_VFIFO_CTRL0C 0x460CU
#define OV5640_VFIFO_CTRL0D 0x460DU
/* DVP control [0x4709 ~ 0x4745] */
#define OV5640_DVP_VSYNC_WIDTH0 0x4709U
#define OV5640_DVP_VSYNC_WIDTH1 0x470AU
#define OV5640_DVP_VSYNC_WIDTH2 0x470BU
#define OV5640_PAD_LEFT_CTRL 0x4711U
#define OV5640_PAD_RIGHT_CTRL 0x4712U
#define OV5640_JPG_MODE_SELECT 0x4713U
#define OV5640_656_DUMMY_LINE 0x4715U
#define OV5640_CCIR656_CTRL 0x4719U
#define OV5640_HSYNC_CTRL00 0x471BU
#define OV5640_DVP_VSYN_CTRL 0x471DU
#define OV5640_DVP_HREF_CTRL 0x471FU
#define OV5640_VSTART_OFFSET 0x4721U
#define OV5640_VEND_OFFSET 0x4722U
#define OV5640_DVP_CTRL23 0x4723U
#define OV5640_CCIR656_CTRL00 0x4730U
#define OV5640_CCIR656_CTRL01 0x4731U
#define OV5640_CCIR656_FS 0x4732U
#define OV5640_CCIR656_FE 0x4733U
#define OV5640_CCIR656_LS 0x4734U
#define OV5640_CCIR656_LE 0x4735U
#define OV5640_CCIR656_CTRL06 0x4736U
#define OV5640_CCIR656_CTRL07 0x4737U
#define OV5640_CCIR656_CTRL08 0x4738U
#define OV5640_POLARITY_CTRL 0x4740U
#define OV5640_TEST_PATTERN 0x4741U
#define OV5640_DATA_ORDER 0x4745U
/* MIPI control [0x4800 ~ 0x4837] */
#define OV5640_MIPI_CTRL00 0x4800U
#define OV5640_MIPI_CTRL01 0x4801U
#define OV5640_MIPI_CTRL05 0x4805U
#define OV5640_MIPI_DATA_ORDER 0x480AU
#define OV5640_MIN_HS_ZERO_HIGH 0x4818U
#define OV5640_MIN_HS_ZERO_LOW 0x4819U
#define OV5640_MIN_MIPI_HS_TRAIL_HIGH 0x481AU
#define OV5640_MIN_MIPI_HS_TRAIL_LOW 0x481BU
#define OV5640_MIN_MIPI_CLK_ZERO_HIGH 0x481CU
#define OV5640_MIN_MIPI_CLK_ZERO_LOW 0x481DU
#define OV5640_MIN_MIPI_CLK_PREPARE_HIGH 0x481EU
#define OV5640_MIN_MIPI_CLK_PREPARE_LOW 0x481FU
#define OV5640_MIN_CLK_POST_HIGH 0x4820U
#define OV5640_MIN_CLK_POST_LOW 0x4821U
#define OV5640_MIN_CLK_TRAIL_HIGH 0x4822U
#define OV5640_MIN_CLK_TRAIL_LOW 0x4823U
#define OV5640_MIN_LPX_PCLK_HIGH 0x4824U
#define OV5640_MIN_LPX_PCLK_LOW 0x4825U
#define OV5640_MIN_HS_PREPARE_HIGH 0x4826U
#define OV5640_MIN_HS_PREPARE_LOW 0x4827U
#define OV5640_MIN_HS_EXIT_HIGH 0x4828U
#define OV5640_MIN_HS_EXIT_LOW 0x4829U
#define OV5640_MIN_HS_ZERO_UI 0x482AU
#define OV5640_MIN_HS_TRAIL_UI 0x482BU
#define OV5640_MIN_CLK_ZERO_UI 0x482CU
#define OV5640_MIN_CLK_PREPARE_UI 0x482DU
#define OV5640_MIN_CLK_POST_UI 0x482EU
#define OV5640_MIN_CLK_TRAIL_UI 0x482FU
#define OV5640_MIN_LPX_PCLK_UI 0x4830U
#define OV5640_MIN_HS_PREPARE_UI 0x4831U
#define OV5640_MIN_HS_EXIT_UI 0x4832U
#define OV5640_PCLK_PERIOD 0x4837U
/* ISP frame control [0x4901 ~ 0x4902] */
#define OV5640_ISP_FRAME_CTRL01 0x4901U
#define OV5640_ISP_FRAME_CTRL02 0x4902U
/* ISP top control [0x5000 ~ 0x5063] */
#define OV5640_ISP_CONTROL00 0x5000U
#define OV5640_ISP_CONTROL01 0x5001U
#define OV5640_ISP_CONTROL03 0x5003U
#define OV5640_ISP_CONTROL05 0x5005U
#define OV5640_ISP_MISC0 0x501DU
#define OV5640_ISP_MISC1 0x501EU
#define OV5640_FORMAT_MUX_CTRL 0x501FU
#define OV5640_DITHER_CTRL0 0x5020U
#define OV5640_DRAW_WINDOW_CTRL00 0x5027U
#define OV5640_DRAW_WINDOW_LEFT_CTRL_HIGH 0x5028U
#define OV5640_DRAW_WINDOW_LEFT_CTRL_LOW 0x5029U
#define OV5640_DRAW_WINDOW_RIGHT_CTRL_HIGH 0x502AU
#define OV5640_DRAW_WINDOW_RIGHT_CTRL_LOW 0x502BU
#define OV5640_DRAW_WINDOW_TOP_CTRL_HIGH 0x502CU
#define OV5640_DRAW_WINDOW_TOP_CTRL_LOW 0x502DU
#define OV5640_DRAW_WINDOW_BOTTOM_CTRL_HIGH 0x502EU
#define OV5640_DRAW_WINDOW_BOTTOM_CTRL_LOW 0x502FU
#define OV5640_DRAW_WINDOW_HBW_CTRL_HIGH 0x5030U /* HBW: Horizontal Boundary Width */
#define OV5640_DRAW_WINDOW_HBW_CTRL_LOW 0x5031U
#define OV5640_DRAW_WINDOW_VBW_CTRL_HIGH 0x5032U /* VBW: Vertical Boundary Width */
#define OV5640_DRAW_WINDOW_VBW_CTRL_LOW 0x5033U
#define OV5640_DRAW_WINDOW_Y_CTRL 0x5034U
#define OV5640_DRAW_WINDOW_U_CTRL 0x5035U
#define OV5640_DRAW_WINDOW_V_CTRL 0x5036U
#define OV5640_PRE_ISP_TEST_SETTING1 0x503DU
#define OV5640_ISP_SENSOR_BIAS_I 0x5061U
#define OV5640_ISP_SENSOR_GAIN1_I 0x5062U
#define OV5640_ISP_SENSOR_GAIN2_I 0x5063U
/* AWB control [0x5180 ~ 0x51D0] */
#define OV5640_AWB_CTRL00 0x5180U
#define OV5640_AWB_CTRL01 0x5181U
#define OV5640_AWB_CTRL02 0x5182U
#define OV5640_AWB_CTRL03 0x5183U
#define OV5640_AWB_CTRL04 0x5184U
#define OV5640_AWB_CTRL05 0x5185U
#define OV5640_AWB_CTRL06 0x5186U /* Advanced AWB control registers: 0x5186 ~ 0x5190 */
#define OV5640_AWB_CTRL07 0x5187U
#define OV5640_AWB_CTRL08 0x5188U
#define OV5640_AWB_CTRL09 0x5189U
#define OV5640_AWB_CTRL10 0x518AU
#define OV5640_AWB_CTRL11 0x518BU
#define OV5640_AWB_CTRL12 0x518CU
#define OV5640_AWB_CTRL13 0x518DU
#define OV5640_AWB_CTRL14 0x518EU
#define OV5640_AWB_CTRL15 0x518FU
#define OV5640_AWB_CTRL16 0x5190U
#define OV5640_AWB_CTRL17 0x5191U
#define OV5640_AWB_CTRL18 0x5192U
#define OV5640_AWB_CTRL19 0x5193U
#define OV5640_AWB_CTRL20 0x5194U
#define OV5640_AWB_CTRL21 0x5195U
#define OV5640_AWB_CTRL22 0x5196U
#define OV5640_AWB_CTRL23 0x5197U
#define OV5640_AWB_CTRL24 0x5198U
#define OV5640_AWB_CTRL25 0x5199U
#define OV5640_AWB_CTRL26 0x519AU
#define OV5640_AWB_CTRL27 0x519BU
#define OV5640_AWB_CTRL28 0x519CU
#define OV5640_AWB_CTRL29 0x519DU
#define OV5640_AWB_CTRL30 0x519EU
#define OV5640_AWB_CURRENT_R_GAIN_HIGH 0x519FU
#define OV5640_AWB_CURRENT_R_GAIN_LOW 0x51A0U
#define OV5640_AWB_CURRENT_G_GAIN_HIGH 0x51A1U
#define OV5640_AWB_CURRENT_G_GAIN_LOW 0x51A2U
#define OV5640_AWB_CURRENT_B_GAIN_HIGH 0x51A3U
#define OV5640_AWB_CURRENT_B_GAIN_LOW 0x51A4U
#define OV5640_AWB_AVERAGE_R 0x51A5U
#define OV5640_AWB_AVERAGE_G 0x51A6U
#define OV5640_AWB_AVERAGE_B 0x51A7U
#define OV5640_AWB_CTRL74 0x5180U
/* CIP control [0x5300 ~ 0x530F] */
#define OV5640_CIP_SHARPENMT_TH1 0x5300U
#define OV5640_CIP_SHARPENMT_TH2 0x5301U
#define OV5640_CIP_SHARPENMT_OFFSET1 0x5302U
#define OV5640_CIP_SHARPENMT_OFFSET2 0x5303U
#define OV5640_CIP_DNS_TH1 0x5304U
#define OV5640_CIP_DNS_TH2 0x5305U
#define OV5640_CIP_DNS_OFFSET1 0x5306U
#define OV5640_CIP_DNS_OFFSET2 0x5307U
#define OV5640_CIP_CTRL 0x5308U
#define OV5640_CIP_SHARPENTH_TH1 0x5309U
#define OV5640_CIP_SHARPENTH_TH2 0x530AU
#define OV5640_CIP_SHARPENTH_OFFSET1 0x530BU
#define OV5640_CIP_SHARPENTH_OFFSET2 0x530CU
#define OV5640_CIP_EDGE_MT_AUTO 0x530DU
#define OV5640_CIP_DNS_TH_AUTO 0x530EU
#define OV5640_CIP_SHARPEN_TH_AUTO 0x530FU
/* CMX control [0x5380 ~ 0x538B] */
#define OV5640_CMX_CTRL 0x5380U
#define OV5640_CMX1 0x5381U
#define OV5640_CMX2 0x5382U
#define OV5640_CMX3 0x5383U
#define OV5640_CMX4 0x5384U
#define OV5640_CMX5 0x5385U
#define OV5640_CMX6 0x5386U
#define OV5640_CMX7 0x5387U
#define OV5640_CMX8 0x5388U
#define OV5640_CMX9 0x5389U
#define OV5640_CMXSIGN_HIGH 0x538AU
#define OV5640_CMXSIGN_LOW 0x538BU
/* gamma control [0x5480 ~ 0x5490] */
#define OV5640_GAMMA_CTRL00 0x5480U
#define OV5640_GAMMA_YST00 0x5481U
#define OV5640_GAMMA_YST01 0x5482U
#define OV5640_GAMMA_YST02 0x5483U
#define OV5640_GAMMA_YST03 0x5484U
#define OV5640_GAMMA_YST04 0x5485U
#define OV5640_GAMMA_YST05 0x5486U
#define OV5640_GAMMA_YST06 0x5487U
#define OV5640_GAMMA_YST07 0x5488U
#define OV5640_GAMMA_YST08 0x5489U
#define OV5640_GAMMA_YST09 0x548AU
#define OV5640_GAMMA_YST0A 0x548BU
#define OV5640_GAMMA_YST0B 0x548CU
#define OV5640_GAMMA_YST0C 0x548DU
#define OV5640_GAMMA_YST0D 0x548EU
#define OV5640_GAMMA_YST0E 0x548FU
#define OV5640_GAMMA_YST0F 0x5490U
/* SDE control [0x5580 ~ 0x558C] */
#define OV5640_SDE_CTRL0 0x5580U
#define OV5640_SDE_CTRL1 0x5581U
#define OV5640_SDE_CTRL2 0x5582U
#define OV5640_SDE_CTRL3 0x5583U
#define OV5640_SDE_CTRL4 0x5584U
#define OV5640_SDE_CTRL5 0x5585U
#define OV5640_SDE_CTRL6 0x5586U
#define OV5640_SDE_CTRL7 0x5587U
#define OV5640_SDE_CTRL8 0x5588U
#define OV5640_SDE_CTRL9 0x5589U
#define OV5640_SDE_CTRL10 0x558AU
#define OV5640_SDE_CTRL11 0x558BU
#define OV5640_SDE_CTRL12 0x558CU
/* scale control [0x5600 ~ 0x5606] */
#define OV5640_SCALE_CTRL0 0x5600U
#define OV5640_SCALE_CTRL1 0x5601U
#define OV5640_SCALE_CTRL2 0x5602U
#define OV5640_SCALE_CTRL3 0x5603U
#define OV5640_SCALE_CTRL4 0x5604U
#define OV5640_SCALE_CTRL5 0x5605U
#define OV5640_SCALE_CTRL6 0x5606U
/* AVG control [0x5680 ~ 0x56A2] */
#define OV5640_X_START_HIGH 0x5680U
#define OV5640_X_START_LOW 0x5681U
#define OV5640_Y_START_HIGH 0x5682U
#define OV5640_Y_START_LOW 0x5683U
#define OV5640_X_WINDOW_HIGH 0x5684U
#define OV5640_X_WINDOW_LOW 0x5685U
#define OV5640_Y_WINDOW_HIGH 0x5686U
#define OV5640_Y_WINDOW_LOW 0x5687U
#define OV5640_WEIGHT00 0x5688U
#define OV5640_WEIGHT01 0x5689U
#define OV5640_WEIGHT02 0x568AU
#define OV5640_WEIGHT03 0x568BU
#define OV5640_WEIGHT04 0x568CU
#define OV5640_WEIGHT05 0x568DU
#define OV5640_WEIGHT06 0x568EU
#define OV5640_WEIGHT07 0x568FU
#define OV5640_AVG_CTRL10 0x5690U
#define OV5640_AVG_WIN_00 0x5691U
#define OV5640_AVG_WIN_01 0x5692U
#define OV5640_AVG_WIN_02 0x5693U
#define OV5640_AVG_WIN_03 0x5694U
#define OV5640_AVG_WIN_10 0x5695U
#define OV5640_AVG_WIN_11 0x5696U
#define OV5640_AVG_WIN_12 0x5697U
#define OV5640_AVG_WIN_13 0x5698U
#define OV5640_AVG_WIN_20 0x5699U
#define OV5640_AVG_WIN_21 0x569AU
#define OV5640_AVG_WIN_22 0x569BU
#define OV5640_AVG_WIN_23 0x569CU
#define OV5640_AVG_WIN_30 0x569DU
#define OV5640_AVG_WIN_31 0x569EU
#define OV5640_AVG_WIN_32 0x569FU
#define OV5640_AVG_WIN_33 0x56A0U
#define OV5640_AVG_READOUT 0x56A1U
#define OV5640_AVG_WEIGHT_SUM 0x56A2U
/* LENC control [0x5800 ~ 0x5849] */
#define OV5640_GMTRX00 0x5800U
#define OV5640_GMTRX01 0x5801U
#define OV5640_GMTRX02 0x5802U
#define OV5640_GMTRX03 0x5803U
#define OV5640_GMTRX04 0x5804U
#define OV5640_GMTRX05 0x5805U
#define OV5640_GMTRX10 0x5806U
#define OV5640_GMTRX11 0x5807U
#define OV5640_GMTRX12 0x5808U
#define OV5640_GMTRX13 0x5809U
#define OV5640_GMTRX14 0x580AU
#define OV5640_GMTRX15 0x580BU
#define OV5640_GMTRX20 0x580CU
#define OV5640_GMTRX21 0x580DU
#define OV5640_GMTRX22 0x580EU
#define OV5640_GMTRX23 0x580FU
#define OV5640_GMTRX24 0x5810U
#define OV5640_GMTRX25 0x5811U
#define OV5640_GMTRX30 0x5812U
#define OV5640_GMTRX31 0x5813U
#define OV5640_GMTRX32 0x5814U
#define OV5640_GMTRX33 0x5815U
#define OV5640_GMTRX34 0x5816U
#define OV5640_GMTRX35 0x5817U
#define OV5640_GMTRX40 0x5818U
#define OV5640_GMTRX41 0x5819U
#define OV5640_GMTRX42 0x581AU
#define OV5640_GMTRX43 0x581BU
#define OV5640_GMTRX44 0x581CU
#define OV5640_GMTRX45 0x581DU
#define OV5640_GMTRX50 0x581EU
#define OV5640_GMTRX51 0x581FU
#define OV5640_GMTRX52 0x5820U
#define OV5640_GMTRX53 0x5821U
#define OV5640_GMTRX54 0x5822U
#define OV5640_GMTRX55 0x5823U
#define OV5640_BRMATRX00 0x5824U
#define OV5640_BRMATRX01 0x5825U
#define OV5640_BRMATRX02 0x5826U
#define OV5640_BRMATRX03 0x5827U
#define OV5640_BRMATRX04 0x5828U
#define OV5640_BRMATRX05 0x5829U
#define OV5640_BRMATRX06 0x582AU
#define OV5640_BRMATRX07 0x582BU
#define OV5640_BRMATRX08 0x582CU
#define OV5640_BRMATRX09 0x582DU
#define OV5640_BRMATRX20 0x582EU
#define OV5640_BRMATRX21 0x582FU
#define OV5640_BRMATRX22 0x5830U
#define OV5640_BRMATRX23 0x5831U
#define OV5640_BRMATRX24 0x5832U
#define OV5640_BRMATRX30 0x5833U
#define OV5640_BRMATRX31 0x5834U
#define OV5640_BRMATRX32 0x5835U
#define OV5640_BRMATRX33 0x5836U
#define OV5640_BRMATRX34 0x5837U
#define OV5640_BRMATRX40 0x5838U
#define OV5640_BRMATRX41 0x5839U
#define OV5640_BRMATRX42 0x583AU
#define OV5640_BRMATRX43 0x583BU
#define OV5640_BRMATRX44 0x583CU
#define OV5640_LENC_BR_OFFSET 0x583DU
#define OV5640_MAX_GAIN 0x583EU
#define OV5640_MIN_GAIN 0x583FU
#define OV5640_MIN_Q 0x5840U
#define OV5640_LENC_CTRL59 0x5841U
#define OV5640_BR_HSCALE_HIGH 0x5842U
#define OV5640_BR_HSCALE_LOW 0x5843U
#define OV5640_BR_VSCALE_HIGH 0x5844U
#define OV5640_BR_VSCALE_LOW 0x5845U
#define OV5640_G_HSCALE_HIGH 0x5846U
#define OV5640_G_HSCALE_LOW 0x5847U
#define OV5640_G_VSCALE_HIGH 0x5848U
#define OV5640_G_VSCALE_LOW 0x5849U
/* AFC control [0x6000 ~ 0x603F] */
#define OV5640_AFC_CTRL00 0x6000U
#define OV5640_AFC_CTRL01 0x6001U
#define OV5640_AFC_CTRL02 0x6002U
#define OV5640_AFC_CTRL03 0x6003U
#define OV5640_AFC_CTRL04 0x6004U
#define OV5640_AFC_CTRL05 0x6005U
#define OV5640_AFC_CTRL06 0x6006U
#define OV5640_AFC_CTRL07 0x6007U
#define OV5640_AFC_CTRL08 0x6008U
#define OV5640_AFC_CTRL09 0x6009U
#define OV5640_AFC_CTRL10 0x600AU
#define OV5640_AFC_CTRL11 0x600BU
#define OV5640_AFC_CTRL12 0x600CU
#define OV5640_AFC_CTRL13 0x600DU
#define OV5640_AFC_CTRL14 0x600EU
#define OV5640_AFC_CTRL15 0x600FU
#define OV5640_AFC_CTRL16 0x6010U
#define OV5640_AFC_CTRL17 0x6011U
#define OV5640_AFC_CTRL18 0x6012U
#define OV5640_AFC_CTRL19 0x6013U
#define OV5640_AFC_CTRL20 0x6014U
#define OV5640_AFC_CTRL21 0x6015U
#define OV5640_AFC_CTRL22 0x6016U
#define OV5640_AFC_CTRL23 0x6017U
#define OV5640_AFC_CTRL24 0x6018U
#define OV5640_AFC_CTRL25 0x6019U
#define OV5640_AFC_CTRL26 0x601AU
#define OV5640_AFC_CTRL27 0x601BU
#define OV5640_AFC_CTRL28 0x601CU
#define OV5640_AFC_CTRL29 0x601DU
#define OV5640_AFC_CTRL30 0x601EU
#define OV5640_AFC_CTRL31 0x601FU
#define OV5640_AFC_CTRL32 0x6020U
#define OV5640_AFC_CTRL33 0x6021U
#define OV5640_AFC_CTRL34 0x6022U
#define OV5640_AFC_CTRL35 0x6023U
#define OV5640_AFC_CTRL36 0x6024U
#define OV5640_AFC_CTRL37 0x6025U
#define OV5640_AFC_CTRL38 0x6026U
#define OV5640_AFC_CTRL39 0x6027U
#define OV5640_AFC_CTRL40 0x6028U
#define OV5640_AFC_CTRL41 0x6029U
#define OV5640_AFC_CTRL42 0x602AU
#define OV5640_AFC_CTRL43 0x602BU
#define OV5640_AFC_CTRL44 0x602CU
#define OV5640_AFC_CTRL45 0x602DU
#define OV5640_AFC_CTRL46 0x602EU
#define OV5640_AFC_CTRL47 0x602FU
#define OV5640_AFC_CTRL48 0x6030U
#define OV5640_AFC_CTRL49 0x6031U
#define OV5640_AFC_CTRL50 0x6032U
#define OV5640_AFC_CTRL51 0x6033U
#define OV5640_AFC_CTRL52 0x6034U
#define OV5640_AFC_CTRL53 0x6035U
#define OV5640_AFC_CTRL54 0x6036U
#define OV5640_AFC_CTRL55 0x6037U
#define OV5640_AFC_CTRL56 0x6038U
#define OV5640_AFC_CTRL57 0x6039U
#define OV5640_AFC_CTRL58 0x603AU
#define OV5640_AFC_CTRL59 0x603BU
#define OV5640_AFC_CTRL60 0x603CU
#define OV5640_AFC_READ58 0x603DU
#define OV5640_AFC_READ59 0x603EU
#define OV5640_AFC_READ60 0x603FU
/**
* @}
*/
/************** Generic Function *******************/
typedef int32_t (*OV5640_Write_Func)(void *, uint16_t, uint8_t *, uint16_t);
typedef int32_t (*OV5640_Read_Func)(void *, uint16_t, uint8_t *, uint16_t);
typedef struct
{
OV5640_Write_Func WriteReg;
OV5640_Read_Func ReadReg;
void *handle;
} ov5640_ctx_t;
/*******************************************************************************
* Register : Generic - All
* Address : Generic - All
* Bit Group Name: None
* Permission : W
*******************************************************************************/
int32_t ov5640_write_reg(ov5640_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length);
int32_t ov5640_read_reg(ov5640_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length);
int32_t ov5640_register_set(ov5640_ctx_t *ctx, uint16_t reg, uint8_t value);
int32_t ov5640_register_get(ov5640_ctx_t *ctx, uint16_t reg, uint8_t *value);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* OV5640_REG_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/