SPKT

Dependencies:   mbed

Committer:
phungductung
Date:
Fri Jun 07 15:36:42 2019 +0000
Revision:
10:e4fe96f3a891
Parent:
6:e1d9da7fe856
SPKT;

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