PicoCamera
0.2.0
Camera library for RP2040 with an esp32-camera compatible API
GitHub
Toggle main menu visibility
载入中...
搜索中...
未找到
ov7670_regs.h
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
9
/*
10
* This file is for the OpenMV project so the OV7670 can be used
11
* author: Juan Schiavoni <juanjoseschiavoni@hotmail.com>
12
*
13
* OV7670 register definitions.
14
*
15
* Adopted verbatim from esp32-camera (sensors/private_include/ov7670_regs.h),
16
* which carries the OpenMV MIT license header above.
17
*/
18
#ifndef __OV7670_REG_REGS_H__
19
#define __OV7670_REG_REGS_H__
20
#define GAIN 0x00
/* AGC – Gain control gain setting */
21
#define BLUE 0x01
/* AWB – Blue channel gain setting */
22
#define RED 0x02
/* AWB – Red channel gain setting */
23
#define VREF 0x03
/* AWB – Green channel gain setting */
24
#define COM1 0x04
/* Common Control 1 */
25
#define BAVG 0x05
/* U/B Average Level */
26
#define GAVG 0x06
/* Y/Gb Average Level */
27
#define AECH 0x07
/* Exposure VAlue - AEC MSB 5 bits */
28
#define RAVG 0x08
/* V/R Average Level */
29
30
#define COM2 0x09
/* Common Control 2 */
31
#define COM2_SOFT_SLEEP 0x10
/* Soft sleep mode */
32
#define COM2_OUT_DRIVE_1x 0x00
/* Output drive capability 1x */
33
#define COM2_OUT_DRIVE_2x 0x01
/* Output drive capability 2x */
34
#define COM2_OUT_DRIVE_3x 0x02
/* Output drive capability 3x */
35
#define COM2_OUT_DRIVE_4x 0x03
/* Output drive capability 4x */
36
37
#define REG_PID 0x0A
/* Product ID Number MSB */
38
#define REG_VER 0x0B
/* Product ID Number LSB */
39
40
#define COM3 0x0C
/* Common Control 3 */
41
#define COM3_SWAP_OUT 0x40
/* Output data MSB/LSB swap */
42
#define COM3_TRI_CLK 0x20
/* Tri-state output clock */
43
#define COM3_TRI_DATA 0x10
/* Tri-state option output */
44
#define COM3_SCALE_EN 0x08
/* Scale enable */
45
#define COM3_DCW 0x04
/* DCW enable */
46
47
#define COM4 0x0D
/* Common Control 4 */
48
#define COM4_PLL_BYPASS 0x00
/* Bypass PLL */
49
#define COM4_PLL_4x 0x40
/* PLL frequency 4x */
50
#define COM4_PLL_6x 0x80
/* PLL frequency 6x */
51
#define COM4_PLL_8x 0xc0
/* PLL frequency 8x */
52
#define COM4_AEC_FULL 0x00
/* AEC evaluate full window */
53
#define COM4_AEC_1_2 0x10
/* AEC evaluate 1/2 window */
54
#define COM4_AEC_1_4 0x20
/* AEC evaluate 1/4 window */
55
#define COM4_AEC_2_3 0x30
/* AEC evaluate 2/3 window */
56
57
#define COM5 0x0E
/* Common Control 5 */
58
#define COM5_AFR 0x80
/* Auto frame rate control ON/OFF selection (night mode) */
59
#define COM5_AFR_SPEED 0x40
/* Auto frame rate control speed selection */
60
#define COM5_AFR_0 0x00
/* No reduction of frame rate */
61
#define COM5_AFR_1_2 0x10
/* Max reduction to 1/2 frame rate */
62
#define COM5_AFR_1_4 0x20
/* Max reduction to 1/4 frame rate */
63
#define COM5_AFR_1_8 0x30
/* Max reduction to 1/8 frame rate */
64
#define COM5_AFR_4x 0x04
/* Add frame when AGC reaches 4x gain */
65
#define COM5_AFR_8x 0x08
/* Add frame when AGC reaches 8x gain */
66
#define COM5_AFR_16x 0x0c
/* Add frame when AGC reaches 16x gain */
67
#define COM5_AEC_NO_LIMIT 0x01
/* No limit to AEC increase step */
68
69
#define COM6 0x0F
/* Common Control 6 */
70
#define COM6_AUTO_WINDOW 0x01
/* Auto window setting ON/OFF selection when format changes */
71
72
#define AEC 0x10
/* AEC[7:0] (see register AECH for AEC[15:8]) */
73
#define CLKRC 0x11
/* Internal Clock */
74
75
#define COM7 0x12
/* Common Control 7 */
76
#define COM7_RESET 0x80
/* SCCB Register Reset */
77
#define COM7_RES_VGA 0x00
/* Resolution VGA */
78
#define COM7_RES_QVGA 0x40
/* Resolution QVGA */
79
#define COM7_BT656 0x20
/* BT.656 protocol ON/OFF */
80
#define COM7_SENSOR_RAW 0x10
/* Sensor RAW */
81
#define COM7_FMT_GBR422 0x00
/* RGB output format GBR422 */
82
#define COM7_FMT_RGB565 0x04
/* RGB output format RGB565 */
83
#define COM7_FMT_RGB555 0x08
/* RGB output format RGB555 */
84
#define COM7_FMT_RGB444 0x0C
/* RGB output format RGB444 */
85
#define COM7_FMT_YUV 0x00
/* Output format YUV */
86
#define COM7_FMT_P_BAYER 0x01
/* Output format Processed Bayer RAW */
87
#define COM7_FMT_RGB 0x04
/* Output format RGB */
88
#define COM7_FMT_R_BAYER 0x03
/* Output format Bayer RAW */
89
#define COM7_SET_FMT(r, x) ((r&0xFC)|((x&0x5)<<0))
90
91
#define COM8 0x13
/* Common Control 8 */
92
#define COM8_FAST_AUTO 0x80
/* Enable fast AGC/AEC algorithm */
93
#define COM8_STEP_VSYNC 0x00
/* AEC - Step size limited to vertical blank */
94
#define COM8_STEP_UNLIMIT 0x40
/* AEC - Step size unlimited step size */
95
#define COM8_BANDF_EN 0x20
/* Banding filter ON/OFF */
96
#define COM8_AEC_BANDF 0x10
/* Enable AEC below banding value */
97
#define COM8_AEC_FINE_EN 0x08
/* Fine AEC ON/OFF control */
98
#define COM8_AGC_EN 0x04
/* AGC Enable */
99
#define COM8_AWB_EN 0x02
/* AWB Enable */
100
#define COM8_AEC_EN 0x01
/* AEC Enable */
101
#define COM8_SET_AGC(r, x) ((r&0xFB)|((x&0x1)<<2))
102
#define COM8_SET_AWB(r, x) ((r&0xFD)|((x&0x1)<<1))
103
#define COM8_SET_AEC(r, x) ((r&0xFE)|((x&0x1)<<0))
104
105
#define COM9 0x14
/* Common Control 9 */
106
#define COM9_HISTO_AVG 0x80
/* Histogram or average based AEC/AGC selection */
107
#define COM9_AGC_GAIN_2x 0x00
/* Automatic Gain Ceiling 2x */
108
#define COM9_AGC_GAIN_4x 0x10
/* Automatic Gain Ceiling 4x */
109
#define COM9_AGC_GAIN_8x 0x20
/* Automatic Gain Ceiling 8x */
110
#define COM9_AGC_GAIN_16x 0x30
/* Automatic Gain Ceiling 16x */
111
#define COM9_AGC_GAIN_32x 0x40
/* Automatic Gain Ceiling 32x */
112
#define COM9_DROP_VSYNC 0x04
/* Drop VSYNC output of corrupt frame */
113
#define COM9_DROP_HREF 0x02
/* Drop HREF output of corrupt frame */
114
#define COM9_SET_AGC(r, x) ((r&0x8F)|((x&0x07)<<4))
115
116
#define COM10 0x15
/* Common Control 10 */
117
#define COM10_NEGATIVE 0x80
/* Output negative data */
118
#define COM10_HSYNC_EN 0x40
/* HREF changes to HSYNC */
119
#define COM10_PCLK_FREE 0x00
/* PCLK output option: free running PCLK */
120
#define COM10_PCLK_MASK 0x20
/* PCLK output option: masked during horizontal blank */
121
#define COM10_PCLK_REV 0x10
/* PCLK reverse */
122
#define COM10_HREF_REV 0x08
/* HREF reverse */
123
#define COM10_VSYNC_FALLING 0x00
/* VSYNC changes on falling edge of PCLK */
124
#define COM10_VSYNC_RISING 0x04
/* VSYNC changes on rising edge of PCLK */
125
#define COM10_VSYNC_NEG 0x02
/* VSYNC negative */
126
#define COM10_OUT_RANGE_8 0x01
/* Output data range: Full range */
127
#define COM10_OUT_RANGE_10 0x00
/* Output data range: Data from [10] to [F0] (8 MSBs) */
128
129
#define RSVD_16 0x16
/* Reserved register */
130
131
#define HSTART 0x17
/* Horizontal Frame (HREF column) Start high 8-bit(low 3 bits are at HREF[2:0]) */
132
#define HSTOP 0x18
/* Horizontal Frame (HREF column) end high 8-bit (low 3 bits are at HREF[5:3]) */
133
#define VSTART 0x19
/* Vertical Frame (row) Start high 8-bit (low 2 bits are at VREF[1:0]) */
134
#define VSTOP 0x1A
/* Vertical Frame (row) End high 8-bit (low 2 bits are at VREF[3:2]) */
135
#define PSHFT 0x1B
/* Data Format - Pixel Delay Select */
136
#define REG_MIDH 0x1C
/* Manufacturer ID Byte – High */
137
#define REG_MIDL 0x1D
/* Manufacturer ID Byte – Low */
138
139
#define MVFP 0x1E
/* Mirror/Vflip Enable */
140
#define MVFP_MIRROR 0x20
/* Mirror image */
141
#define MVFP_FLIP 0x10
/* Vertical flip */
142
#define MVFP_SUN 0x02
/* Black sun enable */
143
#define MVFP_SET_MIRROR(r,x) ((r&0xDF)|((x&1)<<5))
/* change only bit5 according to x */
144
#define MVFP_SET_FLIP(r,x) ((r&0xEF)|((x&1)<<4))
/* change only bit4 according to x */
145
146
#define LAEC 0x1F
/* Fine AEC Value - defines exposure value less than one row period (Reserved?) */
147
#define ADCCTR0 0x20
/* ADC control */
148
#define ADCCTR1 0x21
/* reserved */
149
#define ADCCTR2 0x22
/* reserved */
150
#define ADCCTR3 0x23
/* reserved */
151
#define AEW 0x24
/* AGC/AEC - Stable Operating Region (Upper Limit) */
152
#define AEB 0x25
/* AGC/AEC - Stable Operating Region (Lower Limit) */
153
#define VPT 0x26
/* AGC/AEC Fast Mode Operating Region */
154
#define BBIAS 0x27
/* B channel signal output bias (effective only when COM6[3]=1) */
155
#define GbBIAS 0x28
/* Gb channel signal output bias (effective only when COM6[3]=1) */
156
#define RSVD_29 0x29
/* reserved */
157
#define EXHCH 0x2A
/* Dummy Pixel Insert MSB */
158
#define EXHCL 0x2B
/* Dummy Pixel Insert LSB */
159
#define RBIAS 0x2C
/* R channel signal output bias (effective only when COM6[3]=1) */
160
#define ADVFL 0x2D
/* LSB of Insert Dummy Rows in Vertical Sync (1 bit equals 1 row) */
161
#define ADVFH 0x2E
/* MSB of Insert Dummy Rows in Vertical Sync */
162
#define YAVE 0x2F
/* Y/G Channel Average Value */
163
#define HSYST 0x30
/* HSync rising edge delay */
164
#define HSYEN 0x31
/* HSync falling edge delay */
165
#define HREF 0x32
/* Image Start and Size Control DIFFERENT CONTROL SEQUENCE */
166
#define CHLF 0x33
/* Array Current control */
167
#define ARBLM 0x34
/* Array reference control */
168
#define RSVD_35 0x35
/* Reserved */
169
#define RSVD_36 0x36
/* Reserved */
170
#define ADC 0x37
/* ADC control */
171
#define ACOM 0x38
/* ADC and analog common mode control */
172
#define OFON 0x39
/* ADC offset control */
173
#define TSLB 0x3A
/* Line buffer test option */
174
175
#define COM11 0x3B
/* Common control 11 */
176
#define COM11_EXP 0x02
177
#define COM11_HZAUTO 0x10
/* Auto detect 50/60 Hz */
178
179
#define COM12 0x3C
/* Common control 12 */
180
181
#define COM13 0x3D
/* Common control 13 */
182
#define COM13_GAMMA 0x80
/* Gamma enable */
183
#define COM13_UVSAT 0x40
/* UV saturation auto adjustment */
184
#define COM13_UVSWAP 0x01
/* Swap U/V in the YUV output byte stream */
185
186
#define COM14 0x3E
/* Common Control 14 */
187
188
#define EDGE 0x3F
/* edge enhancement adjustment */
189
#define COM15 0x40
/* Common Control 15 DIFFERENT CONTROLS */
190
#define COM15_SET_RGB565(r,x) ((r&0xEF)|((x&1)<<4))
/* set rgb565 mode */
191
#define COM15_RGB565 0x10
/* RGB565 output */
192
#define COM15_R00FF 0xC0
/* Output range: [00] to [FF] */
193
194
#define COM16 0x41
/* Common Control 16 DIFFERENT CONTROLS */
195
#define COM16_AWBGAIN 0x08
/* AWB gain enable */
196
#define COM17 0x42
/* Common Control 17 */
197
198
#define AWBC1 0x43
/* Reserved */
199
#define AWBC2 0x44
/* Reserved */
200
#define AWBC3 0x45
/* Reserved */
201
#define AWBC4 0x46
/* Reserved */
202
#define AWBC5 0x47
/* Reserved */
203
#define AWBC6 0x48
/* Reserved */
204
205
#define RSVD_49 0x49
/* Reserved */
206
#define RSVD_4A 0x4A
/* Reserved */
207
208
#define REG4B 0x4B
/* Register 4B */
209
#define DNSTH 0x4C
/* Denoise strength */
210
211
#define RSVD_4D 0x4D
/* Reserved */
212
#define RSVD_4E 0x4E
/* Reserved */
213
214
#define MTX1 0x4F
/* Matrix coefficient 1 */
215
#define MTX2 0x50
/* Matrix coefficient 2 */
216
#define MTX3 0x51
/* Matrix coefficient 3 */
217
#define MTX4 0x52
/* Matrix coefficient 4 */
218
#define MTX5 0x53
/* Matrix coefficient 5 */
219
#define MTX6 0x54
/* Matrix coefficient 6 */
220
#define BRIGHTNESS 0x55
/* Brightness control */
221
#define CONTRAST 0x56
/* Contrast control */
222
#define CONTRASCENTER 0x57
/* Contrast center */
223
#define MTXS 0x58
/* Matrix coefficient sign for coefficient 5 to 0*/
224
225
#define RSVD_59 0x59
/* Reserved */
226
#define RSVD_5A 0x5A
/* Reserved */
227
#define RSVD_5B 0x5B
/* Reserved */
228
#define RSVD_5C 0x5C
/* Reserved */
229
#define RSVD_5D 0x5D
/* Reserved */
230
#define RSVD_5E 0x5E
/* Reserved */
231
#define RSVD_5F 0x5F
/* Reserved */
232
#define RSVD_60 0x60
/* Reserved */
233
#define RSVD_61 0x61
/* Reserved */
234
235
#define LCC1 0x62
/* Lens correction option 1 */
236
237
#define LCC2 0x63
/* Lens correction option 2 */
238
#define LCC3 0x64
/* Lens correction option 3 */
239
#define LCC4 0x65
/* Lens correction option 4 */
240
#define LCC5 0x66
/* Lens correction option 5 */
241
242
#define MANU 0x67
/* Manual U Value */
243
#define MANV 0x68
/* Manual V Value */
244
#define GFIX 0x69
/* Fix gain control */
245
#define GGAIN 0x6A
/* G channel AWB gain */
246
247
#define DBLV 0x6B
/* PLL and clock ? */
248
249
#define AWBCTR3 0x6C
/* AWB Control 3 */
250
#define AWBCTR2 0x6D
/* AWB Control 2 */
251
#define AWBCTR1 0x6E
/* AWB Control 1 */
252
#define AWBCTR0 0x6F
/* AWB Control 0 */
253
#define SCALING_XSC 0x70
/* test pattern and horizontal scaling factor */
254
#define SCALING_XSC_CBAR(r) (r&0x7F)
/* make sure bit7 is 0 for color bar */
255
#define SCALING_YSC 0x71
/* test pattern and vertical scaling factor */
256
#define SCALING_YSC_CBAR(r,x) ((r&0x7F)|((x&1)<<7))
/* change bit7 for color bar on/off */
257
#define SCALING_DCWCTR 0x72
/* DCW control */
258
#define SCALING_PCLK_DIV 0x73
/* */
259
#define REG74 0x74
/* */
260
#define REG75 0x75
/* */
261
#define REG76 0x76
/* */
262
#define REG77 0x77
/* */
263
264
#define RSVD_78 0x78
/* Reserved */
265
#define RSVD_79 0x79
/* Reserved */
266
267
#define SLOP 0x7A
/* Gamma curve highest segment slope */
268
#define GAM1 0x7B
/* Gamma Curve 1st Segment Input End Point 0x04 Output Value */
269
#define GAM2 0x7C
/* Gamma Curve 2nd Segment Input End Point 0x08 Output Value */
270
#define GAM3 0x7D
/* Gamma Curve 3rd Segment Input End Point 0x10 Output Value */
271
#define GAM4 0x7E
/* Gamma Curve 4th Segment Input End Point 0x20 Output Value */
272
#define GAM5 0x7F
/* Gamma Curve 5th Segment Input End Point 0x28 Output Value */
273
#define GAM6 0x80
/* Gamma Curve 6rd Segment Input End Point 0x30 Output Value */
274
#define GAM7 0x81
/* Gamma Curve 7th Segment Input End Point 0x38 Output Value */
275
#define GAM8 0x82
/* Gamma Curve 8th Segment Input End Point 0x40 Output Value */
276
#define GAM9 0x83
/* Gamma Curve 9th Segment Input End Point 0x48 Output Value */
277
#define GAM10 0x84
/* Gamma Curve 10th Segment Input End Point 0x50 Output Value */
278
#define GAM11 0x85
/* Gamma Curve 11th Segment Input End Point 0x60 Output Value */
279
#define GAM12 0x86
/* Gamma Curve 12th Segment Input End Point 0x70 Output Value */
280
#define GAM13 0x87
/* Gamma Curve 13th Segment Input End Point 0x90 Output Value */
281
#define GAM14 0x88
/* Gamma Curve 14th Segment Input End Point 0xB0 Output Value */
282
#define GAM15 0x89
/* Gamma Curve 15th Segment Input End Point 0xD0 Output Value */
283
284
#define RSVD_8A 0x8A
/* Reserved */
285
#define RSVD_8B 0x8B
/* Reserved */
286
287
#define RGB444 0x8C
/* */
288
289
#define RSVD_8D 0x8D
/* Reserved */
290
#define RSVD_8E 0x8E
/* Reserved */
291
#define RSVD_8F 0x8F
/* Reserved */
292
#define RSVD_90 0x90
/* Reserved */
293
#define RSVD_91 0x91
/* Reserved */
294
295
#define DM_LNL 0x92
/* Dummy line low 8 bit */
296
#define DM_LNH 0x93
/* Dummy line high 8 bit */
297
#define LCC6 0x94
/* Lens correction option 6 */
298
#define LCC7 0x95
/* Lens correction option 7 */
299
300
#define RSVD_96 0x96
/* Reserved */
301
#define RSVD_97 0x97
/* Reserved */
302
#define RSVD_98 0x98
/* Reserved */
303
#define RSVD_99 0x99
/* Reserved */
304
#define RSVD_9A 0x9A
/* Reserved */
305
#define RSVD_9B 0x9B
/* Reserved */
306
#define RSVD_9C 0x9C
/* Reserved */
307
308
#define BD50ST 0x9D
/* 50 Hz banding filter value */
309
#define BD60ST 0x9E
/* 60 Hz banding filter value */
310
#define HAECC1 0x9F
/* Histogram-based AEC/AGC control 1 */
311
#define HAECC2 0xA0
/* Histogram-based AEC/AGC control 2 */
312
313
#define RSVD_A1 0xA1
/* Reserved */
314
315
#define SCALING_PCLK_DELAY 0xA2
/* Pixel clock delay */
316
317
#define RSVD_A3 0xA3
/* Reserved */
318
319
#define NT_CNTRL 0xA4
/* */
320
#define BD50MAX 0xA5
/* 50 Hz banding step limit */
321
#define HAECC3 0xA6
/* Histogram-based AEC/AGC control 3 */
322
#define HAECC4 0xA7
/* Histogram-based AEC/AGC control 4 */
323
#define HAECC5 0xA8
/* Histogram-based AEC/AGC control 5 */
324
#define HAECC6 0xA9
/* Histogram-based AEC/AGC control 6 */
325
326
#define HAECC7 0xAA
/* Histogram-based AEC/AGC control 7 */
327
#define HAECC_EN 0x80
/* Histogram-based AEC algorithm enable */
328
329
#define BD60MAX 0xAB
/* 60 Hz banding step limit */
330
331
#define STR_OPT 0xAC
/* Register AC */
332
#define STR_R 0xAD
/* R gain for led output frame */
333
#define STR_G 0xAE
/* G gain for led output frame */
334
#define STR_B 0xAF
/* B gain for led output frame */
335
#define RSVD_B0 0xB0
/* Reserved */
336
#define ABLC1 0xB1
/* */
337
#define RSVD_B2 0xB2
/* Reserved */
338
#define THL_ST 0xB3
/* ABLC target */
339
#define THL_DLT 0xB5
/* ABLC stable range */
340
341
#define RSVD_B6 0xB6
/* Reserved */
342
#define RSVD_B7 0xB7
/* Reserved */
343
#define RSVD_B8 0xB8
/* Reserved */
344
#define RSVD_B9 0xB9
/* Reserved */
345
#define RSVD_BA 0xBA
/* Reserved */
346
#define RSVD_BB 0xBB
/* Reserved */
347
#define RSVD_BC 0xBC
/* Reserved */
348
#define RSVD_BD 0xBD
/* Reserved */
349
350
#define AD_CHB 0xBE
/* blue channel black level compensation */
351
#define AD_CHR 0xBF
/* Red channel black level compensation */
352
#define AD_CHGb 0xC0
/* Gb channel black level compensation */
353
#define AD_CHGr 0xC1
/* Gr channel black level compensation */
354
355
#define RSVD_C2 0xC2
/* Reserved */
356
#define RSVD_C3 0xC3
/* Reserved */
357
#define RSVD_C4 0xC4
/* Reserved */
358
#define RSVD_C5 0xC5
/* Reserved */
359
#define RSVD_C6 0xC6
/* Reserved */
360
#define RSVD_C7 0xC7
/* Reserved */
361
#define RSVD_C8 0xC8
/* Reserved */
362
363
#define SATCTR 0xC9
/* Saturation control */
364
#define SET_REG(reg, x) (##reg_DEFAULT|x)
365
366
#endif
//__OV7670_REG_REGS_H__
English version
制作者
doxygen
1.18.0