1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef M5MOLS_REG_H
17#define M5MOLS_REG_H
18
19#define M5MOLS_I2C_MAX_SIZE 4
20#define M5MOLS_BYTE_READ 0x01
21#define M5MOLS_BYTE_WRITE 0x02
22
23#define I2C_CATEGORY(__cat) ((__cat >> 16) & 0xff)
24#define I2C_COMMAND(__comm) ((__comm >> 8) & 0xff)
25#define I2C_SIZE(__reg_s) ((__reg_s) & 0xff)
26#define I2C_REG(__cat, __cmd, __reg_s) ((__cat << 16) | (__cmd << 8) | __reg_s)
27
28
29
30
31
32
33#define CAT_SYSTEM 0x00
34#define CAT_PARAM 0x01
35#define CAT_MONITOR 0x02
36#define CAT_AE 0x03
37#define CAT_WB 0x06
38#define CAT_EXIF 0x07
39#define CAT_FD 0x09
40#define CAT_LENS 0x0a
41#define CAT_CAPT_PARM 0x0b
42#define CAT_CAPT_CTRL 0x0c
43#define CAT_FLASH 0x0f
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58#define SYSTEM_VER_CUSTOMER I2C_REG(CAT_SYSTEM, 0x00, 1)
59#define SYSTEM_VER_PROJECT I2C_REG(CAT_SYSTEM, 0x01, 1)
60#define SYSTEM_VER_FIRMWARE I2C_REG(CAT_SYSTEM, 0x02, 2)
61#define SYSTEM_VER_HARDWARE I2C_REG(CAT_SYSTEM, 0x04, 2)
62#define SYSTEM_VER_PARAMETER I2C_REG(CAT_SYSTEM, 0x06, 2)
63#define SYSTEM_VER_AWB I2C_REG(CAT_SYSTEM, 0x08, 2)
64
65#define SYSTEM_SYSMODE I2C_REG(CAT_SYSTEM, 0x0b, 1)
66#define REG_SYSINIT 0x00
67#define REG_PARAMETER 0x01
68#define REG_MONITOR 0x02
69#define REG_CAPTURE 0x03
70
71#define SYSTEM_CMD(__cmd) I2C_REG(CAT_SYSTEM, cmd, 1)
72#define SYSTEM_VER_STRING I2C_REG(CAT_SYSTEM, 0x0a, 1)
73#define REG_SAMSUNG_ELECTRO "SE"
74#define REG_SAMSUNG_OPTICS "OP"
75#define REG_SAMSUNG_TECHWIN "TB"
76
77#define SYSTEM_STATUS I2C_REG(CAT_SYSTEM, 0x0c, 1)
78
79
80#define SYSTEM_INT_FACTOR I2C_REG(CAT_SYSTEM, 0x10, 1)
81
82#define SYSTEM_INT_ENABLE I2C_REG(CAT_SYSTEM, 0x11, 1)
83#define REG_INT_MODE (1 << 0)
84#define REG_INT_AF (1 << 1)
85#define REG_INT_ZOOM (1 << 2)
86#define REG_INT_CAPTURE (1 << 3)
87#define REG_INT_FRAMESYNC (1 << 4)
88#define REG_INT_FD (1 << 5)
89#define REG_INT_LENS_INIT (1 << 6)
90#define REG_INT_SOUND (1 << 7)
91#define REG_INT_MASK 0x0f
92
93
94
95
96
97
98
99
100
101
102#define PARM_MON_SIZE I2C_REG(CAT_PARAM, 0x01, 1)
103
104
105#define PARM_MON_FPS I2C_REG(CAT_PARAM, 0x02, 1)
106#define REG_FPS_30 0x02
107
108
109#define PARM_INTERFACE I2C_REG(CAT_PARAM, 0x00, 1)
110#define REG_INTERFACE_MIPI 0x02
111
112
113#define PARM_EFFECT I2C_REG(CAT_PARAM, 0x0b, 1)
114#define REG_EFFECT_OFF 0x00
115#define REG_EFFECT_NEGA 0x01
116#define REG_EFFECT_EMBOSS 0x06
117#define REG_EFFECT_OUTLINE 0x07
118#define REG_EFFECT_WATERCOLOR 0x08
119
120
121
122
123
124
125
126
127
128
129
130
131
132#define MON_ZOOM I2C_REG(CAT_MONITOR, 0x01, 1)
133
134
135#define MON_CFIXR I2C_REG(CAT_MONITOR, 0x0a, 1)
136
137#define MON_CFIXB I2C_REG(CAT_MONITOR, 0x09, 1)
138#define REG_CFIXB_SEPIA 0xd8
139#define REG_CFIXR_SEPIA 0x18
140
141#define MON_EFFECT I2C_REG(CAT_MONITOR, 0x0b, 1)
142#define REG_COLOR_EFFECT_OFF 0x00
143#define REG_COLOR_EFFECT_ON 0x01
144
145
146#define MON_CHROMA_EN I2C_REG(CAT_MONITOR, 0x10, 1)
147
148#define MON_CHROMA_LVL I2C_REG(CAT_MONITOR, 0x0f, 1)
149#define REG_CHROMA_OFF 0x00
150#define REG_CHROMA_ON 0x01
151
152
153#define MON_EDGE_EN I2C_REG(CAT_MONITOR, 0x12, 1)
154
155#define MON_EDGE_LVL I2C_REG(CAT_MONITOR, 0x11, 1)
156#define REG_EDGE_OFF 0x00
157#define REG_EDGE_ON 0x01
158
159
160#define MON_TONE_CTL I2C_REG(CAT_MONITOR, 0x25, 1)
161
162
163
164
165
166
167
168
169
170
171
172
173
174#define AE_LOCK I2C_REG(CAT_AE, 0x00, 1)
175#define REG_AE_UNLOCK 0x00
176#define REG_AE_LOCK 0x01
177
178
179#define AE_MODE I2C_REG(CAT_AE, 0x01, 1)
180#define REG_AE_OFF 0x00
181#define REG_AE_ALL 0x01
182#define REG_AE_CENTER 0x03
183#define REG_AE_SPOT 0x06
184
185#define AE_ISO I2C_REG(CAT_AE, 0x05, 1)
186#define REG_ISO_AUTO 0x00
187#define REG_ISO_50 0x01
188#define REG_ISO_100 0x02
189#define REG_ISO_200 0x03
190#define REG_ISO_400 0x04
191#define REG_ISO_800 0x05
192
193
194#define AE_EV_PRESET_MONITOR I2C_REG(CAT_AE, 0x0a, 1)
195
196#define AE_EV_PRESET_CAPTURE I2C_REG(CAT_AE, 0x0b, 1)
197#define REG_SCENE_NORMAL 0x00
198#define REG_SCENE_PORTRAIT 0x01
199#define REG_SCENE_LANDSCAPE 0x02
200#define REG_SCENE_SPORTS 0x03
201#define REG_SCENE_PARTY_INDOOR 0x04
202#define REG_SCENE_BEACH_SNOW 0x05
203#define REG_SCENE_SUNSET 0x06
204#define REG_SCENE_DAWN_DUSK 0x07
205#define REG_SCENE_FALL 0x08
206#define REG_SCENE_NIGHT 0x09
207#define REG_SCENE_AGAINST_LIGHT 0x0a
208#define REG_SCENE_FIRE 0x0b
209#define REG_SCENE_TEXT 0x0c
210#define REG_SCENE_CANDLE 0x0d
211
212
213#define AE_MAN_GAIN_MON I2C_REG(CAT_AE, 0x12, 2)
214
215#define AE_MAX_GAIN_MON I2C_REG(CAT_AE, 0x1a, 2)
216
217#define AE_MAN_GAIN_CAP I2C_REG(CAT_AE, 0x26, 2)
218
219#define AE_INDEX I2C_REG(CAT_AE, 0x38, 1)
220#define REG_AE_INDEX_20_NEG 0x00
221#define REG_AE_INDEX_15_NEG 0x01
222#define REG_AE_INDEX_10_NEG 0x02
223#define REG_AE_INDEX_05_NEG 0x03
224#define REG_AE_INDEX_00 0x04
225#define REG_AE_INDEX_05_POS 0x05
226#define REG_AE_INDEX_10_POS 0x06
227#define REG_AE_INDEX_15_POS 0x07
228#define REG_AE_INDEX_20_POS 0x08
229
230
231
232
233
234
235#define AWB_LOCK I2C_REG(CAT_WB, 0x00, 1)
236#define REG_AWB_UNLOCK 0x00
237#define REG_AWB_LOCK 0x01
238
239#define AWB_MODE I2C_REG(CAT_WB, 0x02, 1)
240#define REG_AWB_AUTO 0x01
241#define REG_AWB_PRESET 0x02
242
243
244#define AWB_MANUAL I2C_REG(CAT_WB, 0x03, 1)
245#define REG_AWB_INCANDESCENT 0x01
246#define REG_AWB_FLUORESCENT_1 0x02
247#define REG_AWB_FLUORESCENT_2 0x03
248#define REG_AWB_DAYLIGHT 0x04
249#define REG_AWB_CLOUDY 0x05
250#define REG_AWB_SHADE 0x06
251#define REG_AWB_HORIZON 0x07
252#define REG_AWB_LEDLIGHT 0x09
253
254
255
256
257#define EXIF_INFO_EXPTIME_NU I2C_REG(CAT_EXIF, 0x00, 4)
258#define EXIF_INFO_EXPTIME_DE I2C_REG(CAT_EXIF, 0x04, 4)
259#define EXIF_INFO_TV_NU I2C_REG(CAT_EXIF, 0x08, 4)
260#define EXIF_INFO_TV_DE I2C_REG(CAT_EXIF, 0x0c, 4)
261#define EXIF_INFO_AV_NU I2C_REG(CAT_EXIF, 0x10, 4)
262#define EXIF_INFO_AV_DE I2C_REG(CAT_EXIF, 0x14, 4)
263#define EXIF_INFO_BV_NU I2C_REG(CAT_EXIF, 0x18, 4)
264#define EXIF_INFO_BV_DE I2C_REG(CAT_EXIF, 0x1c, 4)
265#define EXIF_INFO_EBV_NU I2C_REG(CAT_EXIF, 0x20, 4)
266#define EXIF_INFO_EBV_DE I2C_REG(CAT_EXIF, 0x24, 4)
267#define EXIF_INFO_ISO I2C_REG(CAT_EXIF, 0x28, 2)
268#define EXIF_INFO_FLASH I2C_REG(CAT_EXIF, 0x2a, 2)
269#define EXIF_INFO_SDR I2C_REG(CAT_EXIF, 0x2c, 2)
270#define EXIF_INFO_QVAL I2C_REG(CAT_EXIF, 0x2e, 2)
271
272
273
274
275#define FD_CTL I2C_REG(CAT_FD, 0x00, 1)
276#define BIT_FD_EN 0
277#define BIT_FD_DRAW_FACE_FRAME 4
278#define BIT_FD_DRAW_SMILE_LVL 6
279#define REG_FD(shift) (1 << shift)
280#define REG_FD_OFF 0x0
281
282
283
284
285#define AF_MODE I2C_REG(CAT_LENS, 0x01, 1)
286#define REG_AF_NORMAL 0x00
287#define REG_AF_MACRO 0x01
288#define REG_AF_POWEROFF 0x07
289
290#define AF_EXECUTE I2C_REG(CAT_LENS, 0x02, 1)
291#define REG_AF_STOP 0x00
292#define REG_AF_EXE_AUTO 0x01
293#define REG_AF_EXE_CAF 0x02
294
295#define AF_STATUS I2C_REG(CAT_LENS, 0x03, 1)
296#define REG_AF_FAIL 0x00
297#define REG_AF_SUCCESS 0x02
298#define REG_AF_IDLE 0x04
299#define REG_AF_BUSY 0x05
300
301#define AF_VERSION I2C_REG(CAT_LENS, 0x0a, 1)
302
303
304
305
306#define CAPP_YUVOUT_MAIN I2C_REG(CAT_CAPT_PARM, 0x00, 1)
307#define REG_YUV422 0x00
308#define REG_BAYER10 0x05
309#define REG_BAYER8 0x06
310#define REG_JPEG 0x10
311
312#define CAPP_MAIN_IMAGE_SIZE I2C_REG(CAT_CAPT_PARM, 0x01, 1)
313#define CAPP_JPEG_SIZE_MAX I2C_REG(CAT_CAPT_PARM, 0x0f, 4)
314#define CAPP_JPEG_RATIO I2C_REG(CAT_CAPT_PARM, 0x17, 1)
315
316#define CAPP_MCC_MODE I2C_REG(CAT_CAPT_PARM, 0x1d, 1)
317#define REG_MCC_OFF 0x00
318#define REG_MCC_NORMAL 0x01
319
320#define CAPP_WDR_EN I2C_REG(CAT_CAPT_PARM, 0x2c, 1)
321#define REG_WDR_OFF 0x00
322#define REG_WDR_ON 0x01
323#define REG_WDR_AUTO 0x02
324
325#define CAPP_LIGHT_CTRL I2C_REG(CAT_CAPT_PARM, 0x40, 1)
326#define REG_LIGHT_OFF 0x00
327#define REG_LIGHT_ON 0x01
328#define REG_LIGHT_AUTO 0x02
329
330#define CAPP_FLASH_CTRL I2C_REG(CAT_CAPT_PARM, 0x41, 1)
331#define REG_FLASH_OFF 0x00
332#define REG_FLASH_ON 0x01
333#define REG_FLASH_AUTO 0x02
334
335
336
337
338#define CAPC_MODE I2C_REG(CAT_CAPT_CTRL, 0x00, 1)
339#define REG_CAP_NONE 0x00
340#define REG_CAP_ANTI_SHAKE 0x02
341
342
343#define CAPC_SEL_FRAME I2C_REG(CAT_CAPT_CTRL, 0x06, 1)
344
345#define CAPC_START I2C_REG(CAT_CAPT_CTRL, 0x09, 1)
346#define REG_CAP_START_MAIN 0x01
347#define REG_CAP_START_THUMB 0x03
348
349#define CAPC_IMAGE_SIZE I2C_REG(CAT_CAPT_CTRL, 0x0d, 4)
350#define CAPC_THUMB_SIZE I2C_REG(CAT_CAPT_CTRL, 0x11, 4)
351
352
353
354
355
356
357
358
359#define FLASH_CAM_START I2C_REG(CAT_FLASH, 0x12, 1)
360#define REG_START_ARM_BOOT 0x01
361#define REG_IN_FLASH_MODE 0x00
362
363#endif
364