Projet

Dependents:   DISCO-F746NG_Scope_copy

Fork of BSP_DISCO_F746NG by ST

Committer:
bcostm
Date:
Mon Jan 04 15:19:15 2016 +0000
Revision:
1:ee089790cdbb
Add missing files

Who changed what in which revision?

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