forked from arduino/ArduinoCore-mbed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathH7DisplayShield.cpp
71 lines (54 loc) · 1.39 KB
/
H7DisplayShield.cpp
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
#include "H7DisplayShield.h"
#include "Arduino.h"
#include "anx7625.h"
#include "st7701.h"
extern "C" {
#include "video_modes.h"
}
int GigaDisplayShieldClass::init(int edidmode) {
//Init LCD Controller
st7701_init((enum edid_modes) edidmode);
return 0;
}
int GigaDisplayShieldClass::getEdidMode(int h, int v) {
return EDID_MODE_480x800_60Hz;
}
int GigaDisplayShieldClass::getStatus() {
return 1;
}
int USBCVideoClass::init(int edidmode) {
struct edid recognized_edid;
int err_code = 0;
memset(&recognized_edid, 0, sizeof(recognized_edid));
//Initialization of ANX7625
err_code = anx7625_init(0);
if(err_code < 0) {
return err_code;
}
//Checking HDMI plug event
err_code = anx7625_wait_hpd_event(0);
if(err_code < 0) {
return err_code;
}
//Read EDID
err_code = anx7625_dp_get_edid(0, &recognized_edid);
if(err_code < 0) {
return err_code;
}
//DSI Configuration
err_code = anx7625_dp_start(0, &recognized_edid, (enum edid_modes) edidmode);
if(err_code < 0) {
return err_code;
}
return 0;
}
int USBCVideoClass::getEdidMode(int h, int v) {
int edidmode = video_modes_get_edid(h, v);
return edidmode;
}
int USBCVideoClass::getStatus() {
int detected = anx7625_get_hpd_event(0);
return detected;
}
GigaDisplayShieldClass GigaDisplayShield;
USBCVideoClass USBCVideo;