STM32746G-Discovery board drivers V1.0.0

Dependents:   DISCO-F746NG_LCDTS_CC3000_NTP DISCO-F746NG_ROPE_WIFI F746_SpectralAnalysis_NoPhoto ecte433 ... more

Committer:
jeromecoutant
Date:
Wed Nov 27 08:29:42 2019 +0000
Revision:
13:85dbcff443aa
Parent:
10:1050c589b2ad
Fix OV9655 Camera Driver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 6:e1d9da7fe856 1 /**
bcostm 6:e1d9da7fe856 2 ******************************************************************************
bcostm 6:e1d9da7fe856 3 * @file ov9655.c
bcostm 6:e1d9da7fe856 4 * @author MCD Application Team
bcostm 6:e1d9da7fe856 5 * @brief This file provides the OV9655 camera driver
bcostm 6:e1d9da7fe856 6 ******************************************************************************
bcostm 6:e1d9da7fe856 7 * @attention
bcostm 6:e1d9da7fe856 8 *
bcostm 6:e1d9da7fe856 9 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bcostm 6:e1d9da7fe856 10 *
bcostm 6:e1d9da7fe856 11 * Redistribution and use in source and binary forms, with or without modification,
bcostm 6:e1d9da7fe856 12 * are permitted provided that the following conditions are met:
bcostm 6:e1d9da7fe856 13 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 6:e1d9da7fe856 14 * this list of conditions and the following disclaimer.
bcostm 6:e1d9da7fe856 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 6:e1d9da7fe856 16 * this list of conditions and the following disclaimer in the documentation
bcostm 6:e1d9da7fe856 17 * and/or other materials provided with the distribution.
bcostm 6:e1d9da7fe856 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 6:e1d9da7fe856 19 * may be used to endorse or promote products derived from this software
bcostm 6:e1d9da7fe856 20 * without specific prior written permission.
bcostm 6:e1d9da7fe856 21 *
bcostm 6:e1d9da7fe856 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 6:e1d9da7fe856 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 6:e1d9da7fe856 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 6:e1d9da7fe856 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 6:e1d9da7fe856 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 6:e1d9da7fe856 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 6:e1d9da7fe856 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 6:e1d9da7fe856 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 6:e1d9da7fe856 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 6:e1d9da7fe856 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 6:e1d9da7fe856 32 *
bcostm 6:e1d9da7fe856 33 ******************************************************************************
bcostm 6:e1d9da7fe856 34 */
bcostm 6:e1d9da7fe856 35
bcostm 6:e1d9da7fe856 36 /* Includes ------------------------------------------------------------------*/
bcostm 6:e1d9da7fe856 37 #include "ov9655.h"
bcostm 6:e1d9da7fe856 38
bcostm 6:e1d9da7fe856 39 /** @addtogroup BSP
bcostm 6:e1d9da7fe856 40 * @{
bcostm 6:e1d9da7fe856 41 */
bcostm 6:e1d9da7fe856 42
bcostm 6:e1d9da7fe856 43 /** @addtogroup Components
bcostm 6:e1d9da7fe856 44 * @{
bcostm 6:e1d9da7fe856 45 */
bcostm 6:e1d9da7fe856 46
bcostm 6:e1d9da7fe856 47 /** @addtogroup OV9655
bcostm 6:e1d9da7fe856 48 * @brief This file provides a set of functions needed to drive the
bcostm 6:e1d9da7fe856 49 * OV9655 Camera module.
bcostm 6:e1d9da7fe856 50 * @{
bcostm 6:e1d9da7fe856 51 */
bcostm 6:e1d9da7fe856 52
bcostm 6:e1d9da7fe856 53 /** @defgroup OV9655_Private_TypesDefinitions
bcostm 6:e1d9da7fe856 54 * @{
bcostm 6:e1d9da7fe856 55 */
bcostm 6:e1d9da7fe856 56
bcostm 6:e1d9da7fe856 57 /**
bcostm 6:e1d9da7fe856 58 * @}
bcostm 6:e1d9da7fe856 59 */
bcostm 6:e1d9da7fe856 60
bcostm 6:e1d9da7fe856 61 /** @defgroup OV9655_Private_Defines
bcostm 6:e1d9da7fe856 62 * @{
bcostm 6:e1d9da7fe856 63 */
bcostm 6:e1d9da7fe856 64
bcostm 6:e1d9da7fe856 65 /**
bcostm 6:e1d9da7fe856 66 * @}
bcostm 6:e1d9da7fe856 67 */
bcostm 6:e1d9da7fe856 68
bcostm 6:e1d9da7fe856 69 /** @defgroup OV9655_Private_Macros
bcostm 6:e1d9da7fe856 70 * @{
bcostm 6:e1d9da7fe856 71 */
bcostm 6:e1d9da7fe856 72
bcostm 6:e1d9da7fe856 73 /**
bcostm 6:e1d9da7fe856 74 * @}
bcostm 6:e1d9da7fe856 75 */
bcostm 6:e1d9da7fe856 76
bcostm 6:e1d9da7fe856 77 /** @defgroup OV9655_Private_FunctionPrototypes
bcostm 6:e1d9da7fe856 78 * @{
bcostm 6:e1d9da7fe856 79 */
bcostm 6:e1d9da7fe856 80 static uint64_t ov9655_ConvertValue(uint32_t feature, uint32_t value);
bcostm 6:e1d9da7fe856 81 /**
bcostm 6:e1d9da7fe856 82 * @}
bcostm 6:e1d9da7fe856 83 */
bcostm 6:e1d9da7fe856 84
bcostm 6:e1d9da7fe856 85 /** @defgroup OV9655_Private_Variables
bcostm 6:e1d9da7fe856 86 * @{
bcostm 6:e1d9da7fe856 87 */
bcostm 6:e1d9da7fe856 88
bcostm 6:e1d9da7fe856 89 CAMERA_DrvTypeDef ov9655_drv =
bcostm 6:e1d9da7fe856 90 {
bcostm 6:e1d9da7fe856 91 ov9655_Init,
bcostm 6:e1d9da7fe856 92 ov9655_ReadID,
bcostm 6:e1d9da7fe856 93 ov9655_Config,
bcostm 6:e1d9da7fe856 94 };
bcostm 6:e1d9da7fe856 95
bcostm 6:e1d9da7fe856 96 /* Initialization sequence for VGA resolution (640x480)*/
bcostm 6:e1d9da7fe856 97 const unsigned char OV9655_VGA[][2]=
bcostm 6:e1d9da7fe856 98 {
bcostm 6:e1d9da7fe856 99 {0x00, 0x00},
bcostm 6:e1d9da7fe856 100 {0x01, 0x80},
bcostm 6:e1d9da7fe856 101 {0x02, 0x80},
bcostm 6:e1d9da7fe856 102 {0xb5, 0x00},
bcostm 6:e1d9da7fe856 103 {0x35, 0x00},
bcostm 6:e1d9da7fe856 104 {0xa8, 0xc1},
bcostm 6:e1d9da7fe856 105 {0x3a, 0xcc},
bcostm 6:e1d9da7fe856 106 {0x3d, 0x99},
bcostm 6:e1d9da7fe856 107 {0x77, 0x02},
bcostm 6:e1d9da7fe856 108 {0x13, 0xe7},
bcostm 6:e1d9da7fe856 109 {0x26, 0x72},
bcostm 6:e1d9da7fe856 110 {0x27, 0x08},
bcostm 6:e1d9da7fe856 111 {0x28, 0x08},
bcostm 6:e1d9da7fe856 112 {0x2c, 0x08},
bcostm 6:e1d9da7fe856 113 {0xab, 0x04},
bcostm 6:e1d9da7fe856 114 {0x6e, 0x00},
bcostm 6:e1d9da7fe856 115 {0x6d, 0x55},
bcostm 6:e1d9da7fe856 116 {0x00, 0x11},
bcostm 6:e1d9da7fe856 117 {0x10, 0x7b},
bcostm 6:e1d9da7fe856 118 {0xbb, 0xae},
bcostm 6:e1d9da7fe856 119 {0x11, 0x03},
bcostm 6:e1d9da7fe856 120 {0x72, 0x00},
bcostm 6:e1d9da7fe856 121 {0x3e, 0x0c},
bcostm 6:e1d9da7fe856 122 {0x74, 0x3a},
bcostm 6:e1d9da7fe856 123 {0x76, 0x01},
bcostm 6:e1d9da7fe856 124 {0x75, 0x35},
bcostm 6:e1d9da7fe856 125 {0x73, 0x00},
bcostm 6:e1d9da7fe856 126 {0xc7, 0x80},
bcostm 6:e1d9da7fe856 127 {0x62, 0x00},
bcostm 6:e1d9da7fe856 128 {0x63, 0x00},
bcostm 6:e1d9da7fe856 129 {0x64, 0x02},
bcostm 6:e1d9da7fe856 130 {0x65, 0x20},
bcostm 6:e1d9da7fe856 131 {0x66, 0x01},
bcostm 6:e1d9da7fe856 132 {0xc3, 0x4e},
bcostm 6:e1d9da7fe856 133 {0x33, 0x00},
bcostm 6:e1d9da7fe856 134 {0xa4, 0x50},
bcostm 6:e1d9da7fe856 135 {0xaa, 0x92},
bcostm 6:e1d9da7fe856 136 {0xc2, 0x01},
bcostm 6:e1d9da7fe856 137 {0xc1, 0xc8},
bcostm 6:e1d9da7fe856 138 {0x1e, 0x04},
bcostm 6:e1d9da7fe856 139 {0xa9, 0xef},
bcostm 6:e1d9da7fe856 140 {0x0e, 0x61},
bcostm 6:e1d9da7fe856 141 {0x39, 0x57},
bcostm 6:e1d9da7fe856 142 {0x0f, 0x48},
bcostm 6:e1d9da7fe856 143 {0x24, 0x3c},
bcostm 6:e1d9da7fe856 144 {0x25, 0x36},
bcostm 6:e1d9da7fe856 145 {0x12, 0x63},
bcostm 6:e1d9da7fe856 146 {0x03, 0x12},
bcostm 6:e1d9da7fe856 147 {0x32, 0xff},
bcostm 6:e1d9da7fe856 148 {0x17, 0x16},
bcostm 6:e1d9da7fe856 149 {0x18, 0x02},
bcostm 6:e1d9da7fe856 150 {0x19, 0x01},
bcostm 6:e1d9da7fe856 151 {0x1a, 0x3d},
bcostm 6:e1d9da7fe856 152 {0x36, 0xfa},
bcostm 6:e1d9da7fe856 153 {0x69, 0x0a},
bcostm 6:e1d9da7fe856 154 {0x8c, 0x8d},
bcostm 6:e1d9da7fe856 155 {0xc0, 0xaa},
bcostm 6:e1d9da7fe856 156 {0x40, 0xd0},
bcostm 6:e1d9da7fe856 157 {0x43, 0x14},
bcostm 6:e1d9da7fe856 158 {0x44, 0xf0},
bcostm 6:e1d9da7fe856 159 {0x45, 0x46},
bcostm 6:e1d9da7fe856 160 {0x46, 0x62},
bcostm 6:e1d9da7fe856 161 {0x47, 0x2a},
bcostm 6:e1d9da7fe856 162 {0x48, 0x3c},
bcostm 6:e1d9da7fe856 163 {0x59, 0x85},
bcostm 6:e1d9da7fe856 164 {0x5a, 0xa9},
bcostm 6:e1d9da7fe856 165 {0x5b, 0x64},
bcostm 6:e1d9da7fe856 166 {0x5c, 0x84},
bcostm 6:e1d9da7fe856 167 {0x5d, 0x53},
bcostm 6:e1d9da7fe856 168 {0x5e, 0x0e},
bcostm 6:e1d9da7fe856 169 {0x6c, 0x0c},
bcostm 6:e1d9da7fe856 170 {0xc6, 0x85},
bcostm 6:e1d9da7fe856 171 {0xcb, 0xf0},
bcostm 6:e1d9da7fe856 172 {0xcc, 0xd8},
bcostm 6:e1d9da7fe856 173 {0x71, 0x78},
bcostm 6:e1d9da7fe856 174 {0xa5, 0x68},
bcostm 6:e1d9da7fe856 175 {0x6f, 0x9e},
bcostm 6:e1d9da7fe856 176 {0x42, 0xc0},
bcostm 6:e1d9da7fe856 177 {0x3f, 0x82},
bcostm 6:e1d9da7fe856 178 {0x8a, 0x23},
bcostm 6:e1d9da7fe856 179 {0x14, 0x3a},
bcostm 6:e1d9da7fe856 180 {0x3b, 0xcc},
bcostm 6:e1d9da7fe856 181 {0x34, 0x3d},
bcostm 6:e1d9da7fe856 182 {0x41, 0x40},
bcostm 6:e1d9da7fe856 183 {0xc9, 0xe0},
bcostm 6:e1d9da7fe856 184 {0xca, 0xe8},
bcostm 6:e1d9da7fe856 185 {0xcd, 0x93},
bcostm 6:e1d9da7fe856 186 {0x7a, 0x20},
bcostm 6:e1d9da7fe856 187 {0x7b, 0x1c},
bcostm 6:e1d9da7fe856 188 {0x7c, 0x28},
bcostm 6:e1d9da7fe856 189 {0x7d, 0x3c},
bcostm 6:e1d9da7fe856 190 {0x7e, 0x5a},
bcostm 6:e1d9da7fe856 191 {0x7f, 0x68},
bcostm 6:e1d9da7fe856 192 {0x80, 0x76},
bcostm 6:e1d9da7fe856 193 {0x81, 0x80},
bcostm 6:e1d9da7fe856 194 {0x82, 0x88},
bcostm 6:e1d9da7fe856 195 {0x83, 0x8f},
bcostm 6:e1d9da7fe856 196 {0x84, 0x96},
bcostm 6:e1d9da7fe856 197 {0x85, 0xa3},
bcostm 6:e1d9da7fe856 198 {0x86, 0xaf},
bcostm 6:e1d9da7fe856 199 {0x87, 0xc4},
bcostm 6:e1d9da7fe856 200 {0x88, 0xd7},
bcostm 6:e1d9da7fe856 201 {0x89, 0xe8},
bcostm 6:e1d9da7fe856 202 {0x4f, 0x98},
bcostm 6:e1d9da7fe856 203 {0x50, 0x98},
bcostm 6:e1d9da7fe856 204 {0x51, 0x00},
bcostm 6:e1d9da7fe856 205 {0x52, 0x28},
bcostm 6:e1d9da7fe856 206 {0x53, 0x70},
bcostm 6:e1d9da7fe856 207 {0x54, 0x98},
bcostm 6:e1d9da7fe856 208 {0x58, 0x1a},
bcostm 6:e1d9da7fe856 209 {0x6b, 0x5a},
bcostm 6:e1d9da7fe856 210 {0x90, 0x92},
bcostm 6:e1d9da7fe856 211 {0x91, 0x92},
bcostm 6:e1d9da7fe856 212 {0x9f, 0x90},
bcostm 6:e1d9da7fe856 213 {0xa0, 0x90},
bcostm 6:e1d9da7fe856 214 {0x16, 0x24},
bcostm 6:e1d9da7fe856 215 {0x2a, 0x00},
bcostm 6:e1d9da7fe856 216 {0x2b, 0x00},
bcostm 6:e1d9da7fe856 217 {0xac, 0x80},
bcostm 6:e1d9da7fe856 218 {0xad, 0x80},
bcostm 6:e1d9da7fe856 219 {0xae, 0x80},
bcostm 6:e1d9da7fe856 220 {0xaf, 0x80},
bcostm 6:e1d9da7fe856 221 {0xb2, 0xf2},
bcostm 6:e1d9da7fe856 222 {0xb3, 0x20},
bcostm 6:e1d9da7fe856 223 {0xb4, 0x20},
bcostm 6:e1d9da7fe856 224 {0xb6, 0xaf},
bcostm 6:e1d9da7fe856 225 {0x29, 0x15},
bcostm 6:e1d9da7fe856 226 {0x9d, 0x02},
bcostm 6:e1d9da7fe856 227 {0x9e, 0x02},
bcostm 6:e1d9da7fe856 228 {0x9e, 0x02},
bcostm 6:e1d9da7fe856 229 {0x04, 0x03},
bcostm 6:e1d9da7fe856 230 {0x05, 0x2e},
bcostm 6:e1d9da7fe856 231 {0x06, 0x2e},
bcostm 6:e1d9da7fe856 232 {0x07, 0x2e},
bcostm 6:e1d9da7fe856 233 {0x08, 0x2e},
bcostm 6:e1d9da7fe856 234 {0x2f, 0x2e},
bcostm 6:e1d9da7fe856 235 {0x4a, 0xe9},
bcostm 6:e1d9da7fe856 236 {0x4b, 0xdd},
bcostm 6:e1d9da7fe856 237 {0x4c, 0xdd},
bcostm 6:e1d9da7fe856 238 {0x4d, 0xdd},
bcostm 6:e1d9da7fe856 239 {0x4e, 0xdd},
bcostm 6:e1d9da7fe856 240 {0x70, 0x06},
bcostm 6:e1d9da7fe856 241 {0xa6, 0x40},
bcostm 6:e1d9da7fe856 242 {0xbc, 0x02},
bcostm 6:e1d9da7fe856 243 {0xbd, 0x01},
bcostm 6:e1d9da7fe856 244 {0xbe, 0x02},
bcostm 6:e1d9da7fe856 245 {0xbf, 0x01},
bcostm 6:e1d9da7fe856 246 };
bcostm 6:e1d9da7fe856 247
bcostm 6:e1d9da7fe856 248 /* Initialization sequence for QVGA resolution (320x240) */
bcostm 6:e1d9da7fe856 249 const unsigned char OV9655_QVGA[][2]=
bcostm 6:e1d9da7fe856 250 {
bcostm 6:e1d9da7fe856 251 {0x00, 0x00},
bcostm 6:e1d9da7fe856 252 {0x01, 0x80},
bcostm 6:e1d9da7fe856 253 {0x02, 0x80},
bcostm 6:e1d9da7fe856 254 {0x03, 0x02},
bcostm 6:e1d9da7fe856 255 {0x04, 0x03},
bcostm 6:e1d9da7fe856 256 {0x09, 0x01},
bcostm 6:e1d9da7fe856 257 {0x0b, 0x57},
bcostm 6:e1d9da7fe856 258 {0x0e, 0x61},
bcostm 6:e1d9da7fe856 259 {0x0f, 0x40},
bcostm 6:e1d9da7fe856 260 {0x11, 0x01},
bcostm 6:e1d9da7fe856 261 {0x12, 0x62},
bcostm 6:e1d9da7fe856 262 {0x13, 0xc7},
bcostm 6:e1d9da7fe856 263 {0x14, 0x3a},
bcostm 6:e1d9da7fe856 264 {0x16, 0x24},
bcostm 6:e1d9da7fe856 265 {0x17, 0x18},
bcostm 6:e1d9da7fe856 266 {0x18, 0x04},
bcostm 6:e1d9da7fe856 267 {0x19, 0x01},
bcostm 6:e1d9da7fe856 268 {0x1a, 0x81},
bcostm 6:e1d9da7fe856 269 {0x1e, 0x00},
bcostm 6:e1d9da7fe856 270 {0x24, 0x3c},
bcostm 6:e1d9da7fe856 271 {0x25, 0x36},
bcostm 6:e1d9da7fe856 272 {0x26, 0x72},
bcostm 6:e1d9da7fe856 273 {0x27, 0x08},
bcostm 6:e1d9da7fe856 274 {0x28, 0x08},
bcostm 6:e1d9da7fe856 275 {0x29, 0x15},
bcostm 6:e1d9da7fe856 276 {0x2a, 0x00},
bcostm 6:e1d9da7fe856 277 {0x2b, 0x00},
bcostm 6:e1d9da7fe856 278 {0x2c, 0x08},
bcostm 6:e1d9da7fe856 279 {0x32, 0x12},
bcostm 6:e1d9da7fe856 280 {0x33, 0x00},
bcostm 6:e1d9da7fe856 281 {0x34, 0x3f},
bcostm 6:e1d9da7fe856 282 {0x35, 0x00},
bcostm 6:e1d9da7fe856 283 {0x36, 0x3a},
bcostm 6:e1d9da7fe856 284 {0x38, 0x72},
bcostm 6:e1d9da7fe856 285 {0x39, 0x57},
bcostm 6:e1d9da7fe856 286 {0x3a, 0xcc},
bcostm 6:e1d9da7fe856 287 {0x3b, 0x04},
bcostm 6:e1d9da7fe856 288 {0x3d, 0x99},
bcostm 6:e1d9da7fe856 289 {0x3e, 0x02},
bcostm 6:e1d9da7fe856 290 {0x3f, 0xc1},
bcostm 6:e1d9da7fe856 291 {0x40, 0xc0},
bcostm 6:e1d9da7fe856 292 {0x41, 0x41},
bcostm 6:e1d9da7fe856 293 {0x42, 0xc0},
bcostm 6:e1d9da7fe856 294 {0x43, 0x0a},
bcostm 6:e1d9da7fe856 295 {0x44, 0xf0},
bcostm 6:e1d9da7fe856 296 {0x45, 0x46},
bcostm 6:e1d9da7fe856 297 {0x46, 0x62},
bcostm 6:e1d9da7fe856 298 {0x47, 0x2a},
bcostm 6:e1d9da7fe856 299 {0x48, 0x3c},
bcostm 6:e1d9da7fe856 300 {0x4a, 0xfc},
bcostm 6:e1d9da7fe856 301 {0x4b, 0xfc},
bcostm 6:e1d9da7fe856 302 {0x4c, 0x7f},
bcostm 6:e1d9da7fe856 303 {0x4d, 0x7f},
bcostm 6:e1d9da7fe856 304 {0x4e, 0x7f},
bcostm 6:e1d9da7fe856 305 {0x4f, 0x98},
bcostm 6:e1d9da7fe856 306 {0x50, 0x98},
bcostm 6:e1d9da7fe856 307 {0x51, 0x00},
bcostm 6:e1d9da7fe856 308 {0x52, 0x28},
bcostm 6:e1d9da7fe856 309 {0x53, 0x70},
bcostm 6:e1d9da7fe856 310 {0x54, 0x98},
bcostm 6:e1d9da7fe856 311 {0x58, 0x1a},
bcostm 6:e1d9da7fe856 312 {0x59, 0x85},
bcostm 6:e1d9da7fe856 313 {0x5a, 0xa9},
bcostm 6:e1d9da7fe856 314 {0x5b, 0x64},
bcostm 6:e1d9da7fe856 315 {0x5c, 0x84},
bcostm 6:e1d9da7fe856 316 {0x5d, 0x53},
bcostm 6:e1d9da7fe856 317 {0x5e, 0x0e},
bcostm 6:e1d9da7fe856 318 {0x5f, 0xf0},
bcostm 6:e1d9da7fe856 319 {0x60, 0xf0},
bcostm 6:e1d9da7fe856 320 {0x61, 0xf0},
bcostm 6:e1d9da7fe856 321 {0x62, 0x00},
bcostm 6:e1d9da7fe856 322 {0x63, 0x00},
bcostm 6:e1d9da7fe856 323 {0x64, 0x02},
bcostm 6:e1d9da7fe856 324 {0x65, 0x20},
bcostm 6:e1d9da7fe856 325 {0x66, 0x00},
bcostm 6:e1d9da7fe856 326 {0x69, 0x0a},
bcostm 6:e1d9da7fe856 327 {0x6b, 0x5a},
bcostm 6:e1d9da7fe856 328 {0x6c, 0x04},
bcostm 6:e1d9da7fe856 329 {0x6d, 0x55},
bcostm 6:e1d9da7fe856 330 {0x6e, 0x00},
bcostm 6:e1d9da7fe856 331 {0x6f, 0x9d},
bcostm 6:e1d9da7fe856 332 {0x70, 0x21},
bcostm 6:e1d9da7fe856 333 {0x71, 0x78},
bcostm 6:e1d9da7fe856 334 {0x72, 0x11},
bcostm 6:e1d9da7fe856 335 {0x73, 0x01},
bcostm 6:e1d9da7fe856 336 {0x74, 0x10},
bcostm 6:e1d9da7fe856 337 {0x75, 0x10},
bcostm 6:e1d9da7fe856 338 {0x76, 0x01},
bcostm 6:e1d9da7fe856 339 {0x77, 0x02},
bcostm 6:e1d9da7fe856 340 {0x7A, 0x12},
bcostm 6:e1d9da7fe856 341 {0x7B, 0x08},
bcostm 6:e1d9da7fe856 342 {0x7C, 0x16},
bcostm 6:e1d9da7fe856 343 {0x7D, 0x30},
bcostm 6:e1d9da7fe856 344 {0x7E, 0x5e},
bcostm 6:e1d9da7fe856 345 {0x7F, 0x72},
bcostm 6:e1d9da7fe856 346 {0x80, 0x82},
bcostm 6:e1d9da7fe856 347 {0x81, 0x8e},
bcostm 6:e1d9da7fe856 348 {0x82, 0x9a},
bcostm 6:e1d9da7fe856 349 {0x83, 0xa4},
bcostm 6:e1d9da7fe856 350 {0x84, 0xac},
bcostm 6:e1d9da7fe856 351 {0x85, 0xb8},
bcostm 6:e1d9da7fe856 352 {0x86, 0xc3},
bcostm 6:e1d9da7fe856 353 {0x87, 0xd6},
bcostm 6:e1d9da7fe856 354 {0x88, 0xe6},
bcostm 6:e1d9da7fe856 355 {0x89, 0xf2},
bcostm 6:e1d9da7fe856 356 {0x8a, 0x24},
bcostm 6:e1d9da7fe856 357 {0x8c, 0x80},
bcostm 6:e1d9da7fe856 358 {0x90, 0x7d},
bcostm 6:e1d9da7fe856 359 {0x91, 0x7b},
bcostm 6:e1d9da7fe856 360 {0x9d, 0x02},
bcostm 6:e1d9da7fe856 361 {0x9e, 0x02},
bcostm 6:e1d9da7fe856 362 {0x9f, 0x7a},
bcostm 6:e1d9da7fe856 363 {0xa0, 0x79},
bcostm 6:e1d9da7fe856 364 {0xa1, 0x40},
bcostm 6:e1d9da7fe856 365 {0xa4, 0x50},
bcostm 6:e1d9da7fe856 366 {0xa5, 0x68},
bcostm 6:e1d9da7fe856 367 {0xa6, 0x4a},
bcostm 6:e1d9da7fe856 368 {0xa8, 0xc1},
bcostm 6:e1d9da7fe856 369 {0xa9, 0xef},
bcostm 6:e1d9da7fe856 370 {0xaa, 0x92},
bcostm 6:e1d9da7fe856 371 {0xab, 0x04},
bcostm 6:e1d9da7fe856 372 {0xac, 0x80},
bcostm 6:e1d9da7fe856 373 {0xad, 0x80},
bcostm 6:e1d9da7fe856 374 {0xae, 0x80},
bcostm 6:e1d9da7fe856 375 {0xaf, 0x80},
bcostm 6:e1d9da7fe856 376 {0xb2, 0xf2},
bcostm 6:e1d9da7fe856 377 {0xb3, 0x20},
bcostm 6:e1d9da7fe856 378 {0xb4, 0x20},
bcostm 6:e1d9da7fe856 379 {0xb5, 0x00},
bcostm 6:e1d9da7fe856 380 {0xb6, 0xaf},
bcostm 6:e1d9da7fe856 381 {0xb6, 0xaf},
bcostm 6:e1d9da7fe856 382 {0xbb, 0xae},
bcostm 6:e1d9da7fe856 383 {0xbc, 0x7f},
bcostm 6:e1d9da7fe856 384 {0xbd, 0x7f},
bcostm 6:e1d9da7fe856 385 {0xbe, 0x7f},
bcostm 6:e1d9da7fe856 386 {0xbf, 0x7f},
bcostm 6:e1d9da7fe856 387 {0xbf, 0x7f},
bcostm 6:e1d9da7fe856 388 {0xc0, 0xaa},
bcostm 6:e1d9da7fe856 389 {0xc1, 0xc0},
bcostm 6:e1d9da7fe856 390 {0xc2, 0x01},
bcostm 6:e1d9da7fe856 391 {0xc3, 0x4e},
bcostm 6:e1d9da7fe856 392 {0xc6, 0x05},
bcostm 6:e1d9da7fe856 393 {0xc7, 0x81},
bcostm 6:e1d9da7fe856 394 {0xc9, 0xe0},
bcostm 6:e1d9da7fe856 395 {0xca, 0xe8},
bcostm 6:e1d9da7fe856 396 {0xcb, 0xf0},
bcostm 6:e1d9da7fe856 397 {0xcc, 0xd8},
bcostm 6:e1d9da7fe856 398 {0xcd, 0x93},
bcostm 6:e1d9da7fe856 399 {0x12, 0x63},
bcostm 6:e1d9da7fe856 400 {0x40, 0x10},
bcostm 6:e1d9da7fe856 401 };
bcostm 6:e1d9da7fe856 402
bcostm 6:e1d9da7fe856 403 /* Initialization sequence for QQVGA resolution (160x120) */
bcostm 6:e1d9da7fe856 404 const char OV9655_QQVGA[][2]=
bcostm 6:e1d9da7fe856 405 {
bcostm 6:e1d9da7fe856 406 {0x00, 0x00},
bcostm 6:e1d9da7fe856 407 {0x01, 0x80},
bcostm 6:e1d9da7fe856 408 {0x02, 0x80},
bcostm 6:e1d9da7fe856 409 {0x03, 0x02},
bcostm 6:e1d9da7fe856 410 {0x04, 0x03},
bcostm 6:e1d9da7fe856 411 {0x09, 0x01},
bcostm 6:e1d9da7fe856 412 {0x0b, 0x57},
bcostm 6:e1d9da7fe856 413 {0x0e, 0x61},
bcostm 6:e1d9da7fe856 414 {0x0f, 0x40},
bcostm 6:e1d9da7fe856 415 {0x11, 0x01},
bcostm 6:e1d9da7fe856 416 {0x12, 0x62},
bcostm 6:e1d9da7fe856 417 {0x13, 0xc7},
bcostm 6:e1d9da7fe856 418 {0x14, 0x3a},
bcostm 6:e1d9da7fe856 419 {0x16, 0x24},
bcostm 6:e1d9da7fe856 420 {0x17, 0x18},
bcostm 6:e1d9da7fe856 421 {0x18, 0x04},
bcostm 6:e1d9da7fe856 422 {0x19, 0x01},
bcostm 6:e1d9da7fe856 423 {0x1a, 0x81},
bcostm 6:e1d9da7fe856 424 {0x1e, 0x00},
bcostm 6:e1d9da7fe856 425 {0x24, 0x3c},
bcostm 6:e1d9da7fe856 426 {0x25, 0x36},
bcostm 6:e1d9da7fe856 427 {0x26, 0x72},
bcostm 6:e1d9da7fe856 428 {0x27, 0x08},
bcostm 6:e1d9da7fe856 429 {0x28, 0x08},
bcostm 6:e1d9da7fe856 430 {0x29, 0x15},
bcostm 6:e1d9da7fe856 431 {0x2a, 0x00},
bcostm 6:e1d9da7fe856 432 {0x2b, 0x00},
bcostm 6:e1d9da7fe856 433 {0x2c, 0x08},
bcostm 6:e1d9da7fe856 434 {0x32, 0xa4},
bcostm 6:e1d9da7fe856 435 {0x33, 0x00},
bcostm 6:e1d9da7fe856 436 {0x34, 0x3f},
bcostm 6:e1d9da7fe856 437 {0x35, 0x00},
bcostm 6:e1d9da7fe856 438 {0x36, 0x3a},
bcostm 6:e1d9da7fe856 439 {0x38, 0x72},
bcostm 6:e1d9da7fe856 440 {0x39, 0x57},
bcostm 6:e1d9da7fe856 441 {0x3a, 0xcc},
bcostm 6:e1d9da7fe856 442 {0x3b, 0x04},
bcostm 6:e1d9da7fe856 443 {0x3d, 0x99},
bcostm 6:e1d9da7fe856 444 {0x3e, 0x0e},
bcostm 6:e1d9da7fe856 445 {0x3f, 0xc1},
bcostm 6:e1d9da7fe856 446 {0x40, 0xc0},
bcostm 6:e1d9da7fe856 447 {0x41, 0x41},
bcostm 6:e1d9da7fe856 448 {0x42, 0xc0},
bcostm 6:e1d9da7fe856 449 {0x43, 0x0a},
bcostm 6:e1d9da7fe856 450 {0x44, 0xf0},
bcostm 6:e1d9da7fe856 451 {0x45, 0x46},
bcostm 6:e1d9da7fe856 452 {0x46, 0x62},
bcostm 6:e1d9da7fe856 453 {0x47, 0x2a},
bcostm 6:e1d9da7fe856 454 {0x48, 0x3c},
bcostm 6:e1d9da7fe856 455 {0x4a, 0xfc},
bcostm 6:e1d9da7fe856 456 {0x4b, 0xfc},
bcostm 6:e1d9da7fe856 457 {0x4c, 0x7f},
bcostm 6:e1d9da7fe856 458 {0x4d, 0x7f},
bcostm 6:e1d9da7fe856 459 {0x4e, 0x7f},
bcostm 6:e1d9da7fe856 460 {0x4f, 0x98},
bcostm 6:e1d9da7fe856 461 {0x50, 0x98},
bcostm 6:e1d9da7fe856 462 {0x51, 0x00},
bcostm 6:e1d9da7fe856 463 {0x52, 0x28},
bcostm 6:e1d9da7fe856 464 {0x53, 0x70},
bcostm 6:e1d9da7fe856 465 {0x54, 0x98},
bcostm 6:e1d9da7fe856 466 {0x58, 0x1a},
bcostm 6:e1d9da7fe856 467 {0x59, 0x85},
bcostm 6:e1d9da7fe856 468 {0x5a, 0xa9},
bcostm 6:e1d9da7fe856 469 {0x5b, 0x64},
bcostm 6:e1d9da7fe856 470 {0x5c, 0x84},
bcostm 6:e1d9da7fe856 471 {0x5d, 0x53},
bcostm 6:e1d9da7fe856 472 {0x5e, 0x0e},
bcostm 6:e1d9da7fe856 473 {0x5f, 0xf0},
bcostm 6:e1d9da7fe856 474 {0x60, 0xf0},
bcostm 6:e1d9da7fe856 475 {0x61, 0xf0},
bcostm 6:e1d9da7fe856 476 {0x62, 0x00},
bcostm 6:e1d9da7fe856 477 {0x63, 0x00},
bcostm 6:e1d9da7fe856 478 {0x64, 0x02},
bcostm 6:e1d9da7fe856 479 {0x65, 0x20},
bcostm 6:e1d9da7fe856 480 {0x66, 0x00},
bcostm 6:e1d9da7fe856 481 {0x69, 0x0a},
bcostm 6:e1d9da7fe856 482 {0x6b, 0x5a},
bcostm 6:e1d9da7fe856 483 {0x6c, 0x04},
bcostm 6:e1d9da7fe856 484 {0x6d, 0x55},
bcostm 6:e1d9da7fe856 485 {0x6e, 0x00},
bcostm 6:e1d9da7fe856 486 {0x6f, 0x9d},
bcostm 6:e1d9da7fe856 487 {0x70, 0x21},
bcostm 6:e1d9da7fe856 488 {0x71, 0x78},
bcostm 6:e1d9da7fe856 489 {0x72, 0x22},
bcostm 6:e1d9da7fe856 490 {0x73, 0x02},
bcostm 6:e1d9da7fe856 491 {0x74, 0x10},
bcostm 6:e1d9da7fe856 492 {0x75, 0x10},
bcostm 6:e1d9da7fe856 493 {0x76, 0x01},
bcostm 6:e1d9da7fe856 494 {0x77, 0x02},
bcostm 6:e1d9da7fe856 495 {0x7A, 0x12},
bcostm 6:e1d9da7fe856 496 {0x7B, 0x08},
bcostm 6:e1d9da7fe856 497 {0x7C, 0x16},
bcostm 6:e1d9da7fe856 498 {0x7D, 0x30},
bcostm 6:e1d9da7fe856 499 {0x7E, 0x5e},
bcostm 6:e1d9da7fe856 500 {0x7F, 0x72},
bcostm 6:e1d9da7fe856 501 {0x80, 0x82},
bcostm 6:e1d9da7fe856 502 {0x81, 0x8e},
bcostm 6:e1d9da7fe856 503 {0x82, 0x9a},
bcostm 6:e1d9da7fe856 504 {0x83, 0xa4},
bcostm 6:e1d9da7fe856 505 {0x84, 0xac},
bcostm 6:e1d9da7fe856 506 {0x85, 0xb8},
bcostm 6:e1d9da7fe856 507 {0x86, 0xc3},
bcostm 6:e1d9da7fe856 508 {0x87, 0xd6},
bcostm 6:e1d9da7fe856 509 {0x88, 0xe6},
bcostm 6:e1d9da7fe856 510 {0x89, 0xf2},
bcostm 6:e1d9da7fe856 511 {0x8a, 0x24},
bcostm 6:e1d9da7fe856 512 {0x8c, 0x80},
bcostm 6:e1d9da7fe856 513 {0x90, 0x7d},
bcostm 6:e1d9da7fe856 514 {0x91, 0x7b},
bcostm 6:e1d9da7fe856 515 {0x9d, 0x02},
bcostm 6:e1d9da7fe856 516 {0x9e, 0x02},
bcostm 6:e1d9da7fe856 517 {0x9f, 0x7a},
bcostm 6:e1d9da7fe856 518 {0xa0, 0x79},
bcostm 6:e1d9da7fe856 519 {0xa1, 0x40},
bcostm 6:e1d9da7fe856 520 {0xa4, 0x50},
bcostm 6:e1d9da7fe856 521 {0xa5, 0x68},
bcostm 6:e1d9da7fe856 522 {0xa6, 0x4a},
bcostm 6:e1d9da7fe856 523 {0xa8, 0xc1},
bcostm 6:e1d9da7fe856 524 {0xa9, 0xef},
bcostm 6:e1d9da7fe856 525 {0xaa, 0x92},
bcostm 6:e1d9da7fe856 526 {0xab, 0x04},
bcostm 6:e1d9da7fe856 527 {0xac, 0x80},
bcostm 6:e1d9da7fe856 528 {0xad, 0x80},
bcostm 6:e1d9da7fe856 529 {0xae, 0x80},
bcostm 6:e1d9da7fe856 530 {0xaf, 0x80},
bcostm 6:e1d9da7fe856 531 {0xb2, 0xf2},
bcostm 6:e1d9da7fe856 532 {0xb3, 0x20},
bcostm 6:e1d9da7fe856 533 {0xb4, 0x20},
bcostm 6:e1d9da7fe856 534 {0xb5, 0x00},
bcostm 6:e1d9da7fe856 535 {0xb6, 0xaf},
bcostm 6:e1d9da7fe856 536 {0xb6, 0xaf},
bcostm 6:e1d9da7fe856 537 {0xbb, 0xae},
bcostm 6:e1d9da7fe856 538 {0xbc, 0x7f},
bcostm 6:e1d9da7fe856 539 {0xbd, 0x7f},
bcostm 6:e1d9da7fe856 540 {0xbe, 0x7f},
bcostm 6:e1d9da7fe856 541 {0xbf, 0x7f},
bcostm 6:e1d9da7fe856 542 {0xbf, 0x7f},
bcostm 6:e1d9da7fe856 543 {0xc0, 0xaa},
bcostm 6:e1d9da7fe856 544 {0xc1, 0xc0},
bcostm 6:e1d9da7fe856 545 {0xc2, 0x01},
bcostm 6:e1d9da7fe856 546 {0xc3, 0x4e},
bcostm 6:e1d9da7fe856 547 {0xc6, 0x05},
bcostm 6:e1d9da7fe856 548 {0xc7, 0x82},
bcostm 6:e1d9da7fe856 549 {0xc9, 0xe0},
bcostm 6:e1d9da7fe856 550 {0xca, 0xe8},
bcostm 6:e1d9da7fe856 551 {0xcb, 0xf0},
bcostm 6:e1d9da7fe856 552 {0xcc, 0xd8},
bcostm 6:e1d9da7fe856 553 {0xcd, 0x93},
bcostm 6:e1d9da7fe856 554 {0x12, 0x63},
bcostm 6:e1d9da7fe856 555 {0x40, 0x10},
bcostm 6:e1d9da7fe856 556 };
bcostm 6:e1d9da7fe856 557
bcostm 6:e1d9da7fe856 558 /**
bcostm 6:e1d9da7fe856 559 * @}
bcostm 6:e1d9da7fe856 560 */
bcostm 6:e1d9da7fe856 561
bcostm 6:e1d9da7fe856 562 /** @defgroup OV9655_Private_Functions
bcostm 6:e1d9da7fe856 563 * @{
bcostm 6:e1d9da7fe856 564 */
bcostm 6:e1d9da7fe856 565
bcostm 6:e1d9da7fe856 566 /**
bcostm 6:e1d9da7fe856 567 * @brief Initializes the OV9655 CAMERA component.
bcostm 6:e1d9da7fe856 568 * @param DeviceAddr: Device address on communication Bus.
bcostm 6:e1d9da7fe856 569 * @param resolution: Camera resolution
bcostm 6:e1d9da7fe856 570 * @retval None
bcostm 6:e1d9da7fe856 571 */
bcostm 6:e1d9da7fe856 572 void ov9655_Init(uint16_t DeviceAddr, uint32_t resolution)
bcostm 6:e1d9da7fe856 573 {
bcostm 6:e1d9da7fe856 574 uint32_t index;
bcostm 6:e1d9da7fe856 575
bcostm 6:e1d9da7fe856 576 /* Initialize I2C */
bcostm 6:e1d9da7fe856 577 CAMERA_IO_Init();
bcostm 6:e1d9da7fe856 578
bcostm 6:e1d9da7fe856 579 /* Prepare the camera to be configured by resetting all its registers */
bcostm 6:e1d9da7fe856 580 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_COM7, 0x80);
bcostm 6:e1d9da7fe856 581 CAMERA_Delay(200);
bcostm 6:e1d9da7fe856 582
bcostm 6:e1d9da7fe856 583 /* Initialize OV9655 */
bcostm 6:e1d9da7fe856 584 switch (resolution)
bcostm 6:e1d9da7fe856 585 {
bcostm 6:e1d9da7fe856 586 case CAMERA_R160x120:
bcostm 6:e1d9da7fe856 587 {
bcostm 6:e1d9da7fe856 588 for(index=0; index<(sizeof(OV9655_QQVGA)/2); index++)
bcostm 6:e1d9da7fe856 589 {
bcostm 6:e1d9da7fe856 590 CAMERA_IO_Write(DeviceAddr, OV9655_QQVGA[index][0], OV9655_QQVGA[index][1]);
bcostm 6:e1d9da7fe856 591 CAMERA_Delay(2);
bcostm 6:e1d9da7fe856 592 }
bcostm 6:e1d9da7fe856 593 break;
bcostm 6:e1d9da7fe856 594 }
bcostm 6:e1d9da7fe856 595 case CAMERA_R320x240:
bcostm 6:e1d9da7fe856 596 {
bcostm 6:e1d9da7fe856 597 for(index=0; index<(sizeof(OV9655_QVGA)/2); index++)
bcostm 6:e1d9da7fe856 598 {
bcostm 6:e1d9da7fe856 599 CAMERA_IO_Write(DeviceAddr, OV9655_QVGA[index][0], OV9655_QVGA[index][1]);
bcostm 6:e1d9da7fe856 600 CAMERA_Delay(2);
bcostm 6:e1d9da7fe856 601 }
bcostm 6:e1d9da7fe856 602 break;
bcostm 6:e1d9da7fe856 603 }
bcostm 6:e1d9da7fe856 604 case CAMERA_R480x272:
bcostm 6:e1d9da7fe856 605 {
bcostm 6:e1d9da7fe856 606 /* Not supported resolution */
bcostm 6:e1d9da7fe856 607 break;
bcostm 6:e1d9da7fe856 608 }
bcostm 6:e1d9da7fe856 609 case CAMERA_R640x480:
bcostm 6:e1d9da7fe856 610 {
bcostm 6:e1d9da7fe856 611 for(index=0; index<(sizeof(OV9655_VGA)/2); index++)
bcostm 6:e1d9da7fe856 612 {
bcostm 6:e1d9da7fe856 613 CAMERA_IO_Write(DeviceAddr, OV9655_VGA[index][0], OV9655_VGA[index][1]);
bcostm 6:e1d9da7fe856 614 CAMERA_Delay(2);
bcostm 6:e1d9da7fe856 615 }
bcostm 6:e1d9da7fe856 616 break;
bcostm 6:e1d9da7fe856 617 }
bcostm 6:e1d9da7fe856 618 default:
bcostm 6:e1d9da7fe856 619 {
bcostm 6:e1d9da7fe856 620 break;
bcostm 6:e1d9da7fe856 621 }
bcostm 6:e1d9da7fe856 622 }
bcostm 6:e1d9da7fe856 623 }
bcostm 6:e1d9da7fe856 624
bcostm 6:e1d9da7fe856 625 /**
bcostm 6:e1d9da7fe856 626 * @brief Configures the OV9655 camera feature.
bcostm 6:e1d9da7fe856 627 * @param DeviceAddr: Device address on communication Bus.
bcostm 6:e1d9da7fe856 628 * @param feature: Camera feature to be configured
bcostm 6:e1d9da7fe856 629 * @param value: Value to be configured
bcostm 6:e1d9da7fe856 630 * @param brightness_value: Brightness value to be configured
bcostm 6:e1d9da7fe856 631 * @retval None
bcostm 6:e1d9da7fe856 632 */
bcostm 6:e1d9da7fe856 633 void ov9655_Config(uint16_t DeviceAddr, uint32_t feature, uint32_t value, uint32_t brightness_value)
bcostm 6:e1d9da7fe856 634 {
bcostm 6:e1d9da7fe856 635 uint8_t tslb, mtx1, mtx2, mtx3, mtx4, mtx5, mtx6;
bcostm 6:e1d9da7fe856 636 uint64_t value_tmp;
bcostm 6:e1d9da7fe856 637 uint32_t br_value;
bcostm 6:e1d9da7fe856 638
bcostm 6:e1d9da7fe856 639 /* Convert the input value into ov9655 parameters */
bcostm 6:e1d9da7fe856 640 value_tmp = ov9655_ConvertValue(feature, value);
bcostm 6:e1d9da7fe856 641 br_value = (uint32_t)ov9655_ConvertValue(CAMERA_CONTRAST_BRIGHTNESS, brightness_value);
bcostm 6:e1d9da7fe856 642
bcostm 6:e1d9da7fe856 643 switch(feature)
bcostm 6:e1d9da7fe856 644 {
bcostm 6:e1d9da7fe856 645 case CAMERA_CONTRAST_BRIGHTNESS:
bcostm 6:e1d9da7fe856 646 {
bcostm 6:e1d9da7fe856 647 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_BRTN, br_value);
bcostm 6:e1d9da7fe856 648 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_CNST1, value_tmp);
bcostm 6:e1d9da7fe856 649 break;
bcostm 6:e1d9da7fe856 650 }
bcostm 6:e1d9da7fe856 651 case CAMERA_BLACK_WHITE:
bcostm 6:e1d9da7fe856 652 case CAMERA_COLOR_EFFECT:
bcostm 6:e1d9da7fe856 653 {
bcostm 6:e1d9da7fe856 654 tslb = (uint8_t)(value_tmp >> 48);
bcostm 6:e1d9da7fe856 655 mtx1 = (uint8_t)(value_tmp >> 40);
bcostm 6:e1d9da7fe856 656 mtx2 = (uint8_t)(value_tmp >> 32);
bcostm 6:e1d9da7fe856 657 mtx3 = (uint8_t)(value_tmp >> 24);
bcostm 6:e1d9da7fe856 658 mtx4 = (uint8_t)(value_tmp >> 16);
bcostm 6:e1d9da7fe856 659 mtx5 = (uint8_t)(value_tmp >> 8);
bcostm 6:e1d9da7fe856 660 mtx6 = (uint8_t)(value_tmp);
bcostm 6:e1d9da7fe856 661 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_TSLB, tslb);
bcostm 6:e1d9da7fe856 662 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_MTX1, mtx1);
bcostm 6:e1d9da7fe856 663 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_MTX2, mtx2);
bcostm 6:e1d9da7fe856 664 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_MTX3, mtx3);
bcostm 6:e1d9da7fe856 665 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_MTX4, mtx4);
bcostm 6:e1d9da7fe856 666 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_MTX5, mtx5);
bcostm 6:e1d9da7fe856 667 CAMERA_IO_Write(DeviceAddr, OV9655_SENSOR_MTX6, mtx6);
bcostm 6:e1d9da7fe856 668 break;
bcostm 6:e1d9da7fe856 669 }
bcostm 6:e1d9da7fe856 670 default:
bcostm 6:e1d9da7fe856 671 {
bcostm 6:e1d9da7fe856 672 break;
bcostm 6:e1d9da7fe856 673 }
bcostm 6:e1d9da7fe856 674 }
bcostm 6:e1d9da7fe856 675 }
bcostm 6:e1d9da7fe856 676
bcostm 6:e1d9da7fe856 677 /**
bcostm 6:e1d9da7fe856 678 * @brief Read the OV9655 Camera identity.
bcostm 6:e1d9da7fe856 679 * @param DeviceAddr: Device address on communication Bus.
bcostm 6:e1d9da7fe856 680 * @retval the OV9655 ID
bcostm 6:e1d9da7fe856 681 */
bcostm 6:e1d9da7fe856 682 uint16_t ov9655_ReadID(uint16_t DeviceAddr)
bcostm 6:e1d9da7fe856 683 {
bcostm 6:e1d9da7fe856 684 /* Initialize I2C */
bcostm 6:e1d9da7fe856 685 CAMERA_IO_Init();
bcostm 6:e1d9da7fe856 686
bcostm 6:e1d9da7fe856 687 /* Get the camera ID */
bcostm 6:e1d9da7fe856 688 return (CAMERA_IO_Read(DeviceAddr, OV9655_SENSOR_PIDH));
bcostm 6:e1d9da7fe856 689 }
bcostm 6:e1d9da7fe856 690
bcostm 6:e1d9da7fe856 691 /******************************************************************************
bcostm 6:e1d9da7fe856 692 Static Functions
bcostm 6:e1d9da7fe856 693 *******************************************************************************/
bcostm 6:e1d9da7fe856 694 /**
bcostm 6:e1d9da7fe856 695 * @brief Convert input values into ov9655 parameters.
bcostm 6:e1d9da7fe856 696 * @param feature: Camera feature to be configured
bcostm 6:e1d9da7fe856 697 * @param value: Value to be configured
bcostm 6:e1d9da7fe856 698 * @retval The converted value
bcostm 6:e1d9da7fe856 699 */
bcostm 6:e1d9da7fe856 700 static uint64_t ov9655_ConvertValue(uint32_t feature, uint32_t value)
bcostm 6:e1d9da7fe856 701 {
bcostm 6:e1d9da7fe856 702 uint64_t ret = 0;
bcostm 6:e1d9da7fe856 703
bcostm 6:e1d9da7fe856 704 switch(feature)
bcostm 6:e1d9da7fe856 705 {
bcostm 6:e1d9da7fe856 706 case CAMERA_BLACK_WHITE:
bcostm 6:e1d9da7fe856 707 {
bcostm 6:e1d9da7fe856 708 switch(value)
bcostm 6:e1d9da7fe856 709 {
bcostm 6:e1d9da7fe856 710 case CAMERA_BLACK_WHITE_BW:
bcostm 6:e1d9da7fe856 711 {
bcostm 6:e1d9da7fe856 712 ret = OV9655_BLACK_WHITE_BW;
bcostm 6:e1d9da7fe856 713 break;
bcostm 6:e1d9da7fe856 714 }
bcostm 6:e1d9da7fe856 715 case CAMERA_BLACK_WHITE_NEGATIVE:
bcostm 6:e1d9da7fe856 716 {
bcostm 6:e1d9da7fe856 717 ret = OV9655_BLACK_WHITE_NEGATIVE;
bcostm 6:e1d9da7fe856 718 break;
bcostm 6:e1d9da7fe856 719 }
bcostm 6:e1d9da7fe856 720 case CAMERA_BLACK_WHITE_BW_NEGATIVE:
bcostm 6:e1d9da7fe856 721 {
bcostm 6:e1d9da7fe856 722 ret = OV9655_BLACK_WHITE_BW_NEGATIVE;
bcostm 6:e1d9da7fe856 723 break;
bcostm 6:e1d9da7fe856 724 }
bcostm 6:e1d9da7fe856 725 case CAMERA_BLACK_WHITE_NORMAL:
bcostm 6:e1d9da7fe856 726 {
bcostm 6:e1d9da7fe856 727 ret = OV9655_BLACK_WHITE_NORMAL;
bcostm 6:e1d9da7fe856 728 break;
bcostm 6:e1d9da7fe856 729 }
bcostm 6:e1d9da7fe856 730 default:
bcostm 6:e1d9da7fe856 731 {
bcostm 6:e1d9da7fe856 732 ret = OV9655_BLACK_WHITE_NORMAL;
bcostm 6:e1d9da7fe856 733 break;
bcostm 6:e1d9da7fe856 734 }
bcostm 6:e1d9da7fe856 735 }
bcostm 6:e1d9da7fe856 736 break;
bcostm 6:e1d9da7fe856 737 }
bcostm 6:e1d9da7fe856 738 case CAMERA_CONTRAST_BRIGHTNESS:
bcostm 6:e1d9da7fe856 739 {
bcostm 6:e1d9da7fe856 740 switch(value)
bcostm 6:e1d9da7fe856 741 {
bcostm 6:e1d9da7fe856 742 case CAMERA_BRIGHTNESS_LEVEL0:
bcostm 6:e1d9da7fe856 743 {
bcostm 6:e1d9da7fe856 744 ret = OV9655_BRIGHTNESS_LEVEL0;
bcostm 6:e1d9da7fe856 745 break;
bcostm 6:e1d9da7fe856 746 }
bcostm 6:e1d9da7fe856 747 case CAMERA_BRIGHTNESS_LEVEL1:
bcostm 6:e1d9da7fe856 748 {
bcostm 6:e1d9da7fe856 749 ret = OV9655_BRIGHTNESS_LEVEL1;
bcostm 6:e1d9da7fe856 750 break;
bcostm 6:e1d9da7fe856 751 }
bcostm 6:e1d9da7fe856 752 case CAMERA_BRIGHTNESS_LEVEL2:
bcostm 6:e1d9da7fe856 753 {
bcostm 6:e1d9da7fe856 754 ret = OV9655_BRIGHTNESS_LEVEL2;
bcostm 6:e1d9da7fe856 755 break;
bcostm 6:e1d9da7fe856 756 }
bcostm 6:e1d9da7fe856 757 case CAMERA_BRIGHTNESS_LEVEL3:
bcostm 6:e1d9da7fe856 758 {
bcostm 6:e1d9da7fe856 759 ret = OV9655_BRIGHTNESS_LEVEL3;
bcostm 6:e1d9da7fe856 760 break;
bcostm 6:e1d9da7fe856 761 }
bcostm 6:e1d9da7fe856 762 case CAMERA_BRIGHTNESS_LEVEL4:
bcostm 6:e1d9da7fe856 763 {
bcostm 6:e1d9da7fe856 764 ret = OV9655_BRIGHTNESS_LEVEL4;
bcostm 6:e1d9da7fe856 765 break;
bcostm 6:e1d9da7fe856 766 }
bcostm 6:e1d9da7fe856 767 case CAMERA_CONTRAST_LEVEL0:
bcostm 6:e1d9da7fe856 768 {
bcostm 6:e1d9da7fe856 769 ret = OV9655_CONTRAST_LEVEL0;
bcostm 6:e1d9da7fe856 770 break;
bcostm 6:e1d9da7fe856 771 }
bcostm 6:e1d9da7fe856 772 case CAMERA_CONTRAST_LEVEL1:
bcostm 6:e1d9da7fe856 773 {
bcostm 6:e1d9da7fe856 774 ret = OV9655_CONTRAST_LEVEL1;
bcostm 6:e1d9da7fe856 775 break;
bcostm 6:e1d9da7fe856 776 }
bcostm 6:e1d9da7fe856 777 case CAMERA_CONTRAST_LEVEL2:
bcostm 6:e1d9da7fe856 778 {
bcostm 6:e1d9da7fe856 779 ret = OV9655_CONTRAST_LEVEL2;
bcostm 6:e1d9da7fe856 780 break;
bcostm 6:e1d9da7fe856 781 }
bcostm 6:e1d9da7fe856 782 case CAMERA_CONTRAST_LEVEL3:
bcostm 6:e1d9da7fe856 783 {
bcostm 6:e1d9da7fe856 784 ret = OV9655_CONTRAST_LEVEL3;
bcostm 6:e1d9da7fe856 785 break;
bcostm 6:e1d9da7fe856 786 }
bcostm 6:e1d9da7fe856 787 case CAMERA_CONTRAST_LEVEL4:
bcostm 6:e1d9da7fe856 788 {
bcostm 6:e1d9da7fe856 789 ret = OV9655_CONTRAST_LEVEL4;
bcostm 6:e1d9da7fe856 790 break;
bcostm 6:e1d9da7fe856 791 }
bcostm 6:e1d9da7fe856 792 default:
bcostm 6:e1d9da7fe856 793 {
bcostm 6:e1d9da7fe856 794 ret = OV9655_CONTRAST_LEVEL0;
bcostm 6:e1d9da7fe856 795 break;
bcostm 6:e1d9da7fe856 796 }
bcostm 6:e1d9da7fe856 797 }
bcostm 6:e1d9da7fe856 798 break;
bcostm 6:e1d9da7fe856 799 }
bcostm 6:e1d9da7fe856 800 case CAMERA_COLOR_EFFECT:
bcostm 6:e1d9da7fe856 801 {
bcostm 6:e1d9da7fe856 802 switch(value)
bcostm 6:e1d9da7fe856 803 {
bcostm 6:e1d9da7fe856 804 case CAMERA_COLOR_EFFECT_ANTIQUE:
bcostm 6:e1d9da7fe856 805 {
bcostm 6:e1d9da7fe856 806 ret = OV9655_COLOR_EFFECT_ANTIQUE;
bcostm 6:e1d9da7fe856 807 break;
bcostm 6:e1d9da7fe856 808 }
bcostm 6:e1d9da7fe856 809 case CAMERA_COLOR_EFFECT_BLUE:
bcostm 6:e1d9da7fe856 810 {
bcostm 6:e1d9da7fe856 811 ret = OV9655_COLOR_EFFECT_BLUE;
bcostm 6:e1d9da7fe856 812 break;
bcostm 6:e1d9da7fe856 813 }
bcostm 6:e1d9da7fe856 814 case CAMERA_COLOR_EFFECT_GREEN:
bcostm 6:e1d9da7fe856 815 {
bcostm 6:e1d9da7fe856 816 ret = OV9655_COLOR_EFFECT_GREEN;
bcostm 6:e1d9da7fe856 817 break;
bcostm 6:e1d9da7fe856 818 }
bcostm 6:e1d9da7fe856 819 case CAMERA_COLOR_EFFECT_RED:
bcostm 6:e1d9da7fe856 820 {
bcostm 6:e1d9da7fe856 821 ret = OV9655_COLOR_EFFECT_RED;
bcostm 6:e1d9da7fe856 822 break;
bcostm 6:e1d9da7fe856 823 }
bcostm 6:e1d9da7fe856 824 case CAMERA_COLOR_EFFECT_NONE:
bcostm 6:e1d9da7fe856 825 default:
bcostm 6:e1d9da7fe856 826 {
bcostm 6:e1d9da7fe856 827 ret = OV9655_COLOR_EFFECT_NONE;
bcostm 6:e1d9da7fe856 828 break;
bcostm 6:e1d9da7fe856 829 }
bcostm 6:e1d9da7fe856 830 }
bcostm 6:e1d9da7fe856 831 break;
bcostm 6:e1d9da7fe856 832 default:
bcostm 6:e1d9da7fe856 833 {
bcostm 6:e1d9da7fe856 834 ret = 0;
bcostm 6:e1d9da7fe856 835 break;
bcostm 6:e1d9da7fe856 836 }
bcostm 6:e1d9da7fe856 837 }
bcostm 6:e1d9da7fe856 838 }
bcostm 6:e1d9da7fe856 839
bcostm 6:e1d9da7fe856 840 return ret;
bcostm 6:e1d9da7fe856 841 }
bcostm 6:e1d9da7fe856 842
bcostm 6:e1d9da7fe856 843 /**
bcostm 6:e1d9da7fe856 844 * @}
bcostm 6:e1d9da7fe856 845 */
bcostm 6:e1d9da7fe856 846
bcostm 6:e1d9da7fe856 847 /**
bcostm 6:e1d9da7fe856 848 * @}
bcostm 6:e1d9da7fe856 849 */
bcostm 6:e1d9da7fe856 850
bcostm 6:e1d9da7fe856 851 /**
bcostm 6:e1d9da7fe856 852 * @}
bcostm 6:e1d9da7fe856 853 */
bcostm 6:e1d9da7fe856 854
bcostm 6:e1d9da7fe856 855 /**
bcostm 6:e1d9da7fe856 856 * @}
bcostm 6:e1d9da7fe856 857 */
bcostm 6:e1d9da7fe856 858
bcostm 6:e1d9da7fe856 859 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/