25
25
26
26
// #define CONVERT_TO_JPEG
27
27
28
- void setup () {
28
+ void setup ()
29
+ {
29
30
auto cfg = M5.config ();
30
31
CoreS3.begin (cfg);
31
32
CoreS3.Display .setTextColor (GREEN);
@@ -34,28 +35,22 @@ void setup() {
34
35
CoreS3.Display .setTextSize (1 );
35
36
36
37
if (!CoreS3.Camera .begin ()) {
37
- CoreS3.Display .drawString (" Camera Init Fail" ,
38
- CoreS3.Display .width () / 2 ,
39
- CoreS3.Display .height () / 2 );
38
+ CoreS3.Display .drawString (" Camera Init Fail" , CoreS3.Display .width () / 2 , CoreS3.Display .height () / 2 );
40
39
}
41
- CoreS3.Display .drawString (" Camera Init Success" , CoreS3.Display .width () / 2 ,
42
- CoreS3.Display .height () / 2 );
43
-
44
- CoreS3.Camera .sensor ->set_framesize (CoreS3.Camera .sensor , FRAMESIZE_QVGA);
40
+ CoreS3.Display .drawString (" Camera Init Success" , CoreS3.Display .width () / 2 , CoreS3.Display .height () / 2 );
45
41
}
46
42
47
- void loop () {
43
+ void loop ()
44
+ {
48
45
if (CoreS3.Camera .get ()) {
49
46
#ifdef CONVERT_TO_JPEG
50
47
uint8_t *out_jpg = NULL ;
51
48
size_t out_jpg_len = 0 ;
52
49
frame2jpg (CoreS3.Camera .fb , 255 , &out_jpg, &out_jpg_len);
53
- CoreS3.Display .drawJpg (out_jpg, out_jpg_len, 0 , 0 ,
54
- CoreS3.Display .width (), CoreS3.Display .height ());
50
+ CoreS3.Display .drawJpg (out_jpg, out_jpg_len, 0 , 0 , CoreS3.Display .width (), CoreS3.Display .height ());
55
51
free (out_jpg);
56
52
#else
57
- CoreS3.Display .pushImage (0 , 0 , CoreS3.Display .width (),
58
- CoreS3.Display .height (),
53
+ CoreS3.Display .pushImage (0 , 0 , CoreS3.Display .width (), CoreS3.Display .height (),
59
54
(uint16_t *)CoreS3.Camera .fb ->buf );
60
55
#endif
61
56
0 commit comments