PicoCamera 0.2.0
Camera library for RP2040 with an esp32-camera compatible API
GitHub
Loading...
Searching...
No Matches
ov3660_settings.h
Go to the documentation of this file.
1/*
2 * This file is part of the PicoCamera project.
3 * https://github.com/umeiko/PicoCamera
4 *
5 * Author: umeko <umeko@stu.xmu.edu.cn>
6 * License: MIT
7 */
8
23#ifndef OV3660_SETTINGS_H
24#define OV3660_SETTINGS_H
25
26#include <stdint.h>
27
28#include "ov3660_regs.h"
29
30#define REG_DLY 0xFFFE // delay marker, value = milliseconds
31#define REGLIST_TAIL 0xFFFF // list terminator
32
33typedef struct {
34 uint16_t max_width;
35 uint16_t max_height;
36 uint16_t start_x;
37 uint16_t start_y;
38 uint16_t end_x;
39 uint16_t end_y;
40 uint16_t offset_x;
41 uint16_t offset_y;
42 uint16_t total_x;
43 uint16_t total_y;
45
46static const ratio_settings_t ratio_table[] = {
47 // mw, mh, sx, sy, ex, ey, ox, oy, tx, ty
48 { 2048, 1536, 0, 0, 2079, 1547, 16, 6, 2300, 1564 }, //4x3
49 { 1920, 1280, 64, 128, 2015, 1419, 16, 6, 2172, 1436 }, //3x2
50 { 2048, 1280, 0, 128, 2079, 1419, 16, 6, 2300, 1436 }, //16x10
51 { 1920, 1152, 64, 192, 2015, 1355, 16, 6, 2172, 1372 }, //5x3
52 { 1920, 1080, 64, 242, 2015, 1333, 16, 6, 2172, 1322 }, //16x9
53 { 2048, 880, 0, 328, 2079, 1219, 16, 6, 2300, 1236 }, //21x9
54 { 1920, 1536, 64, 0, 2015, 1547, 16, 6, 2172, 1564 }, //5x4
55 { 1536, 1536, 256, 0, 1823, 1547, 16, 6, 2044, 1564 }, //1x1
56 { 864, 1536, 592, 0, 1487, 1547, 16, 6, 2044, 1564 } //9x16
57};
58
59static const uint16_t ov3660_settings_default[][2] = {
60 {SYSTEM_CTROL0, 0x82}, // software reset
61 {REG_DLY, 10}, // delay 10ms
62
63 {0x3103, 0x13},
64 {SYSTEM_CTROL0, 0x42},
65 {0x3017, 0xff},
66 {0x3018, 0xff},
67 {DRIVE_CAPABILITY, 0xc3},
68 {CLOCK_POL_CONTROL, 0x21},
69
70 {0x3611, 0x01},
71 {0x3612, 0x2d},
72
73 {0x3032, 0x00},
74 {0x3614, 0x80},
75 {0x3618, 0x00},
76 {0x3619, 0x75},
77 {0x3622, 0x80},
78 {0x3623, 0x00},
79 {0x3624, 0x03},
80 {0x3630, 0x52},
81 {0x3632, 0x07},
82 {0x3633, 0xd2},
83 {0x3704, 0x80},
84 {0x3708, 0x66},
85 {0x3709, 0x12},
86 {0x370b, 0x12},
87 {0x3717, 0x00},
88 {0x371b, 0x60},
89 {0x371c, 0x00},
90 {0x3901, 0x13},
91
92 {0x3600, 0x08},
93 {0x3620, 0x43},
94 {0x3702, 0x20},
95 {0x3739, 0x48},
96 {0x3730, 0x20},
97 {0x370c, 0x0c},
98
99 {0x3a18, 0x00},
100 {0x3a19, 0xf8},
101
102 {0x3000, 0x10},
103 {0x3004, 0xef},
104
105 {0x6700, 0x05},
106 {0x6701, 0x19},
107 {0x6702, 0xfd},
108 {0x6703, 0xd1},
109 {0x6704, 0xff},
110 {0x6705, 0xff},
111
112 {0x3c01, 0x80},
113 {0x3c00, 0x04},
114 {0x3a08, 0x00}, {0x3a09, 0x62}, //50Hz Band Width Step (10bit)
115 {0x3a0e, 0x08}, //50Hz Max Bands in One Frame (6 bit)
116 {0x3a0a, 0x00}, {0x3a0b, 0x52}, //60Hz Band Width Step (10bit)
117 {0x3a0d, 0x09}, //60Hz Max Bands in One Frame (6 bit)
118
119 {0x3a00, 0x3a},//night mode off
120 {0x3a14, 0x09},
121 {0x3a15, 0x30},
122 {0x3a02, 0x09},
123 {0x3a03, 0x30},
124
125 {COMPRESSION_CTRL0E, 0x08},
126 {0x4520, 0x0b},
127 {0x460b, 0x37},
128 {0x4713, 0x02},
129 {0x471c, 0xd0},
130 {0x5086, 0x00},
131
132 {0x5002, 0x00},
133 {0x501f, 0x00},
134
135 {SYSTEM_CTROL0, 0x02},
136
137 {0x5180, 0xff},
138 {0x5181, 0xf2},
139 {0x5182, 0x00},
140 {0x5183, 0x14},
141 {0x5184, 0x25},
142 {0x5185, 0x24},
143 {0x5186, 0x16},
144 {0x5187, 0x16},
145 {0x5188, 0x16},
146 {0x5189, 0x68},
147 {0x518a, 0x60},
148 {0x518b, 0xe0},
149 {0x518c, 0xb2},
150 {0x518d, 0x42},
151 {0x518e, 0x35},
152 {0x518f, 0x56},
153 {0x5190, 0x56},
154 {0x5191, 0xf8},
155 {0x5192, 0x04},
156 {0x5193, 0x70},
157 {0x5194, 0xf0},
158 {0x5195, 0xf0},
159 {0x5196, 0x03},
160 {0x5197, 0x01},
161 {0x5198, 0x04},
162 {0x5199, 0x12},
163 {0x519a, 0x04},
164 {0x519b, 0x00},
165 {0x519c, 0x06},
166 {0x519d, 0x82},
167 {0x519e, 0x38},
168
169 {0x5381, 0x1d},
170 {0x5382, 0x60},
171 {0x5383, 0x03},
172 {0x5384, 0x0c},
173 {0x5385, 0x78},
174 {0x5386, 0x84},
175 {0x5387, 0x7d},
176 {0x5388, 0x6b},
177 {0x5389, 0x12},
178 {0x538a, 0x01},
179 {0x538b, 0x98},
180
181 {0x5480, 0x01},
182
183 {0x5000, 0xa7},
184 {0x5800, 0x0C},
185 {0x5801, 0x09},
186 {0x5802, 0x0C},
187 {0x5803, 0x0C},
188 {0x5804, 0x0D},
189 {0x5805, 0x17},
190 {0x5806, 0x06},
191 {0x5807, 0x05},
192 {0x5808, 0x04},
193 {0x5809, 0x06},
194 {0x580a, 0x09},
195 {0x580b, 0x0E},
196 {0x580c, 0x05},
197 {0x580d, 0x01},
198 {0x580e, 0x01},
199 {0x580f, 0x01},
200 {0x5810, 0x05},
201 {0x5811, 0x0D},
202 {0x5812, 0x05},
203 {0x5813, 0x01},
204 {0x5814, 0x01},
205 {0x5815, 0x01},
206 {0x5816, 0x05},
207 {0x5817, 0x0D},
208 {0x5818, 0x08},
209 {0x5819, 0x06},
210 {0x581a, 0x05},
211 {0x581b, 0x07},
212 {0x581c, 0x0B},
213 {0x581d, 0x0D},
214 {0x581e, 0x12},
215 {0x581f, 0x0D},
216 {0x5820, 0x0E},
217 {0x5821, 0x10},
218 {0x5822, 0x10},
219 {0x5823, 0x1E},
220 {0x5824, 0x53},
221 {0x5825, 0x15},
222 {0x5826, 0x05},
223 {0x5827, 0x14},
224 {0x5828, 0x54},
225 {0x5829, 0x25},
226 {0x582a, 0x33},
227 {0x582b, 0x33},
228 {0x582c, 0x34},
229 {0x582d, 0x16},
230 {0x582e, 0x24},
231 {0x582f, 0x41},
232 {0x5830, 0x50},
233 {0x5831, 0x42},
234 {0x5832, 0x15},
235 {0x5833, 0x25},
236 {0x5834, 0x34},
237 {0x5835, 0x33},
238 {0x5836, 0x24},
239 {0x5837, 0x26},
240 {0x5838, 0x54},
241 {0x5839, 0x25},
242 {0x583a, 0x15},
243 {0x583b, 0x25},
244 {0x583c, 0x53},
245 {0x583d, 0xCF},
246
247 {0x3a0f, 0x30},
248 {0x3a10, 0x28},
249 {0x3a1b, 0x30},
250 {0x3a1e, 0x28},
251 {0x3a11, 0x60},
252 {0x3a1f, 0x14},
253
254 {0x5302, 0x28},
255 {0x5303, 0x20},
256
257 {0x5306, 0x1c}, //de-noise offset 1
258 {0x5307, 0x28}, //de-noise offset 2
259
260 {0x4002, 0xc5},
261 {0x4003, 0x81},
262 {0x4005, 0x12},
263
264 {0x5688, 0x11},
265 {0x5689, 0x11},
266 {0x568a, 0x11},
267 {0x568b, 0x11},
268 {0x568c, 0x11},
269 {0x568d, 0x11},
270 {0x568e, 0x11},
271 {0x568f, 0x11},
272
273 {0x5580, 0x06},
274 {0x5588, 0x00},
275 {0x5583, 0x40},
276 {0x5584, 0x2c},
277
278 {ISP_CONTROL_01, 0x83}, // turn color matrix, awb and SDE
279 {REGLIST_TAIL, 0x00}, // tail
280};
281
282static const uint16_t ov3660_settings_jpeg[][2] = {
283 {FORMAT_CTRL, 0x00}, // YUV422
284 {FORMAT_CTRL00, 0x30}, // YUYV
285 {0x3002, 0x00},//0x1c to 0x00 !!!
286 {0x3006, 0xff},//0xc3 to 0xff !!!
287 {0x471c, 0x50},//0xd0 to 0x50 !!!
288 {REGLIST_TAIL, 0x00}, // tail
289};
290
291static const uint16_t ov3660_settings_rgb565[][2] = {
292 {FORMAT_CTRL, 0x01}, // RGB
293 {FORMAT_CTRL00, 0x61}, // RGB565 (BGR)
294 {REGLIST_TAIL, 0x00}
295};
296
297static const uint16_t ov3660_settings_yuv422[][2] = {
298 {FORMAT_CTRL, 0x00}, // YUV422
299 {FORMAT_CTRL00, 0x30}, // YUYV
300 {REGLIST_TAIL, 0x00}
301};
302
303#endif // OV3660_SETTINGS_H
OV3660 register definitions (16-bit addresses).
Definition ov2640.cpp:28
中文文档