|
| 1 | +// Copyright 2022-2023 Espressif Systems (Shanghai) PTE LTD |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | + |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +//Preview Type:0:DVP Raw 10 bit// 1:Raw 8 bit// 2:YUV422// 3:RAW16 |
| 16 | +//Preview Type:4:RGB565// 5:Pixart SPI// 6:MIPI 10bit// 7:MIPI 12bit// 8: MTK SPI |
| 17 | +//port 0:MIPI// 1:Parallel// 2:MTK// 3:SPI// 4:TEST// 5: HISPI// 6 : Z2P/Z4P |
| 18 | +//I2C Mode :0:Normal 8Addr,8Data// 1:Samsung 8 Addr,8Data// 2:Micron 8 Addr,16Data |
| 19 | +//I2C Mode :3:Stmicro 16Addr,8Data//4:Micron2 16 Addr,16Data |
| 20 | +//Out Format :0:YCbYCr/RG_GB// 1:YCrYCb/GR_BG// 2:CbYCrY/GB_RG// 3:CrYCbY/BG_GR |
| 21 | +//MCLK Speed :0:6M//1:8M//2:10M//3:11.4M//4:12M//5:12.5M//6:13.5M//7:15M//8:18M//9:24M |
| 22 | +//pin :BIT0 pwdn// BIT1:reset |
| 23 | +//avdd 0:2.8V// 1:2.5V// 2:1.8V |
| 24 | +//dovdd 0:2.8V// 1:2.5V// 2:1.8V |
| 25 | +//dvdd 0:1.8V// 1:1.5V// 2:1.2V |
| 26 | + |
| 27 | +/* |
| 28 | +[database] |
| 29 | +DBName=Dothinkey |
| 30 | +
|
| 31 | +[vendor] |
| 32 | +VendorName=SmartSens |
| 33 | +
|
| 34 | +[sensor] |
| 35 | +SensorName=SC031GS |
| 36 | +width=200 |
| 37 | +height=200 |
| 38 | +port=1 |
| 39 | +type=1 |
| 40 | +pin=2 |
| 41 | +SlaveID=0x60 |
| 42 | +mode=3 |
| 43 | +FlagReg=0x36FF |
| 44 | +FlagMask=0xff |
| 45 | +FlagData=0x00 |
| 46 | +FlagReg1=0x36FF |
| 47 | +FlagMask1=0xff |
| 48 | +FlagData1=0x00 |
| 49 | +outformat=3 |
| 50 | +mclk=10 |
| 51 | +avdd=2.800000 |
| 52 | +dovdd=2.800000 |
| 53 | +dvdd=1.500000 |
| 54 | +
|
| 55 | +Ext0=0 |
| 56 | +Ext1=0 |
| 57 | +Ext2=0 |
| 58 | +AFVCC=2.513000 |
| 59 | +VPP=0.000000 |
| 60 | +*/ |
| 61 | +#include <stdint.h> |
| 62 | + |
| 63 | +#define SC031GS_OUTPUT_WINDOW_START_X_H_REG 0x3212 |
| 64 | +#define SC031GS_OUTPUT_WINDOW_START_X_L_REG 0x3213 |
| 65 | +#define SC031GS_OUTPUT_WINDOW_START_Y_H_REG 0x3210 |
| 66 | +#define SC031GS_OUTPUT_WINDOW_START_Y_L_REG 0x3211 |
| 67 | +#define SC031GS_OUTPUT_WINDOW_WIDTH_H_REG 0x3208 |
| 68 | +#define SC031GS_OUTPUT_WINDOW_WIDTH_L_REG 0x3209 |
| 69 | +#define SC031GS_OUTPUT_WINDOW_HIGH_H_REG 0x320a |
| 70 | +#define SC031GS_OUTPUT_WINDOW_HIGH_L_REG 0x320b |
| 71 | +#define SC031GS_LED_STROBE_ENABLE_REG 0x3361 // When the camera is in exposure, this PAD LEDSTROBE will be high to drive the external LED. |
| 72 | + |
| 73 | +#define REG_NULL 0xFFFF |
| 74 | +#define REG_DELAY 0X0000 |
| 75 | + |
| 76 | +struct sc031gs_regval { |
| 77 | + uint16_t addr; |
| 78 | + uint8_t val; |
| 79 | +}; |
| 80 | + |
| 81 | +// 200*200, xclk=10M, fps=120fps |
| 82 | +static const struct sc031gs_regval sc031gs_default_init_regs[] = { |
| 83 | + {0x0103, 0x01}, // soft reset. |
| 84 | + {REG_DELAY, 10}, // delay. |
| 85 | + {0x0100, 0x00}, |
| 86 | + {0x36e9, 0x80}, |
| 87 | + {0x36f9, 0x80}, |
| 88 | + {0x300f, 0x0f}, |
| 89 | + {0x3018, 0x1f}, |
| 90 | + {0x3019, 0xff}, |
| 91 | + {0x301c, 0xb4}, |
| 92 | + {0x301f, 0x7b}, |
| 93 | + {0x3028, 0x82}, |
| 94 | + {0x3200, 0x00}, |
| 95 | + {0x3201, 0xdc}, |
| 96 | + {0x3202, 0x00}, |
| 97 | + {0x3203, 0x98}, |
| 98 | + {0x3204, 0x01}, |
| 99 | + {0x3205, 0xb3}, |
| 100 | + {0x3206, 0x01}, |
| 101 | + {0x3207, 0x67}, |
| 102 | + {SC031GS_OUTPUT_WINDOW_WIDTH_H_REG, 0x00}, |
| 103 | + {SC031GS_OUTPUT_WINDOW_WIDTH_L_REG, 0xc8}, |
| 104 | + {SC031GS_OUTPUT_WINDOW_HIGH_H_REG, 0x00}, |
| 105 | + {SC031GS_OUTPUT_WINDOW_HIGH_L_REG, 0xc8}, |
| 106 | + {0x320c, 0x03}, |
| 107 | + {0x320d, 0x6b}, |
| 108 | + {0x320e, 0x01}, //default 120fps: {0x320e, 0x01},{0x320f, 0x40}, 58fps: {0x320e, 0x02},{0x320f, 0xab}; 30fps: {0x320e, 0x05}, {0x320f, 0x34} |
| 109 | + {0x320f, 0x40}, |
| 110 | + {SC031GS_OUTPUT_WINDOW_START_Y_H_REG, 0x00}, |
| 111 | + {SC031GS_OUTPUT_WINDOW_START_Y_L_REG, 0x08}, |
| 112 | + {SC031GS_OUTPUT_WINDOW_START_X_H_REG, 0x00}, |
| 113 | + {SC031GS_OUTPUT_WINDOW_START_X_L_REG, 0x04}, |
| 114 | + {0x3220, 0x10}, |
| 115 | + {0x3223, 0x50}, |
| 116 | + {0x3250, 0xf0}, |
| 117 | + {0x3251, 0x02}, |
| 118 | + {0x3252, 0x01}, |
| 119 | + {0x3253, 0x3b}, |
| 120 | + {0x3254, 0x02}, |
| 121 | + {0x3255, 0x07}, |
| 122 | + {0x3304, 0x48}, |
| 123 | + {0x3306, 0x38}, |
| 124 | + {0x3309, 0x50}, |
| 125 | + {0x330b, 0xe0}, |
| 126 | + {0x330c, 0x18}, |
| 127 | + {0x330f, 0x20}, |
| 128 | + {0x3310, 0x10}, |
| 129 | + {0x3314, 0x70}, |
| 130 | + {0x3315, 0x38}, |
| 131 | + {0x3316, 0x68}, |
| 132 | + {0x3317, 0x0d}, |
| 133 | + {0x3329, 0x5c}, |
| 134 | + {0x332d, 0x5c}, |
| 135 | + {0x332f, 0x60}, |
| 136 | + {0x3335, 0x64}, |
| 137 | + {0x3344, 0x64}, |
| 138 | + {0x335b, 0x80}, |
| 139 | + {0x335f, 0x80}, |
| 140 | + {0x3366, 0x06}, |
| 141 | + {0x3385, 0x41}, |
| 142 | + {0x3387, 0x49}, |
| 143 | + {0x3389, 0x01}, |
| 144 | + {0x33b1, 0x03}, |
| 145 | + {0x33b2, 0x06}, |
| 146 | + {0x3621, 0xa4}, |
| 147 | + {0x3622, 0x05}, |
| 148 | + {0x3624, 0x47}, |
| 149 | + {0x3631, 0x48}, |
| 150 | + {0x3633, 0x52}, |
| 151 | + {0x3635, 0x18}, |
| 152 | + {0x3636, 0x25}, |
| 153 | + {0x3637, 0x89}, |
| 154 | + {0x3638, 0x0f}, |
| 155 | + {0x3639, 0x08}, |
| 156 | + {0x363a, 0x00}, |
| 157 | + {0x363b, 0x48}, |
| 158 | + {0x363c, 0x06}, |
| 159 | + {0x363e, 0xf8}, |
| 160 | + {0x3640, 0x00}, |
| 161 | + {0x3641, 0x01}, |
| 162 | + {0x36ea, 0x39}, |
| 163 | + {0x36eb, 0x1e}, |
| 164 | + {0x36ec, 0x0e}, |
| 165 | + {0x36ed, 0x23}, |
| 166 | + {0x36fa, 0x39}, |
| 167 | + {0x36fb, 0x10}, |
| 168 | + {0x36fc, 0x01}, |
| 169 | + {0x36fd, 0x03}, |
| 170 | + {0x3908, 0x91}, |
| 171 | + {0x3d08, 0x01}, |
| 172 | + {0x3d04, 0x04}, |
| 173 | + {0x3e01, 0x13}, |
| 174 | + {0x3e02, 0xa0}, |
| 175 | + {0x3e06, 0x0c}, |
| 176 | + {0x3f04, 0x03}, |
| 177 | + {0x3f05, 0x4b}, |
| 178 | + {0x4500, 0x59}, |
| 179 | + {0x4501, 0xc4}, |
| 180 | + {0x4809, 0x01}, |
| 181 | + {0x4837, 0x39}, |
| 182 | + {0x5011, 0x00}, |
| 183 | + {0x36e9, 0x04}, |
| 184 | + {0x36f9, 0x04}, |
| 185 | + {0x0100, 0x01}, |
| 186 | + |
| 187 | + //delay 10ms |
| 188 | + {REG_DELAY, 0X0a}, |
| 189 | + {0x4418, 0x08}, |
| 190 | + {0x4419, 0x80}, |
| 191 | + {0x363d, 0x10}, |
| 192 | + {0x3630, 0x48}, |
| 193 | + |
| 194 | + // [gain<4] |
| 195 | + {0x3317, 0x0d}, |
| 196 | + {0x3314, 0x70}, |
| 197 | + |
| 198 | + // [gain>=4] |
| 199 | + {0x3314, 0x68}, |
| 200 | + {0x3317, 0x0e}, |
| 201 | + {REG_NULL, 0x00}, |
| 202 | +}; |
0 commit comments