PicoCamera
0.2.0
Camera library for RP2040 with an esp32-camera compatible API
GitHub
Toggle main menu visibility
Loading...
Searching...
No Matches
gc0308_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
* GC0308 register definitions (8-bit register addresses).
11
* Ported from esp32-camera's private_include/gc0308_regs.h (Apache-2.0),
12
* comments preserved as-is.
13
*/
14
#ifndef __GC0308_REGS_H__
15
#define __GC0308_REGS_H__
16
17
// System Control Registers
18
#define RESET_RELATED 0xfe
// Bit[7]: Software reset
19
// Bit[6:5]: NA
20
// Bit[4]: CISCTL_restart_n
21
// Bit[3:1]: NA
22
// Bit[0]: page select
23
// 0:page0
24
// 1:page1
25
26
// Page 0 Registers
27
28
// Exposure Control (Manual, when AEC disabled)
29
#define EXPOSURE_HIGH 0x03
// Exposure time high byte (bits 11:4)
30
#define EXPOSURE_LOW 0x04
// Exposure time low byte (bits 3:0 in upper nibble)
31
// Total exposure = (EXPOSURE_HIGH << 4) | (EXPOSURE_LOW >> 4)
32
// Range: 0-4095 (12-bit value)
33
34
// Windowing Registers
35
#define ROW_START_H 0x05
// Row start address high byte
36
#define ROW_START_L 0x06
// Row start address low byte
37
#define COL_START_H 0x07
// Column start address high byte
38
#define COL_START_L 0x08
// Column start address low byte
39
#define WIN_HEIGHT_H 0x09
// Window height high byte
40
#define WIN_HEIGHT_L 0x0a
// Window height low byte
41
#define WIN_WIDTH_H 0x0b
// Window width high byte
42
#define WIN_WIDTH_L 0x0c
// Window width low byte
43
44
// Sensor Control
45
#define CISCTL_MODE1 0x14
// Bit[1]: V_flip, Bit[0]: H_mirror
46
47
// AAAA_EN - Auto Algorithm Enable (AEC/AGC/AWB/ABB)
48
#define AAAA_EN 0x22
// Auto control enable register
49
// Per Linux kernel driver:
50
// Bit[0]: AEC enable (1=on, 0=off)
51
// Bit[1]: AWB enable (1=on, 0=off)
52
// Bit[2]: AGC enable (1=on, 0=off)
53
54
// Special Effects and Output Control
55
#define SPECIAL_EFFECT 0x23
// Special effect control
56
// Bit[1:0]: Effect mode
57
// 00: Normal
58
// 01: Negative
59
// 10: Grayscale/Color tint mode
60
61
// Output Format
62
#define OUTPUT_FMT 0x24
// Output format control
63
// Bit[3:0]: Output format selection
64
// 0010: YCbYCr (YUV422)
65
// 0110: RGB565
66
// others: see datasheet
67
68
// Analog Circuit Control
69
#define PCLK_DIV 0x28
// PCLK divider control (frequency division)
70
71
// Output Control
72
#define OUT_CTRL 0x2e
// Output control
73
// Bit[0]: Color bar enable
74
75
// Global Gain
76
#define GLOBAL_GAIN 0x50
// Global gain control (hardware: 0-63, 6-bit)
77
78
// Manual White Balance Gain (when AWB disabled)
79
#define AWB_R_GAIN 0x5a
// Red channel gain for manual WB
80
#define AWB_G_GAIN 0x5b
// Green channel gain for manual WB
81
#define AWB_B_GAIN 0x5c
// Blue channel gain for manual WB
82
83
// Edge Enhancement (INTPEE - Interpolation and Edge-Enhancement)
84
#define EDGE12_EFFECT 0x77
// Edge enhancement effect control
85
#define EDGE_POS_RATIO 0x78
// Edge position ratio
86
#define EDGE1_MINMAX 0x79
// Edge1 min/max control
87
88
// Saturation Control (Page 0)
89
#define SATURATION_Cb 0xb1
// Cb saturation gain (default: 0x40)
90
#define SATURATION_Cr 0xb2
// Cr saturation gain (default: 0x40)
91
92
// Contrast
93
#define CONTRAST 0xb3
// Contrast control (default: 0x40)
94
95
// AEC Registers - Automatic Exposure Control (Page 0)
96
#define AEC_MODE1 0xd0
// AEC mode control register 1
97
#define AEC_MODE2 0xd1
// AEC mode control register 2
98
#define AEC_MODE3 0xd2
// AEC mode control register 3
99
#define AEC_TARGET_Y 0xd3
// AEC target Y value / Expected luminance (default: 0x48)
100
101
// Subsample Window (Page 0 for coordinate reference)
102
#define SUB_COL_N 0xf7
// Subsample column start (units of 4 pixels)
103
#define SUB_ROW_N 0xf8
// Subsample row start (units of 4 pixels)
104
#define SUB_COL_N1 0xf9
// Subsample column end (units of 4 pixels)
105
#define SUB_ROW_N1 0xfa
// Subsample row end (units of 4 pixels)
106
107
// Page 1 Registers (access after setting 0xfe = 0x01)
108
109
// Subsample Control (Page 1)
110
#define SUBSAMPLE_EN 0x53
// Bit[7]: Subsample enable
111
#define SUBSAMPLE_MODE 0x54
// Subsample mode control
112
#define SUBSAMPLE_EN2 0x55
// Bit[0]: Subsample enable 2
113
#define SUBSAMPLE_Y0 0x56
// Y subsample config 0
114
#define SUBSAMPLE_Y1 0x57
// Y subsample config 1
115
#define SUBSAMPLE_UV0 0x58
// UV subsample config 0
116
#define SUBSAMPLE_UV1 0x59
// UV subsample config 1
117
121
122
// AAAA_EN (0x22) bit masks - Auto Algorithm Enable
123
#define AEC_ENABLE 0x01
// Bit 0: AEC enable
124
#define AWB_ENABLE 0x02
// Bit 1: AWB enable
125
#define AGC_ENABLE 0x04
// Bit 2: AGC enable
126
127
// CISCTL_MODE1 (0x14) bit masks
128
#define HMIRROR_MASK 0x01
// Bit 0: Horizontal mirror
129
#define VFLIP_MASK 0x02
// Bit 1: Vertical flip
130
131
// SPECIAL_EFFECT (0x23) bit masks
132
#define EFFECT_NORMAL 0x00
// Normal mode
133
#define EFFECT_NEGATIVE 0x01
// Negative/inverse
134
#define EFFECT_GRAYSCALE 0x02
// B&W or color tint mode
135
136
// OUT_CTRL (0x2e) bit masks
137
#define COLORBAR_ENABLE 0x01
// Bit 0: Color bar test pattern
138
139
#endif
// __GC0308_REGS_H__
中文文档
Generated by
doxygen
1.18.0