forked from waveshare/IT8951
-
Notifications
You must be signed in to change notification settings - Fork 0
/
render_bmp.c
45 lines (37 loc) · 929 Bytes
/
render_bmp.c
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
#include "IT8951.h"
#include <unistd.h> // For sleep function
#define MAX_RETRIES 3
int main (int argc, char *argv[])
{
IT8951DevInfo devInfo;
int retries = 0;
while (retries < MAX_RETRIES)
{
if(IT8951_Init())
{
printf("IT8951_Init error, retrying... (%d/%d)\n", retries + 1, MAX_RETRIES);
retries++;
sleep(1); // Wait for a second before retrying
}
else
{
break; // Initialization successful
}
}
if (retries == MAX_RETRIES)
{
printf("Failed to initialize IT8951 after %d attempts.\n", MAX_RETRIES);
return 1;
}
if (argc != 4)
{
printf("Usage: %s <x> <y> <bmp_file>\n", argv[0]);
return 1;
}
uint32_t x, y;
sscanf(argv[1], "%d", &x);
sscanf(argv[2], "%d", &y);
IT8951_BMP_Example(x, y, argv[3]);
IT8951_Cancel();
return 0;
}