Huseyin Buyukesmeli / BSP_DISCO_F746NG

Fork of BSP_DISCO_F746NG by Huseyin Buyukesmeli

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ov7670.h Source File

ov7670.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    ov7670.h
00004   * @author  MCD Application Team
00005   * @version V1.0.0
00006   * @date    25-June-2015
00007   * @brief   This file contains all the functions prototypes for the ov7670.c
00008   *          driver.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
00013   *
00014   * Redistribution and use in source and binary forms, with or without modification,
00015   * are permitted provided that the following conditions are met:
00016   *   1. Redistributions of source code must retain the above copyright notice,
00017   *      this list of conditions and the following disclaimer.
00018   *   2. Redistributions in binary form must reproduce the above copyright notice,
00019   *      this list of conditions and the following disclaimer in the documentation
00020   *      and/or other materials provided with the distribution.
00021   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00022   *      may be used to endorse or promote products derived from this software
00023   *      without specific prior written permission.
00024   *
00025   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00028   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00029   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00030   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00031   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00033   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00034   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035   *
00036   ******************************************************************************
00037   */ 
00038 
00039 /* Define to prevent recursive inclusion -------------------------------------*/
00040 #ifndef __OV7670_H
00041 #define __OV7670_H
00042 
00043 #ifdef __cplusplus
00044  extern "C" {
00045 #endif 
00046 
00047 /* Includes ------------------------------------------------------------------*/
00048 #include "../Common/camera.h"
00049    
00050 /** @addtogroup BSP
00051   * @{
00052   */ 
00053 
00054 /** @addtogroup Components
00055   * @{
00056   */ 
00057   
00058 /** @addtogroup ov7670
00059   * @{
00060   */
00061 
00062 /** @defgroup OV7670_Exported_Types
00063   * @{
00064   */
00065      
00066 /**
00067   * @}
00068   */ 
00069 
00070 /** @defgroup OV7670_Exported_Constants
00071   * @{
00072   */
00073 
00074 /** 
00075   * @brief  OV7670 ID  
00076   */  
00077 #define  OV7670_ID    0x76
00078 /** 
00079   * @brief  OV7670 Registers  
00080   */
00081 
00082 /* OV7670 Registers definition */
00083 #define OV7670_SENSOR_PIDH              0x0A
00084 #define OV7670_SENSOR_PIDL              0x0B
00085 #define OV7670_SENSOR_COM7              0x12
00086 #define OV7670_SENSOR_TSLB              0x3A
00087 #define OV7670_SENSOR_MTX1              0x4F
00088 #define OV7670_SENSOR_MTX2              0x50
00089 #define OV7670_SENSOR_MTX3              0x51
00090 #define OV7670_SENSOR_MTX4              0x52
00091 #define OV7670_SENSOR_MTX5              0x53
00092 #define OV7670_SENSOR_MTX6              0x54
00093 #define OV7670_SENSOR_BRTN              0x55
00094 #define OV7670_SENSOR_CNST1             0x56
00095 #define OV7670_SENSOR_CNST2             0x57
00096 
00097 /** 
00098  * @brief  OV7670 Features Parameters  
00099  */
00100 #define OV7670_BRIGHTNESS_LEVEL0        0xB0     /* Brightness level -2         */
00101 #define OV7670_BRIGHTNESS_LEVEL1        0x98     /* Brightness level -1         */
00102 #define OV7670_BRIGHTNESS_LEVEL2        0x00     /* Brightness level 0          */
00103 #define OV7670_BRIGHTNESS_LEVEL3        0x18     /* Brightness level +1         */
00104 #define OV7670_BRIGHTNESS_LEVEL4        0x30     /* Brightness level +2         */
00105 
00106 #define OV7670_BLACK_WHITE_BW           0xCC000000000000  /* Black and white effect      */
00107 #define OV7670_BLACK_WHITE_NEGATIVE     0xEC808000008080  /* Negative effect             */
00108 #define OV7670_BLACK_WHITE_BW_NEGATIVE  0xEC000000000000  /* BW and Negative effect      */
00109 #define OV7670_BLACK_WHITE_NORMAL       0xCC808000008080  /* Normal effect               */
00110 
00111 #define OV7670_CONTRAST_LEVEL0          0x30     /* Contrast level -2           */
00112 #define OV7670_CONTRAST_LEVEL1          0x38     /* Contrast level -1           */
00113 #define OV7670_CONTRAST_LEVEL2          0x40     /* Contrast level 0            */
00114 #define OV7670_CONTRAST_LEVEL3          0x50     /* Contrast level +1           */
00115 #define OV7670_CONTRAST_LEVEL4          0x60     /* Contrast level +2           */
00116 
00117 #define OV7670_COLOR_EFFECT_NONE        0xCC808000008080  /* No color effect             */
00118 #define OV7670_COLOR_EFFECT_ANTIQUE     0xCC000020F00000  /* Antique effect              */
00119 #define OV7670_COLOR_EFFECT_BLUE        0xCC000000000060  /* Blue effect                 */
00120 #define OV7670_COLOR_EFFECT_GREEN       0xCC000000008000  /* Green effect                */
00121 #define OV7670_COLOR_EFFECT_RED         0xCC600000000000  /* Red effect                  */
00122 /**
00123   * @}
00124   */
00125   
00126 /** @defgroup OV7670_Exported_Functions
00127   * @{
00128   */ 
00129 void     ov7670_Init(uint16_t DeviceAddr, uint32_t resolution);
00130 void     ov7670_Config(uint16_t DeviceAddr, uint32_t feature, uint32_t value, uint32_t BR_value);
00131 uint16_t ov7670_ReadID(uint16_t DeviceAddr);
00132 
00133 void     CAMERA_IO_Init(void);
00134 void     CAMERA_IO_Write(uint8_t addr, uint8_t reg, uint8_t value);
00135 uint8_t  CAMERA_IO_Read(uint8_t addr, uint8_t reg);
00136 void     CAMERA_Delay(uint32_t delay);
00137 
00138 /* CAMERA driver structure */
00139 extern CAMERA_DrvTypeDef   ov7670_drv;
00140 /**
00141   * @}
00142   */    
00143 #ifdef __cplusplus
00144 }
00145 #endif
00146 
00147 #endif /* __OV7670_H */
00148 /**
00149   * @}
00150   */ 
00151 
00152 /**
00153   * @}
00154   */ 
00155 
00156 /**
00157   * @}
00158   */ 
00159 
00160 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/