File tree Expand file tree Collapse file tree 4 files changed +28
-10
lines changed
libraries/Arduino_H7_Video/src Expand file tree Collapse file tree 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() {
9595#endif
9696
9797 /* 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+ }
99102
100103 #if __has_include("lvgl.h")
101104 /* Initiliaze LVGL library */
Original file line number Diff line number Diff line change @@ -31,13 +31,22 @@ int USBCVideoClass::init(int edidmode) {
3131 }
3232
3333 // 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+ }
3538
3639 // 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+ }
3844
3945 // 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+ }
4150
4251 return 0 ;
4352}
Original file line number Diff line number Diff line change @@ -520,15 +520,21 @@ int anx7625_init(uint8_t bus) {
520520 return 0 ;
521521}
522522
523- void anx7625_wait_hpd_event (uint8_t bus) {
523+ int anx7625_wait_hpd_event (uint8_t bus) {
524524 ANXINFO (" Waiting for HDMI hot plug event...\n " );
525-
526- while (1 ) {
525+
526+ int retry_hpd_change = 10000 ;
527+ while (--retry_hpd_change) {
527528 mdelay (10 );
528529 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 ;
531534 }
535+
536+ ANXERROR (" Timed out to detect HPD change on bus %d.\n " , bus);
537+ return -1 ;
532538}
533539
534540int 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" {
2020int anx7625_dp_start (uint8_t bus , const struct edid * edid , enum edid_modes mode = EDID_MODE_AUTO );
2121int anx7625_dp_get_edid (uint8_t bus , struct edid * out );
2222int anx7625_init (uint8_t bus );
23- void anx7625_wait_hpd_event (uint8_t bus );
23+ int anx7625_wait_hpd_event (uint8_t bus );
2424int anx7625_get_cc_status (uint8_t bus , uint8_t * cc_status );
2525int anx7625_read_system_status (uint8_t bus , uint8_t * sys_status );
2626bool anx7625_is_power_provider (uint8_t bus );
You can’t perform that action at this time.
0 commit comments