1 /* ----------------------------------------------------------------------------
\r
2 * SAM Software Package License
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2013, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
31 /*----------------------------------------------------------------------------
\r
33 *----------------------------------------------------------------------------*/
\r
36 const static struct capture_size ov_sizes[] = {
\r
51 /*----------------------------------------------------------------------------
\r
53 *----------------------------------------------------------------------------*/
\r
56 * \brief Configure the OV for a specified image size, pixel format,
\r
59 void ov_configure(Twid *pTwid, uint8_t ovType, uint32_t width, uint32_t heigth)
\r
61 const struct ov_reg *reg_conf;
\r
62 uint8_t goodCaptureSize = 0;
\r
65 reg_conf = ov5640_yuv_vga;
\r
66 TRACE_DEBUG("ovxxx_configure\n\r");
\r
67 for( i = 0; i< sizeof(ov_sizes); i++ ) {
\r
68 if( ov_sizes[i].width == width ) {
\r
69 if( ov_sizes[i].height != heigth ) {
\r
70 TRACE_INFO("ov configure vsize not define\n\r");
\r
73 goodCaptureSize = 1;
\r
78 if( goodCaptureSize == 0 ) {
\r
79 TRACE_ERROR("Problem size\n\r");
\r
85 reg_conf = ov2640_yuv_qvga;
\r
86 // common register initialization
\r
89 printf("-I- QVGA 640 x 480\n\r");
\r
90 reg_conf = ov2640_yuv_qvga;
\r
93 printf("-I- VGA 640 x 480\n\r");
\r
94 reg_conf = ov2640_yuv_vga;
\r
97 TRACE_DEBUG("ov2640_configure problem\n\r");
\r
104 reg_conf = ov7740_yuv_vga;
\r
105 // common register initialization
\r
108 printf("-I- VGA 640 x 480\n\r");
\r
109 reg_conf = ov7740_yuv_vga;
\r
112 TRACE_DEBUG("ov7740_configure problem\n\r");
\r
119 reg_conf = ov9740_yuv_vga;
\r
120 // common register initialization
\r
123 printf("-I- VGA 640 x 360\n\r");
\r
124 reg_conf = ov9740_yuv_vga;
\r
127 printf("-I- VGA 1280 x 720\n\r");
\r
128 reg_conf = ov9740_yuv_sxga;
\r
131 TRACE_DEBUG("ov9740_configure problem\n\r");
\r
138 reg_conf = ov2643_yuv_vga;
\r
139 // common register initialization
\r
142 printf("-I- UXGA 1600 x 1200 \n\r");
\r
143 reg_conf = ov2643_yuv_uxga;
\r
146 printf("-I- SWVGA 800 x 600\n\r");
\r
147 reg_conf = ov2643_yuv_swvga;
\r
150 printf("-I- VGA 640 x 480\n\r");
\r
151 reg_conf = ov2643_yuv_vga;
\r
154 TRACE_DEBUG("ov2643_configure problem\n\r");
\r
161 reg_conf = ov5640_yuv_vga;
\r
162 // common register initialization
\r
165 printf("-I- VGA 640 x 480\n\r");
\r
166 reg_conf = ov5640_yuv_vga;
\r
169 printf("-I- SXGA 1280 x 720\n\r");
\r
170 reg_conf = ov5640_yuv_sxga;
\r
173 TRACE_DEBUG("ov5640_configure problem\n\r");
\r
179 if ((ovType == OV_5640) || (ovType == OV_9740))
\r
180 ov_write_regs16(pTwid, reg_conf);
\r
182 ov_write_regs8(pTwid, reg_conf);
\r
187 * \brief Configure the OV 5640 afc fireware.
\r
189 void ov_5640Afc_Firmware(Twid *pTwid)
\r
191 const struct ov_reg *reg_conf;
\r
192 reg_conf = ov5640_afc;
\r
193 ov_write_regs16(pTwid, reg_conf);
\r