-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArduCAM_Mini_2MP_OV2640_functions.ino
560 lines (558 loc) · 17.7 KB
/
ArduCAM_Mini_2MP_OV2640_functions.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
// ArduCAM Mini demo (C)2017 Lee
// Web: http://www.ArduCAM.com
// This program is a demo of how to use most of the functions
// of the library with ArduCAM Mini camera, and can run on any Arduino platform.
// This demo was made for ArduCAM_Mini_5MP_Plus.
// It needs to be used in combination with PC software.
// It can test OV2640 functions
// This program requires the ArduCAM V4.0.0 (or later) library and ArduCAM_Mini_5MP_Plus
// and use Arduino IDE 1.6.8 compiler or above
#include <Wire.h>
#include <ArduCAM.h>
#include <SPI.h>
#include "memorysaver.h"
//This demo can only work on OV2640_MINI_2MP platform.
#if !(defined OV2640_MINI_2MP)
#error Please select the hardware platform and camera module in the ../libraries/ArduCAM/memorysaver.h file
#endif
#define BMPIMAGEOFFSET 66
const char bmp_header[BMPIMAGEOFFSET] PROGMEM =
{
0x42, 0x4D, 0x36, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x58, 0x02, 0x00, 0xC4, 0x0E, 0x00, 0x00, 0xC4, 0x0E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x1F, 0x00,
0x00, 0x00
};
// set pin 7 as the slave select for the digital pot:
const int CS = 7;
bool is_header = false;
int mode = 0;
uint8_t start_capture = 0;
#if defined (OV2640_MINI_2MP)
ArduCAM myCAM( OV2640, CS );
#else
ArduCAM myCAM( OV5642, CS );
#endif
uint8_t read_fifo_burst(ArduCAM myCAM);
void setup() {
// put your setup code here, to run once:
uint8_t vid, pid;
uint8_t temp;
#if defined(__SAM3X8E__)
Wire1.begin();
Serial.begin(115200);
#else
Wire.begin();
Serial.begin(921600);
#endif
Serial.println(F("ACK CMD ArduCAM Start! END"));
// set the CS as an output:
pinMode(CS, OUTPUT);
digitalWrite(CS, HIGH);
// initialize SPI:
SPI.begin();
//Reset the CPLD
myCAM.write_reg(0x07, 0x80);
delay(100);
myCAM.write_reg(0x07, 0x00);
delay(100);
while(1){
//Check if the ArduCAM SPI bus is OK
myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
temp = myCAM.read_reg(ARDUCHIP_TEST1);
if (temp != 0x55){
Serial.println(F("ACK CMD SPI interface Error! END"));
delay(1000);continue;
}else{
Serial.println(F("ACK CMD SPI interface OK. END"));break;
}
}
#if defined (OV2640_MINI_2MP)
while(1){
//Check if the camera module type is OV2640
myCAM.wrSensorReg8_8(0xff, 0x01);
myCAM.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid);
myCAM.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid);
if ((vid != 0x26 ) && (( pid != 0x41 ) || ( pid != 0x42 ))){
Serial.println(F("ACK CMD Can't find OV2640 module! END"));
delay(1000);continue;
}
else{
Serial.println(F("ACK CMD OV2640 detected. END"));break;
}
}
#else
while(1){
//Check if the camera module type is OV5642
myCAM.wrSensorReg16_8(0xff, 0x01);
myCAM.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid);
myCAM.rdSensorReg16_8(OV5642_CHIPID_LOW, &pid);
if((vid != 0x56) || (pid != 0x42)){
Serial.println(F("ACK CMD Can't find OV5642 module! END"));
delay(1000);continue;
}
else{
Serial.println(F("ACK CMD OV5642 detected. END"));break;
}
}
#endif
//Change to JPEG capture mode and initialize the OV5642 module
myCAM.set_format(JPEG);
myCAM.InitCAM();
#if defined (OV2640_MINI_2MP)
myCAM.OV2640_set_JPEG_size(OV2640_320x240);
#else
myCAM.write_reg(ARDUCHIP_TIM, VSYNC_LEVEL_MASK); //VSYNC is active HIGH
myCAM.OV5642_set_JPEG_size(OV5642_320x240);
#endif
delay(1000);
myCAM.clear_fifo_flag();
#if !(defined (OV2640_MINI_2MP))
myCAM.write_reg(ARDUCHIP_FRAMES,0x00);
#endif
}
void loop() {
// put your main code here, to run repeatedly:
uint8_t temp = 0xff, temp_last = 0;
bool is_header = false;
if (Serial.available())
{
temp = Serial.read();
switch (temp)
{
case 0:
myCAM.OV2640_set_JPEG_size(OV2640_160x120);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_160x120 END"));
temp = 0xff;
break;
case 1:
myCAM.OV2640_set_JPEG_size(OV2640_176x144);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_176x144 END"));
temp = 0xff;
break;
case 2:
myCAM.OV2640_set_JPEG_size(OV2640_320x240);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_320x240 END"));
temp = 0xff;
break;
case 3:
myCAM.OV2640_set_JPEG_size(OV2640_352x288);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_352x288 END"));
temp = 0xff;
break;
case 4:
myCAM.OV2640_set_JPEG_size(OV2640_640x480);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_640x480 END"));
temp = 0xff;
break;
case 5:
myCAM.OV2640_set_JPEG_size(OV2640_800x600);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_800x600 END"));
temp = 0xff;
break;
case 6:
myCAM.OV2640_set_JPEG_size(OV2640_1024x768);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_1024x768 END"));
temp = 0xff;
break;
case 7:
myCAM.OV2640_set_JPEG_size(OV2640_1280x1024);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_1280x1024 END"));
temp = 0xff;
break;
case 8:
myCAM.OV2640_set_JPEG_size(OV2640_1600x1200);delay(1000);
Serial.println(F("ACK CMD switch to OV2640_1600x1200 END"));
temp = 0xff;
break;
case 0x10:
mode = 1;
temp = 0xff;
start_capture = 1;
Serial.println(F("ACK CMD CAM start single shoot. END"));
break;
case 0x11:
temp = 0xff;
myCAM.set_format(JPEG);
myCAM.InitCAM();
#if !(defined (OV2640_MINI_2MP))
myCAM.set_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);
#endif
break;
case 0x20:
mode = 2;
temp = 0xff;
start_capture = 2;
Serial.println(F("ACK CMD CAM start video streaming. END"));
break;
case 0x30:
mode = 3;
temp = 0xff;
start_capture = 3;
Serial.println(F("ACK CMD CAM start single shoot. END"));
break;
case 0x31:
temp = 0xff;
myCAM.set_format(BMP);
myCAM.InitCAM();
#if !(defined (OV2640_MINI_2MP))
myCAM.clear_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);
#endif
myCAM.wrSensorReg16_8(0x3818, 0x81);
myCAM.wrSensorReg16_8(0x3621, 0xA7);
break;
case 0x40:
myCAM.OV2640_set_Light_Mode(Auto);temp = 0xff;
Serial.println(F("ACK CMD Set to Auto END"));break;
case 0x41:
myCAM.OV2640_set_Light_Mode(Sunny);temp = 0xff;
Serial.println(F("ACK CMD Set to Sunny END"));break;
case 0x42:
myCAM.OV2640_set_Light_Mode(Cloudy);temp = 0xff;
Serial.println(F("ACK CMD Set to Cloudy END"));break;
case 0x43:
myCAM.OV2640_set_Light_Mode(Office);temp = 0xff;
Serial.println(F("ACK CMD Set to Office END"));break;
case 0x44:
myCAM.OV2640_set_Light_Mode(Home); temp = 0xff;
Serial.println(F("ACK CMD Set to Home END"));break;
case 0x50:
myCAM.OV2640_set_Color_Saturation(Saturation2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+2 END"));break;
case 0x51:
myCAM.OV2640_set_Color_Saturation(Saturation1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+1 END"));break;
case 0x52:
myCAM.OV2640_set_Color_Saturation(Saturation0); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+0 END"));break;
case 0x53:
myCAM. OV2640_set_Color_Saturation(Saturation_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-1 END"));break;
case 0x54:
myCAM.OV2640_set_Color_Saturation(Saturation_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-2 END"));break;
case 0x60:
myCAM.OV2640_set_Brightness(Brightness2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+2 END"));break;
case 0x61:
myCAM.OV2640_set_Brightness(Brightness1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+1 END"));break;
case 0x62:
myCAM.OV2640_set_Brightness(Brightness0); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+0 END"));break;
case 0x63:
myCAM. OV2640_set_Brightness(Brightness_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-1 END"));break;
case 0x64:
myCAM.OV2640_set_Brightness(Brightness_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-2 END"));break;
case 0x70:
myCAM.OV2640_set_Contrast(Contrast2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+2 END"));break;
case 0x71:
myCAM.OV2640_set_Contrast(Contrast1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+1 END"));break;
case 0x72:
myCAM.OV2640_set_Contrast(Contrast0);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+0 END"));break;
case 0x73:
myCAM.OV2640_set_Contrast(Contrast_1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-1 END"));break;
case 0x74:
myCAM.OV2640_set_Contrast(Contrast_2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-2 END"));break;
case 0x80:
myCAM.OV2640_set_Special_effects(Antique);temp = 0xff;
Serial.println(F("ACK CMD Set to Antique END"));break;
case 0x81:
myCAM.OV2640_set_Special_effects(Bluish);temp = 0xff;
Serial.println(F("ACK CMD Set to Bluish END"));break;
case 0x82:
myCAM.OV2640_set_Special_effects(Greenish);temp = 0xff;
Serial.println(F("ACK CMD Set to Greenish END"));break;
case 0x83:
myCAM.OV2640_set_Special_effects(Reddish);temp = 0xff;
Serial.println(F("ACK CMD Set to Reddish END"));break;
case 0x84:
myCAM.OV2640_set_Special_effects(BW);temp = 0xff;
Serial.println(F("ACK CMD Set to BW END"));break;
case 0x85:
myCAM.OV2640_set_Special_effects(Negative);temp = 0xff;
Serial.println(F("ACK CMD Set to Negative END"));break;
case 0x86:
myCAM.OV2640_set_Special_effects(BWnegative);temp = 0xff;
Serial.println(F("ACK CMD Set to BWnegative END"));break;
case 0x87:
myCAM.OV2640_set_Special_effects(Normal);temp = 0xff;
Serial.println(F("ACK CMD Set to Normal END"));break;
}
}
if (mode == 1)
{
if (start_capture == 1)
{
myCAM.flush_fifo();
myCAM.clear_fifo_flag();
//Start capture
myCAM.start_capture();
start_capture = 0;
}
if (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
{
Serial.println(F("ACK CMD CAM Capture Done. END"));delay(50);
read_fifo_burst(myCAM);
//Clear the capture done flag
myCAM.clear_fifo_flag();
}
}
else if (mode == 2)
{
while (1)
{
temp = Serial.read();
if (temp == 0x21)
{
start_capture = 0;
mode = 0;
Serial.println(F("ACK CMD CAM stop video streaming. END"));
break;
}
switch (temp)
{
case 0x40:
myCAM.OV2640_set_Light_Mode(Auto);temp = 0xff;
Serial.println(F("ACK CMD Set to Auto END"));break;
case 0x41:
myCAM.OV2640_set_Light_Mode(Sunny);temp = 0xff;
Serial.println(F("ACK CMD Set to Sunny END"));break;
case 0x42:
myCAM.OV2640_set_Light_Mode(Cloudy);temp = 0xff;
Serial.println(F("ACK CMD Set to Cloudy END"));break;
case 0x43:
myCAM.OV2640_set_Light_Mode(Office);temp = 0xff;
Serial.println(F("ACK CMD Set to Office END"));break;
case 0x44:
myCAM.OV2640_set_Light_Mode(Home); temp = 0xff;
Serial.println(F("ACK CMD Set to Home END"));break;
case 0x50:
myCAM.OV2640_set_Color_Saturation(Saturation2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+2 END"));break;
case 0x51:
myCAM.OV2640_set_Color_Saturation(Saturation1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+1 END"));break;
case 0x52:
myCAM.OV2640_set_Color_Saturation(Saturation0); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation+0 END"));break;
case 0x53:
myCAM. OV2640_set_Color_Saturation(Saturation_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-1 END"));break;
case 0x54:
myCAM.OV2640_set_Color_Saturation(Saturation_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Saturation-2 END"));break;
case 0x60:
myCAM.OV2640_set_Brightness(Brightness2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+2 END"));break;
case 0x61:
myCAM.OV2640_set_Brightness(Brightness1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+1 END"));break;
case 0x62:
myCAM.OV2640_set_Brightness(Brightness0); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness+0 END"));break;
case 0x63:
myCAM. OV2640_set_Brightness(Brightness_1); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-1 END"));break;
case 0x64:
myCAM.OV2640_set_Brightness(Brightness_2); temp = 0xff;
Serial.println(F("ACK CMD Set to Brightness-2 END"));break;
case 0x70:
myCAM.OV2640_set_Contrast(Contrast2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+2 END"));break;
case 0x71:
myCAM.OV2640_set_Contrast(Contrast1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+1 END"));break;
case 0x72:
myCAM.OV2640_set_Contrast(Contrast0);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast+0 END"));break;
case 0x73:
myCAM.OV2640_set_Contrast(Contrast_1);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-1 END"));break;
case 0x74:
myCAM.OV2640_set_Contrast(Contrast_2);temp = 0xff;
Serial.println(F("ACK CMD Set to Contrast-2 END"));break;
case 0x80:
myCAM.OV2640_set_Special_effects(Antique);temp = 0xff;
Serial.println(F("ACK CMD Set to Antique END"));break;
case 0x81:
myCAM.OV2640_set_Special_effects(Bluish);temp = 0xff;
Serial.println(F("ACK CMD Set to Bluish END"));break;
case 0x82:
myCAM.OV2640_set_Special_effects(Greenish);temp = 0xff;
Serial.println(F("ACK CMD Set to Greenish END"));break;
case 0x83:
myCAM.OV2640_set_Special_effects(Reddish);temp = 0xff;
Serial.println(F("ACK CMD Set to Reddish END"));break;
case 0x84:
myCAM.OV2640_set_Special_effects(BW);temp = 0xff;
Serial.println(F("ACK CMD Set to BW END"));break;
case 0x85:
myCAM.OV2640_set_Special_effects(Negative);temp = 0xff;
Serial.println(F("ACK CMD Set to Negative END"));break;
case 0x86:
myCAM.OV2640_set_Special_effects(BWnegative);temp = 0xff;
Serial.println(F("ACK CMD Set to BWnegative END"));break;
case 0x87:
myCAM.OV2640_set_Special_effects(Normal);temp = 0xff;
Serial.println(F("ACK CMD Set to Normal END"));break;
}
if (start_capture == 2)
{
myCAM.flush_fifo();
myCAM.clear_fifo_flag();
//Start capture
myCAM.start_capture();
start_capture = 0;
}
if (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
{
uint32_t length = 0;
length = myCAM.read_fifo_length();
if ((length >= MAX_FIFO_SIZE) | (length == 0))
{
myCAM.clear_fifo_flag();
start_capture = 2;
continue;
}
myCAM.CS_LOW();
myCAM.set_fifo_burst();//Set fifo burst mode
temp = SPI.transfer(0x00);
length --;
while ( length-- )
{
temp_last = temp;
temp = SPI.transfer(0x00);
if (is_header == true)
{
Serial.write(temp);
}
else if ((temp == 0xD8) & (temp_last == 0xFF))
{
is_header = true;
Serial.println(F("ACK IMG END"));
Serial.write(temp_last);
Serial.write(temp);
}
if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while,
break;
delayMicroseconds(15);
}
myCAM.CS_HIGH();
myCAM.clear_fifo_flag();
start_capture = 2;
is_header = false;
}
}
}
else if (mode == 3)
{
if (start_capture == 3)
{
//Flush the FIFO
myCAM.flush_fifo();
myCAM.clear_fifo_flag();
//Start capture
myCAM.start_capture();
start_capture = 0;
}
if (myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
{
Serial.println(F("ACK CMD CAM Capture Done. END"));delay(50);
uint8_t temp, temp_last;
uint32_t length = 0;
length = myCAM.read_fifo_length();
if (length >= MAX_FIFO_SIZE )
{
Serial.println(F("ACK CMD Over size. END"));
myCAM.clear_fifo_flag();
return;
}
if (length == 0 ) //0 kb
{
Serial.println(F("ACK CMD Size is 0. END"));
myCAM.clear_fifo_flag();
return;
}
myCAM.CS_LOW();
myCAM.set_fifo_burst();//Set fifo burst mode
Serial.write(0xFF);
Serial.write(0xAA);
for (temp = 0; temp < BMPIMAGEOFFSET; temp++)
{
Serial.write(pgm_read_byte(&bmp_header[temp]));
}
SPI.transfer(0x00);
char VH, VL;
int i = 0, j = 0;
for (i = 0; i < 240; i++)
{
for (j = 0; j < 320; j++)
{
VH = SPI.transfer(0x00);;
VL = SPI.transfer(0x00);;
Serial.write(VL);
delayMicroseconds(12);
Serial.write(VH);
delayMicroseconds(12);
}
}
Serial.write(0xBB);
Serial.write(0xCC);
myCAM.CS_HIGH();
//Clear the capture done flag
myCAM.clear_fifo_flag();
}
}
}
uint8_t read_fifo_burst(ArduCAM myCAM)
{
uint8_t temp = 0, temp_last = 0;
uint32_t length = 0;
length = myCAM.read_fifo_length();
Serial.println(length, DEC);
if (length >= MAX_FIFO_SIZE) //512 kb
{
Serial.println(F("ACK CMD Over size. END"));
return 0;
}
if (length == 0 ) //0 kb
{
Serial.println(F("ACK CMD Size is 0. END"));
return 0;
}
myCAM.CS_LOW();
myCAM.set_fifo_burst();//Set fifo burst mode
temp = SPI.transfer(0x00);
length --;
while ( length-- )
{
temp_last = temp;
temp = SPI.transfer(0x00);
if (is_header == true)
{
Serial.write(temp);
}
else if ((temp == 0xD8) & (temp_last == 0xFF))
{
is_header = true;
Serial.println(F("ACK IMG END"));
Serial.write(temp_last);
Serial.write(temp);
}
if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while,
break;
delayMicroseconds(15);
}
myCAM.CS_HIGH();
is_header = false;
return 1;
}