SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.

Dependencies:   TSI USBDevice mbed-dev

Fork of SmartWheels by haofan Zheng

Committer:
hazheng
Date:
Tue Mar 14 22:23:15 2017 +0000
Revision:
36:7e747e19f660
Parent:
Hardwares/OV7725RegBuf.cpp@32:5badeff825dc
Removed trash codes. Made it easier to switch different camera.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hazheng 12:256c303ad09d 1 #include "OV7725RegBuf.h"
hazheng 12:256c303ad09d 2
hazheng 25:6f63053cee81 3 #include "PinAssignment.h"
hazheng 25:6f63053cee81 4 #include "Core.h"
hazheng 25:6f63053cee81 5 #include "SWUSBServer.h"
hazheng 25:6f63053cee81 6
hazheng 25:6f63053cee81 7 OV7725RegBuf::OV7725RegBuf(SW::Core & core) :
hazheng 25:6f63053cee81 8 m_data(NULL),
hazheng 25:6f63053cee81 9 m_core(core),
hazheng 25:6f63053cee81 10 m_sccbCtrl(I2C(PIN_ORB_SDA, PIN_ORB_SCL))
hazheng 12:256c303ad09d 11 {
hazheng 12:256c303ad09d 12
hazheng 12:256c303ad09d 13 }
hazheng 12:256c303ad09d 14
hazheng 12:256c303ad09d 15 OV7725RegBuf::~OV7725RegBuf()
hazheng 12:256c303ad09d 16 {
hazheng 25:6f63053cee81 17 if(m_data)
hazheng 25:6f63053cee81 18 {
hazheng 25:6f63053cee81 19 delete [] m_data;
hazheng 25:6f63053cee81 20 }
hazheng 12:256c303ad09d 21 }
hazheng 12:256c303ad09d 22
hazheng 12:256c303ad09d 23 uint8_t * OV7725RegBuf::GetData()
hazheng 12:256c303ad09d 24 {
hazheng 25:6f63053cee81 25 if(!m_data)
hazheng 25:6f63053cee81 26 m_data = new uint8_t[OV7725_LAST_ADDR + 1];
hazheng 12:256c303ad09d 27 return m_data;
hazheng 12:256c303ad09d 28 }
hazheng 12:256c303ad09d 29
hazheng 13:7dcb1642ef99 30 bool OV7725RegBuf::IsAddressReserved(const uint8_t addr)
hazheng 12:256c303ad09d 31 {
hazheng 12:256c303ad09d 32 switch(addr)
hazheng 12:256c303ad09d 33 {
hazheng 12:256c303ad09d 34 case OV7725_RESV_01:
hazheng 12:256c303ad09d 35 case OV7725_RESV_02:
hazheng 12:256c303ad09d 36 case OV7725_RESV_03:
hazheng 12:256c303ad09d 37 case OV7725_RESV_04:
hazheng 12:256c303ad09d 38 case OV7725_RESV_05:
hazheng 12:256c303ad09d 39 case OV7725_RESV_06:
hazheng 12:256c303ad09d 40 case OV7725_RESV_07:
hazheng 12:256c303ad09d 41 case OV7725_RESV_08:
hazheng 12:256c303ad09d 42 case OV7725_RESV_09:
hazheng 12:256c303ad09d 43 case OV7725_RESV_10:
hazheng 12:256c303ad09d 44 case OV7725_RESV_11:
hazheng 12:256c303ad09d 45 case OV7725_RESV_12:
hazheng 12:256c303ad09d 46 case OV7725_RESV_13:
hazheng 12:256c303ad09d 47 case OV7725_RESV_14:
hazheng 12:256c303ad09d 48 case OV7725_RESV_15:
hazheng 12:256c303ad09d 49 case OV7725_RESV_16:
hazheng 12:256c303ad09d 50 return true;
hazheng 12:256c303ad09d 51 //break;
hazheng 12:256c303ad09d 52 default:
hazheng 12:256c303ad09d 53 return false;
hazheng 12:256c303ad09d 54 //break;
hazheng 12:256c303ad09d 55 }
hazheng 25:6f63053cee81 56 }
hazheng 25:6f63053cee81 57
hazheng 25:6f63053cee81 58 //Blocking method. Do not use during the running state!!
hazheng 25:6f63053cee81 59 void OV7725RegBuf::SCCBWrite(uint8_t RegAddr, uint8_t Data)
hazheng 25:6f63053cee81 60 {
hazheng 25:6f63053cee81 61 m_sccbCtrl.lock();
hazheng 25:6f63053cee81 62 m_sccbCtrl.frequency(OV7725_I2CFREQ);
hazheng 25:6f63053cee81 63
hazheng 25:6f63053cee81 64 m_sccbCtrl.start();
hazheng 25:6f63053cee81 65
hazheng 25:6f63053cee81 66 m_sccbCtrl.write(OV7725_WRITE);
hazheng 25:6f63053cee81 67 wait_us(OV7725_WRITEWAIT);
hazheng 25:6f63053cee81 68 m_sccbCtrl.write(RegAddr);
hazheng 25:6f63053cee81 69 wait_us(OV7725_WRITEWAIT);
hazheng 25:6f63053cee81 70 m_sccbCtrl.write(Data);
hazheng 25:6f63053cee81 71 wait_us(OV7725_WRITEWAIT);
hazheng 25:6f63053cee81 72
hazheng 25:6f63053cee81 73 m_sccbCtrl.stop();
hazheng 25:6f63053cee81 74
hazheng 25:6f63053cee81 75 m_sccbCtrl.unlock();
hazheng 32:5badeff825dc 76
hazheng 32:5badeff825dc 77 wait_us(2);
hazheng 25:6f63053cee81 78 }
hazheng 25:6f63053cee81 79
hazheng 25:6f63053cee81 80 //Blocking method. Do not use during the running state!!
hazheng 25:6f63053cee81 81 uint8_t OV7725RegBuf::SCCBRead(const uint8_t RegAddr)
hazheng 25:6f63053cee81 82 {
hazheng 25:6f63053cee81 83 m_sccbCtrl.lock();
hazheng 25:6f63053cee81 84 m_sccbCtrl.frequency(OV7725_I2CFREQ);
hazheng 25:6f63053cee81 85
hazheng 25:6f63053cee81 86 m_sccbCtrl.start();
hazheng 25:6f63053cee81 87
hazheng 25:6f63053cee81 88 m_sccbCtrl.write(OV7725_WRITE);
hazheng 25:6f63053cee81 89 wait_us(OV7725_WRITEWAIT);
hazheng 25:6f63053cee81 90 m_sccbCtrl.write(RegAddr);
hazheng 25:6f63053cee81 91 m_sccbCtrl.stop();
hazheng 25:6f63053cee81 92 wait_us(OV7725_WRITEWAIT);
hazheng 25:6f63053cee81 93
hazheng 25:6f63053cee81 94 m_sccbCtrl.start();
hazheng 25:6f63053cee81 95 m_sccbCtrl.write(OV7725_READ);
hazheng 25:6f63053cee81 96 wait_us(OV7725_WRITEWAIT);
hazheng 25:6f63053cee81 97 char readValue = m_sccbCtrl.read(OV7725_NOACK);
hazheng 25:6f63053cee81 98
hazheng 25:6f63053cee81 99 m_sccbCtrl.stop();
hazheng 25:6f63053cee81 100
hazheng 25:6f63053cee81 101 m_sccbCtrl.unlock();
hazheng 25:6f63053cee81 102
hazheng 32:5badeff825dc 103 wait_us(2);
hazheng 32:5badeff825dc 104
hazheng 25:6f63053cee81 105 return readValue;
hazheng 25:6f63053cee81 106 }
hazheng 25:6f63053cee81 107
hazheng 25:6f63053cee81 108
hazheng 25:6f63053cee81 109 //Blocking method. Do not use during the running state!!
hazheng 25:6f63053cee81 110 void OV7725RegBuf::ReadRegisters()
hazheng 25:6f63053cee81 111 {
hazheng 25:6f63053cee81 112 for(int i = 0; i < OV7725_LAST_ADDR + 1; ++i)
hazheng 25:6f63053cee81 113 {
hazheng 25:6f63053cee81 114 if(!OV7725RegBuf::IsAddressReserved(i))
hazheng 25:6f63053cee81 115 {
hazheng 25:6f63053cee81 116 char buf[10];
hazheng 25:6f63053cee81 117 sprintf(buf, "%#x-%#x", i, SCCBRead(i));
hazheng 25:6f63053cee81 118 m_core.GetUSBServer().PushUnreliableMsg('D', buf);
hazheng 25:6f63053cee81 119
hazheng 25:6f63053cee81 120 wait(0.1);
hazheng 25:6f63053cee81 121 }
hazheng 25:6f63053cee81 122 }
hazheng 25:6f63053cee81 123 }
hazheng 25:6f63053cee81 124
hazheng 25:6f63053cee81 125 #ifdef WRITE_DEFAULT_REG_ON
hazheng 25:6f63053cee81 126 void OV7725RegBuf::WriteDefaultRegisters()
hazheng 25:6f63053cee81 127 {
hazheng 25:6f63053cee81 128 SCCBWrite(0x0, 0x00);
hazheng 25:6f63053cee81 129 SCCBWrite(0x1, 0x80);
hazheng 25:6f63053cee81 130 SCCBWrite(0x2, 0x80);
hazheng 25:6f63053cee81 131 SCCBWrite(0x3, 0x00);
hazheng 25:6f63053cee81 132 SCCBWrite(0x5, 0x00);
hazheng 25:6f63053cee81 133 SCCBWrite(0x6, 0x00);
hazheng 25:6f63053cee81 134 SCCBWrite(0x7, 0x00);
hazheng 25:6f63053cee81 135 SCCBWrite(0x8, 0x00);
hazheng 25:6f63053cee81 136 SCCBWrite(0x9, 0x01);
hazheng 25:6f63053cee81 137 //SCCBWrite(0xa, 0x77); //Read-Only
hazheng 25:6f63053cee81 138 //SCCBWrite(0xb, 0x21); //Read-Only
hazheng 25:6f63053cee81 139 SCCBWrite(0xc, 0x10);
hazheng 25:6f63053cee81 140 SCCBWrite(0xd, 0x41);
hazheng 25:6f63053cee81 141 SCCBWrite(0xe, 0x01);
hazheng 25:6f63053cee81 142 SCCBWrite(0xf, 0x43);
hazheng 25:6f63053cee81 143 SCCBWrite(0x10, 0x40);
hazheng 25:6f63053cee81 144 SCCBWrite(0x11, 0x80);
hazheng 25:6f63053cee81 145 SCCBWrite(0x12, 0x00);
hazheng 25:6f63053cee81 146 SCCBWrite(0x13, 0x8f);
hazheng 25:6f63053cee81 147 SCCBWrite(0x14, 0x4A);
hazheng 25:6f63053cee81 148 SCCBWrite(0x15, 0x00);
hazheng 25:6f63053cee81 149 SCCBWrite(0x16, 0x00);
hazheng 25:6f63053cee81 150 SCCBWrite(0x17, 0x3F);
hazheng 25:6f63053cee81 151 SCCBWrite(0x18, 0x50);
hazheng 25:6f63053cee81 152 SCCBWrite(0x19, 0x03);
hazheng 25:6f63053cee81 153 SCCBWrite(0x1a, 0x78);
hazheng 25:6f63053cee81 154 SCCBWrite(0x1b, 0x40);
hazheng 25:6f63053cee81 155 //SCCBWrite(0x1c, 0x7f); //Read-Only
hazheng 25:6f63053cee81 156 //SCCBWrite(0x1d, 0xa2); //Read-Only
hazheng 25:6f63053cee81 157 SCCBWrite(0x1f, 0x00);
hazheng 25:6f63053cee81 158 SCCBWrite(0x20, 0x10);
hazheng 25:6f63053cee81 159 SCCBWrite(0x22, 0xff);
hazheng 25:6f63053cee81 160 SCCBWrite(0x23, 0x01);
hazheng 25:6f63053cee81 161 SCCBWrite(0x24, 0x75);
hazheng 25:6f63053cee81 162 SCCBWrite(0x25, 0x63);
hazheng 25:6f63053cee81 163 SCCBWrite(0x26, 0xD4);
hazheng 25:6f63053cee81 164 SCCBWrite(0x28, 0x00);
hazheng 25:6f63053cee81 165 SCCBWrite(0x29, 0x50);
hazheng 25:6f63053cee81 166 SCCBWrite(0x2a, 0x00);
hazheng 25:6f63053cee81 167 SCCBWrite(0x2b, 0x00);
hazheng 25:6f63053cee81 168 SCCBWrite(0x2c, 0x78);
hazheng 25:6f63053cee81 169 SCCBWrite(0x2d, 0x00);
hazheng 25:6f63053cee81 170 SCCBWrite(0x2e, 0x00);
hazheng 25:6f63053cee81 171 SCCBWrite(0x2f, 0x00);
hazheng 25:6f63053cee81 172 SCCBWrite(0x30, 0x80);
hazheng 25:6f63053cee81 173 SCCBWrite(0x31, 0x60);
hazheng 25:6f63053cee81 174 SCCBWrite(0x32, 0x00);
hazheng 25:6f63053cee81 175 SCCBWrite(0x33, 0x00);
hazheng 25:6f63053cee81 176 SCCBWrite(0x34, 0x00);
hazheng 25:6f63053cee81 177 SCCBWrite(0x35, 0x80);
hazheng 25:6f63053cee81 178 SCCBWrite(0x36, 0x80);
hazheng 25:6f63053cee81 179 SCCBWrite(0x37, 0x80);
hazheng 25:6f63053cee81 180 SCCBWrite(0x38, 0x80);
hazheng 25:6f63053cee81 181 SCCBWrite(0x39, 0x80);
hazheng 25:6f63053cee81 182 SCCBWrite(0x3a, 0x80);
hazheng 25:6f63053cee81 183 SCCBWrite(0x3b, 0x80);
hazheng 25:6f63053cee81 184 SCCBWrite(0x3c, 0x80);
hazheng 25:6f63053cee81 185 SCCBWrite(0x3d, 0x80);
hazheng 25:6f63053cee81 186 SCCBWrite(0x3e, 0xe2);
hazheng 25:6f63053cee81 187 SCCBWrite(0x3f, 0x1f);
hazheng 25:6f63053cee81 188 SCCBWrite(0x40, 0xC0);
hazheng 25:6f63053cee81 189 SCCBWrite(0x41, 0x08);
hazheng 25:6f63053cee81 190 SCCBWrite(0x42, 0x80);
hazheng 25:6f63053cee81 191 SCCBWrite(0x43, 0x80);
hazheng 25:6f63053cee81 192 SCCBWrite(0x44, 0x80);
hazheng 25:6f63053cee81 193 SCCBWrite(0x45, 0x80);
hazheng 25:6f63053cee81 194 SCCBWrite(0x46, 0x00);
hazheng 25:6f63053cee81 195 SCCBWrite(0x47, 0x00);
hazheng 25:6f63053cee81 196 SCCBWrite(0x48, 0x00);
hazheng 25:6f63053cee81 197 SCCBWrite(0x49, 0x50);
hazheng 25:6f63053cee81 198 SCCBWrite(0x4a, 0x30);
hazheng 25:6f63053cee81 199 SCCBWrite(0x4b, 0x50);
hazheng 25:6f63053cee81 200 SCCBWrite(0x4c, 0x50);
hazheng 25:6f63053cee81 201 SCCBWrite(0x4d, 0x00);
hazheng 25:6f63053cee81 202 SCCBWrite(0x4e, 0xef);
hazheng 25:6f63053cee81 203 SCCBWrite(0x4f, 0x10);
hazheng 25:6f63053cee81 204 SCCBWrite(0x50, 0x60);
hazheng 25:6f63053cee81 205 SCCBWrite(0x51, 0x00);
hazheng 25:6f63053cee81 206 SCCBWrite(0x52, 0x00);
hazheng 25:6f63053cee81 207 SCCBWrite(0x53, 0x24);
hazheng 25:6f63053cee81 208 SCCBWrite(0x54, 0x7a);
hazheng 25:6f63053cee81 209 SCCBWrite(0x55, 0xfc);
hazheng 25:6f63053cee81 210 SCCBWrite(0x60, 0x80);
hazheng 25:6f63053cee81 211 SCCBWrite(0x61, 0x80);
hazheng 25:6f63053cee81 212 SCCBWrite(0x62, 0xff);
hazheng 25:6f63053cee81 213 SCCBWrite(0x63, 0xf0);
hazheng 25:6f63053cee81 214 SCCBWrite(0x64, 0x1f);
hazheng 25:6f63053cee81 215 SCCBWrite(0x65, 0x00);
hazheng 25:6f63053cee81 216 SCCBWrite(0x66, 0x10);
hazheng 25:6f63053cee81 217 SCCBWrite(0x67, 0x00);
hazheng 25:6f63053cee81 218 SCCBWrite(0x68, 0x00);
hazheng 25:6f63053cee81 219 SCCBWrite(0x69, 0x5c);
hazheng 25:6f63053cee81 220 SCCBWrite(0x6a, 0x11);
hazheng 25:6f63053cee81 221 SCCBWrite(0x6b, 0xa2);
hazheng 25:6f63053cee81 222 SCCBWrite(0x6c, 0x01);
hazheng 25:6f63053cee81 223 SCCBWrite(0x6d, 0x50);
hazheng 25:6f63053cee81 224 SCCBWrite(0x6e, 0x80);
hazheng 25:6f63053cee81 225 SCCBWrite(0x6f, 0x80);
hazheng 25:6f63053cee81 226 SCCBWrite(0x70, 0x0f);
hazheng 25:6f63053cee81 227 SCCBWrite(0x71, 0x00);
hazheng 25:6f63053cee81 228 SCCBWrite(0x72, 0x00);
hazheng 25:6f63053cee81 229 SCCBWrite(0x73, 0x0f);
hazheng 25:6f63053cee81 230 SCCBWrite(0x74, 0x0f);
hazheng 25:6f63053cee81 231 SCCBWrite(0x75, 0xff);
hazheng 25:6f63053cee81 232 SCCBWrite(0x76, 0xff);
hazheng 25:6f63053cee81 233 SCCBWrite(0x77, 0xff);
hazheng 25:6f63053cee81 234 SCCBWrite(0x78, 0x10);
hazheng 25:6f63053cee81 235 SCCBWrite(0x79, 0x70);
hazheng 25:6f63053cee81 236 SCCBWrite(0x7a, 0x70);
hazheng 25:6f63053cee81 237 SCCBWrite(0x7b, 0xf0);
hazheng 25:6f63053cee81 238 SCCBWrite(0x7c, 0xf0);
hazheng 25:6f63053cee81 239 SCCBWrite(0x7d, 0xf0);
hazheng 25:6f63053cee81 240 SCCBWrite(0x7e, 0x0e);
hazheng 25:6f63053cee81 241 SCCBWrite(0x7f, 0x1a);
hazheng 25:6f63053cee81 242 SCCBWrite(0x80, 0x31);
hazheng 25:6f63053cee81 243 SCCBWrite(0x81, 0x5a);
hazheng 25:6f63053cee81 244 SCCBWrite(0x82, 0x69);
hazheng 25:6f63053cee81 245 SCCBWrite(0x83, 0x75);
hazheng 25:6f63053cee81 246 SCCBWrite(0x84, 0x7e);
hazheng 25:6f63053cee81 247 SCCBWrite(0x85, 0x88);
hazheng 25:6f63053cee81 248 SCCBWrite(0x86, 0x8f);
hazheng 25:6f63053cee81 249 SCCBWrite(0x87, 0x96);
hazheng 25:6f63053cee81 250 SCCBWrite(0x88, 0xa3);
hazheng 25:6f63053cee81 251 SCCBWrite(0x89, 0xaf);
hazheng 25:6f63053cee81 252 SCCBWrite(0x8a, 0xc4);
hazheng 25:6f63053cee81 253 SCCBWrite(0x8b, 0xd7);
hazheng 25:6f63053cee81 254 SCCBWrite(0x8c, 0xe8);
hazheng 25:6f63053cee81 255 SCCBWrite(0x8d, 0x20);
hazheng 25:6f63053cee81 256 SCCBWrite(0x8e, 0x00);
hazheng 25:6f63053cee81 257 SCCBWrite(0x8f, 0x00);
hazheng 25:6f63053cee81 258 SCCBWrite(0x90, 0x08);
hazheng 25:6f63053cee81 259 SCCBWrite(0x91, 0x10);
hazheng 25:6f63053cee81 260 SCCBWrite(0x92, 0x1f);
hazheng 25:6f63053cee81 261 SCCBWrite(0x93, 0x01);
hazheng 25:6f63053cee81 262 SCCBWrite(0x94, 0x2c);
hazheng 25:6f63053cee81 263 SCCBWrite(0x95, 0x24);
hazheng 25:6f63053cee81 264 SCCBWrite(0x96, 0x08);
hazheng 25:6f63053cee81 265 SCCBWrite(0x97, 0x14);
hazheng 25:6f63053cee81 266 SCCBWrite(0x98, 0x24);
hazheng 25:6f63053cee81 267 SCCBWrite(0x99, 0x38);
hazheng 25:6f63053cee81 268 SCCBWrite(0x9a, 0x9e);
hazheng 25:6f63053cee81 269 SCCBWrite(0x9b, 0x00);
hazheng 25:6f63053cee81 270 SCCBWrite(0x9c, 0x40);
hazheng 25:6f63053cee81 271 SCCBWrite(0x9e, 0x11);
hazheng 25:6f63053cee81 272 SCCBWrite(0x9f, 0x02);
hazheng 25:6f63053cee81 273 SCCBWrite(0xa0, 0x00);
hazheng 25:6f63053cee81 274 SCCBWrite(0xa1, 0x40);
hazheng 25:6f63053cee81 275 SCCBWrite(0xa2, 0x40);
hazheng 25:6f63053cee81 276 SCCBWrite(0xa3, 0x06);
hazheng 25:6f63053cee81 277 SCCBWrite(0xa4, 0x00);
hazheng 25:6f63053cee81 278 SCCBWrite(0xa6, 0x00);
hazheng 25:6f63053cee81 279 SCCBWrite(0xa7, 0x40);
hazheng 25:6f63053cee81 280 SCCBWrite(0xa8, 0x40);
hazheng 25:6f63053cee81 281 SCCBWrite(0xa9, 0x80);
hazheng 25:6f63053cee81 282 SCCBWrite(0xaa, 0x80);
hazheng 25:6f63053cee81 283 SCCBWrite(0xab, 0x06);
hazheng 25:6f63053cee81 284 SCCBWrite(0xac, 0xff);
hazheng 25:6f63053cee81 285 }
hazheng 25:6f63053cee81 286 #endif
hazheng 25:6f63053cee81 287
hazheng 25:6f63053cee81 288 #ifdef WRITE_ORIGIN_REG_ON
hazheng 25:6f63053cee81 289 void OV7725RegBuf::WriteOriginalRegisters()
hazheng 25:6f63053cee81 290 {
hazheng 25:6f63053cee81 291 SCCBWrite(0x0, 0xff);
hazheng 25:6f63053cee81 292 SCCBWrite(0x1, 0x40);
hazheng 25:6f63053cee81 293 SCCBWrite(0x2, 0x40);
hazheng 25:6f63053cee81 294 SCCBWrite(0x3, 0x40);
hazheng 25:6f63053cee81 295 SCCBWrite(0x5, 0x3);
hazheng 25:6f63053cee81 296 SCCBWrite(0x6, 0x4);
hazheng 25:6f63053cee81 297 SCCBWrite(0x7, 0x4);
hazheng 25:6f63053cee81 298 SCCBWrite(0x8, 0x1);
hazheng 25:6f63053cee81 299 SCCBWrite(0x9, 0);
hazheng 25:6f63053cee81 300 //SCCBWrite(0xa, 0x77); //Read-Only
hazheng 25:6f63053cee81 301 //SCCBWrite(0xb, 0x21); //Read-Only
hazheng 25:6f63053cee81 302 SCCBWrite(0xc, 0x10);
hazheng 25:6f63053cee81 303 SCCBWrite(0xd, 0x41);
hazheng 25:6f63053cee81 304 SCCBWrite(0xe, 0x79);
hazheng 25:6f63053cee81 305 SCCBWrite(0xf, 0xa9);
hazheng 25:6f63053cee81 306 SCCBWrite(0x10, 0xfc);
hazheng 25:6f63053cee81 307 SCCBWrite(0x11, 0);
hazheng 25:6f63053cee81 308 SCCBWrite(0x12, 0);
hazheng 25:6f63053cee81 309 SCCBWrite(0x13, 0xcf);
hazheng 25:6f63053cee81 310 SCCBWrite(0x14, 0x40);
hazheng 25:6f63053cee81 311 SCCBWrite(0x15, 0);
hazheng 25:6f63053cee81 312 SCCBWrite(0x16, 0);
hazheng 25:6f63053cee81 313 SCCBWrite(0x17, 0x26);
hazheng 25:6f63053cee81 314 SCCBWrite(0x18, 0xa0);
hazheng 25:6f63053cee81 315 SCCBWrite(0x19, 0x7);
hazheng 25:6f63053cee81 316 SCCBWrite(0x1a, 0xf0);
hazheng 25:6f63053cee81 317 SCCBWrite(0x1b, 0x40);
hazheng 25:6f63053cee81 318 //SCCBWrite(0x1c, 0x7f); //Read-Only
hazheng 25:6f63053cee81 319 //SCCBWrite(0x1d, 0xa2); //Read-Only
hazheng 25:6f63053cee81 320 SCCBWrite(0x1f, 0);
hazheng 25:6f63053cee81 321 SCCBWrite(0x20, 0x10);
hazheng 25:6f63053cee81 322 SCCBWrite(0x22, 0xff);
hazheng 25:6f63053cee81 323 SCCBWrite(0x23, 0x1);
hazheng 25:6f63053cee81 324 SCCBWrite(0x24, 0x58);
hazheng 25:6f63053cee81 325 SCCBWrite(0x25, 0x48);
hazheng 25:6f63053cee81 326 SCCBWrite(0x26, 0xc3);
hazheng 25:6f63053cee81 327 SCCBWrite(0x28, 0);
hazheng 25:6f63053cee81 328 SCCBWrite(0x29, 0xa0);
hazheng 25:6f63053cee81 329 SCCBWrite(0x2a, 0);
hazheng 25:6f63053cee81 330 SCCBWrite(0x2b, 0);
hazheng 25:6f63053cee81 331 SCCBWrite(0x2c, 0xf0);
hazheng 25:6f63053cee81 332 SCCBWrite(0x2d, 0);
hazheng 25:6f63053cee81 333 SCCBWrite(0x2e, 0);
hazheng 25:6f63053cee81 334 SCCBWrite(0x2f, 0x1);
hazheng 25:6f63053cee81 335 SCCBWrite(0x30, 0x80);
hazheng 25:6f63053cee81 336 SCCBWrite(0x31, 0x60);
hazheng 25:6f63053cee81 337 SCCBWrite(0x32, 0);
hazheng 25:6f63053cee81 338 SCCBWrite(0x33, 0);
hazheng 25:6f63053cee81 339 SCCBWrite(0x34, 0);
hazheng 25:6f63053cee81 340 SCCBWrite(0x35, 0x83);
hazheng 25:6f63053cee81 341 SCCBWrite(0x36, 0x82);
hazheng 25:6f63053cee81 342 SCCBWrite(0x37, 0x7c);
hazheng 25:6f63053cee81 343 SCCBWrite(0x38, 0x7c);
hazheng 25:6f63053cee81 344 SCCBWrite(0x39, 0x85);
hazheng 25:6f63053cee81 345 SCCBWrite(0x3a, 0x84);
hazheng 25:6f63053cee81 346 SCCBWrite(0x3b, 0x86);
hazheng 25:6f63053cee81 347 SCCBWrite(0x3c, 0x86);
hazheng 25:6f63053cee81 348 SCCBWrite(0x3d, 0x80);
hazheng 25:6f63053cee81 349 SCCBWrite(0x3e, 0xe2);
hazheng 25:6f63053cee81 350 SCCBWrite(0x3f, 0x1f);
hazheng 25:6f63053cee81 351 SCCBWrite(0x40, 0xe8);
hazheng 25:6f63053cee81 352 SCCBWrite(0x41, 0);
hazheng 25:6f63053cee81 353 SCCBWrite(0x42, 0x80);
hazheng 25:6f63053cee81 354 SCCBWrite(0x43, 0x80);
hazheng 25:6f63053cee81 355 SCCBWrite(0x44, 0x80);
hazheng 25:6f63053cee81 356 SCCBWrite(0x45, 0x80);
hazheng 25:6f63053cee81 357 SCCBWrite(0x46, 0);
hazheng 25:6f63053cee81 358 SCCBWrite(0x47, 0);
hazheng 25:6f63053cee81 359 SCCBWrite(0x48, 0);
hazheng 25:6f63053cee81 360 SCCBWrite(0x49, 0x50);
hazheng 25:6f63053cee81 361 SCCBWrite(0x4a, 0x30);
hazheng 25:6f63053cee81 362 SCCBWrite(0x4b, 0x50);
hazheng 25:6f63053cee81 363 SCCBWrite(0x4c, 0x50);
hazheng 25:6f63053cee81 364 SCCBWrite(0x4d, 0);
hazheng 25:6f63053cee81 365 SCCBWrite(0x4e, 0xef);
hazheng 25:6f63053cee81 366 SCCBWrite(0x4f, 0x10);
hazheng 25:6f63053cee81 367 SCCBWrite(0x50, 0x60);
hazheng 25:6f63053cee81 368 SCCBWrite(0x51, 0);
hazheng 25:6f63053cee81 369 SCCBWrite(0x52, 0);
hazheng 25:6f63053cee81 370 SCCBWrite(0x53, 0x24);
hazheng 25:6f63053cee81 371 SCCBWrite(0x54, 0x7a);
hazheng 25:6f63053cee81 372 SCCBWrite(0x55, 0xfc);
hazheng 25:6f63053cee81 373 SCCBWrite(0x60, 0);
hazheng 25:6f63053cee81 374 SCCBWrite(0x61, 0x5);
hazheng 25:6f63053cee81 375 SCCBWrite(0x62, 0xff);
hazheng 25:6f63053cee81 376 SCCBWrite(0x63, 0xf0);
hazheng 25:6f63053cee81 377 SCCBWrite(0x64, 0xbf);
hazheng 25:6f63053cee81 378 SCCBWrite(0x65, 0);
hazheng 25:6f63053cee81 379 SCCBWrite(0x66, 0x10);
hazheng 25:6f63053cee81 380 SCCBWrite(0x67, 0);
hazheng 25:6f63053cee81 381 SCCBWrite(0x68, 0);
hazheng 25:6f63053cee81 382 SCCBWrite(0x69, 0x5c);
hazheng 25:6f63053cee81 383 SCCBWrite(0x6a, 0x11);
hazheng 25:6f63053cee81 384 SCCBWrite(0x6b, 0xa2);
hazheng 25:6f63053cee81 385 SCCBWrite(0x6c, 0x1);
hazheng 25:6f63053cee81 386 SCCBWrite(0x6d, 0x50);
hazheng 25:6f63053cee81 387 SCCBWrite(0x6e, 0x80);
hazheng 25:6f63053cee81 388 SCCBWrite(0x6f, 0x80);
hazheng 25:6f63053cee81 389 SCCBWrite(0x70, 0xf);
hazheng 25:6f63053cee81 390 SCCBWrite(0x71, 0);
hazheng 25:6f63053cee81 391 SCCBWrite(0x72, 0);
hazheng 25:6f63053cee81 392 SCCBWrite(0x73, 0xf);
hazheng 25:6f63053cee81 393 SCCBWrite(0x74, 0xf);
hazheng 25:6f63053cee81 394 SCCBWrite(0x75, 0xff);
hazheng 25:6f63053cee81 395 SCCBWrite(0x76, 0);
hazheng 25:6f63053cee81 396 SCCBWrite(0x77, 0x10);
hazheng 25:6f63053cee81 397 SCCBWrite(0x78, 0x10);
hazheng 25:6f63053cee81 398 SCCBWrite(0x79, 0x70);
hazheng 25:6f63053cee81 399 SCCBWrite(0x7a, 0x70);
hazheng 25:6f63053cee81 400 SCCBWrite(0x7b, 0xf0);
hazheng 25:6f63053cee81 401 SCCBWrite(0x7c, 0xf0);
hazheng 25:6f63053cee81 402 SCCBWrite(0x7d, 0xf0);
hazheng 25:6f63053cee81 403 SCCBWrite(0x7e, 0xe);
hazheng 25:6f63053cee81 404 SCCBWrite(0x7f, 0x1a);
hazheng 25:6f63053cee81 405 SCCBWrite(0x80, 0x31);
hazheng 25:6f63053cee81 406 SCCBWrite(0x81, 0x5a);
hazheng 25:6f63053cee81 407 SCCBWrite(0x82, 0x69);
hazheng 25:6f63053cee81 408 SCCBWrite(0x83, 0x75);
hazheng 25:6f63053cee81 409 SCCBWrite(0x84, 0x7e);
hazheng 25:6f63053cee81 410 SCCBWrite(0x85, 0x88);
hazheng 25:6f63053cee81 411 SCCBWrite(0x86, 0x8f);
hazheng 25:6f63053cee81 412 SCCBWrite(0x87, 0x96);
hazheng 25:6f63053cee81 413 SCCBWrite(0x88, 0xa3);
hazheng 25:6f63053cee81 414 SCCBWrite(0x89, 0xaf);
hazheng 25:6f63053cee81 415 SCCBWrite(0x8a, 0xc4);
hazheng 25:6f63053cee81 416 SCCBWrite(0x8b, 0xd7);
hazheng 25:6f63053cee81 417 SCCBWrite(0x8c, 0xe8);
hazheng 25:6f63053cee81 418 SCCBWrite(0x8d, 0x20);
hazheng 25:6f63053cee81 419 SCCBWrite(0x8e, 0x4e);
hazheng 25:6f63053cee81 420 SCCBWrite(0x8f, 0x1);
hazheng 25:6f63053cee81 421 SCCBWrite(0x90, 0x8);
hazheng 25:6f63053cee81 422 SCCBWrite(0x91, 0x10);
hazheng 25:6f63053cee81 423 SCCBWrite(0x92, 0x1f);
hazheng 25:6f63053cee81 424 SCCBWrite(0x93, 0x1);
hazheng 25:6f63053cee81 425 SCCBWrite(0x94, 0x2c);
hazheng 25:6f63053cee81 426 SCCBWrite(0x95, 0x24);
hazheng 25:6f63053cee81 427 SCCBWrite(0x96, 0x8);
hazheng 25:6f63053cee81 428 SCCBWrite(0x97, 0x14);
hazheng 25:6f63053cee81 429 SCCBWrite(0x98, 0x24);
hazheng 25:6f63053cee81 430 SCCBWrite(0x99, 0x38);
hazheng 25:6f63053cee81 431 SCCBWrite(0x9a, 0x9e);
hazheng 25:6f63053cee81 432 SCCBWrite(0x9b, 0);
hazheng 25:6f63053cee81 433 SCCBWrite(0x9c, 0x40);
hazheng 25:6f63053cee81 434 SCCBWrite(0x9e, 0x11);
hazheng 25:6f63053cee81 435 SCCBWrite(0x9f, 0xa);
hazheng 25:6f63053cee81 436 SCCBWrite(0xa0, 0x2);
hazheng 25:6f63053cee81 437 SCCBWrite(0xa1, 0x50);
hazheng 25:6f63053cee81 438 SCCBWrite(0xa2, 0x40);
hazheng 25:6f63053cee81 439 SCCBWrite(0xa3, 0x6);
hazheng 25:6f63053cee81 440 SCCBWrite(0xa4, 0);
hazheng 25:6f63053cee81 441 SCCBWrite(0xa6, 0);
hazheng 25:6f63053cee81 442 SCCBWrite(0xa7, 0x40);
hazheng 25:6f63053cee81 443 SCCBWrite(0xa8, 0x40);
hazheng 25:6f63053cee81 444 SCCBWrite(0xa9, 0x80);
hazheng 25:6f63053cee81 445 SCCBWrite(0xaa, 0);
hazheng 25:6f63053cee81 446 SCCBWrite(0xab, 0x6);
hazheng 25:6f63053cee81 447 SCCBWrite(0xac, 0xff);
hazheng 25:6f63053cee81 448 }
hazheng 25:6f63053cee81 449 #endif