File tree 4 files changed +28
-10
lines changed
libraries/Arduino_H7_Video/src
4 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ int Arduino_H7_Video::begin() {
95
95
#endif
96
96
97
97
/* Video controller/bridge init */
98
- _shield->init (_edidMode);
98
+ int err_code = _shield->init (_edidMode);
99
+ if (err_code < 0 ) {
100
+ return 3 ; /* Video controller fail init */
101
+ }
99
102
100
103
#if __has_include("lvgl.h")
101
104
/* Initiliaze LVGL library */
Original file line number Diff line number Diff line change @@ -31,13 +31,22 @@ int USBCVideoClass::init(int edidmode) {
31
31
}
32
32
33
33
// Checking HDMI plug event
34
- anx7625_wait_hpd_event (0 );
34
+ err_code = anx7625_wait_hpd_event (0 );
35
+ if (err_code < 0 ) {
36
+ return err_code;
37
+ }
35
38
36
39
// Read EDID
37
- anx7625_dp_get_edid (0 , &recognized_edid);
40
+ err_code = anx7625_dp_get_edid (0 , &recognized_edid);
41
+ if (err_code < 0 ) {
42
+ return err_code;
43
+ }
38
44
39
45
// DSI Configuration
40
- anx7625_dp_start (0 , &recognized_edid, (enum edid_modes) edidmode);
46
+ err_code = anx7625_dp_start (0 , &recognized_edid, (enum edid_modes) edidmode);
47
+ if (err_code < 0 ) {
48
+ return err_code;
49
+ }
41
50
42
51
return 0 ;
43
52
}
Original file line number Diff line number Diff line change @@ -520,15 +520,21 @@ int anx7625_init(uint8_t bus) {
520
520
return 0 ;
521
521
}
522
522
523
- void anx7625_wait_hpd_event (uint8_t bus) {
523
+ int anx7625_wait_hpd_event (uint8_t bus) {
524
524
ANXINFO (" Waiting for HDMI hot plug event...\n " );
525
-
526
- while (1 ) {
525
+
526
+ int retry_hpd_change = 10000 ;
527
+ while (--retry_hpd_change) {
527
528
mdelay (10 );
528
529
int detected = anx7625_hpd_change_detect (bus);
529
- if (detected == 1 )
530
- break ;
530
+ if (detected < 0 )
531
+ return -1 ;
532
+ if (detected > 0 )
533
+ return 0 ;
531
534
}
535
+
536
+ ANXERROR (" Timed out to detect HPD change on bus %d.\n " , bus);
537
+ return -1 ;
532
538
}
533
539
534
540
int anx7625_get_cc_status (uint8_t bus, uint8_t *cc_status) {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ extern "C" {
20
20
int anx7625_dp_start (uint8_t bus , const struct edid * edid , enum edid_modes mode = EDID_MODE_AUTO );
21
21
int anx7625_dp_get_edid (uint8_t bus , struct edid * out );
22
22
int anx7625_init (uint8_t bus );
23
- void anx7625_wait_hpd_event (uint8_t bus );
23
+ int anx7625_wait_hpd_event (uint8_t bus );
24
24
int anx7625_get_cc_status (uint8_t bus , uint8_t * cc_status );
25
25
int anx7625_read_system_status (uint8_t bus , uint8_t * sys_status );
26
26
bool anx7625_is_power_provider (uint8_t bus );
You can’t perform that action at this time.
0 commit comments