Skip to content

Commit 18fe009

Browse files
leonardocavagnisfacchinm
authored andcommitted
remove video_driver module
1 parent f259cd6 commit 18fe009

File tree

5 files changed

+72
-76
lines changed

5 files changed

+72
-76
lines changed

libraries/H7_Video/src/H7_Video.cpp

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#include "H7_Video.h"
2+
23
#include "dsi.h"
3-
#include "video_driver.h"
44
#include "display.h"
5+
#include "SDRAM.h"
6+
#include "video_modes.h"
7+
#include "anx7625.h"
58

69
#if __has_include ("lvgl.h")
710
#include "lvgl.h"
@@ -34,13 +37,74 @@ int H7_Video::begin(bool landscape) {
3437

3538
#if defined(ARDUINO_PORTENTA_H7_M7)
3639
if (_shield == NONE_SHIELD) {
37-
portenta_init_video();
40+
struct edid recognized_edid;
41+
int err_code = 0;
42+
43+
//Initialization of ANX7625
44+
err_code = anx7625_init(0);
45+
if(err_code < 0) {
46+
return err_code;
47+
}
48+
49+
//Checking HDMI plug event
50+
anx7625_wait_hpd_event(0);
51+
52+
//Read EDID
53+
anx7625_dp_get_edid(0, &recognized_edid);
54+
55+
//DSI Configuration
56+
anx7625_dp_start(0, &recognized_edid, EDID_MODE_720x480_60Hz);
57+
58+
//Configure SDRAM
59+
SDRAM.begin(getFramebufferEnd());
3860
} else if (_shield == GIGA_DISPLAY_SHIELD) {
39-
giga_init_video();
61+
#define EDID_MODE_SELECTED EDID_MODE_480x800_60Hz
62+
struct edid _edid;
63+
struct display_timing dt;
64+
65+
//DSI Configuration
66+
dt.pixelclock = envie_known_modes[EDID_MODE_SELECTED].pixel_clock;
67+
dt.hactive = envie_known_modes[EDID_MODE_SELECTED].hactive;
68+
dt.hsync_len = envie_known_modes[EDID_MODE_SELECTED].hsync_len;
69+
dt.hback_porch = envie_known_modes[EDID_MODE_SELECTED].hback_porch;
70+
dt.hfront_porch = envie_known_modes[EDID_MODE_SELECTED].hfront_porch;
71+
dt.vactive = envie_known_modes[EDID_MODE_SELECTED].vactive;
72+
dt.vsync_len = envie_known_modes[EDID_MODE_SELECTED].vsync_len;
73+
dt.vback_porch = envie_known_modes[EDID_MODE_SELECTED].vback_porch;
74+
dt.vfront_porch = envie_known_modes[EDID_MODE_SELECTED].vfront_porch;
75+
dt.hpol = envie_known_modes[EDID_MODE_SELECTED].hpol;
76+
dt.vpol = envie_known_modes[EDID_MODE_SELECTED].vpol;
77+
stm32_dsi_config(0, &_edid, &dt);
78+
79+
//Configure SDRAM
80+
SDRAM.begin();
81+
82+
//Init LCD Controller
4083
LCD_ST7701_Init();
4184
}
4285
#elif defined(ARDUINO_GIGA)
43-
giga_init_video();
86+
#define EDID_MODE_SELECTED EDID_MODE_480x800_60Hz
87+
struct edid _edid;
88+
struct display_timing dt;
89+
90+
//DSI Configuration
91+
dt.pixelclock = envie_known_modes[EDID_MODE_SELECTED].pixel_clock;
92+
dt.hactive = envie_known_modes[EDID_MODE_SELECTED].hactive;
93+
dt.hsync_len = envie_known_modes[EDID_MODE_SELECTED].hsync_len;
94+
dt.hback_porch = envie_known_modes[EDID_MODE_SELECTED].hback_porch;
95+
dt.hfront_porch = envie_known_modes[EDID_MODE_SELECTED].hfront_porch;
96+
dt.vactive = envie_known_modes[EDID_MODE_SELECTED].vactive;
97+
dt.vsync_len = envie_known_modes[EDID_MODE_SELECTED].vsync_len;
98+
dt.vback_porch = envie_known_modes[EDID_MODE_SELECTED].vback_porch;
99+
dt.vfront_porch = envie_known_modes[EDID_MODE_SELECTED].vfront_porch;
100+
dt.hpol = envie_known_modes[EDID_MODE_SELECTED].hpol;
101+
dt.vpol = envie_known_modes[EDID_MODE_SELECTED].vpol;
102+
stm32_dsi_config(0, &_edid, &dt);
103+
104+
//Configure SDRAM
105+
SDRAM.begin();
106+
107+
//Init LCD Controller
44108
LCD_ST7701_Init();
45109
#else
46110
#error Board not compatible with this library

libraries/H7_Video/src/video_driver.cpp

Lines changed: 0 additions & 55 deletions
This file was deleted.

libraries/H7_Video/src/video_driver.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

libraries/H7_Video/src/video_modes.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ struct envie_edid_mode envie_known_modes[NUM_KNOWN_MODES] = {
2323
.vactive = 800, .vback_porch = 50, .vfront_porch = 20, .vsync_len = 4,
2424
.hpol = 1, .vpol = 1,
2525
},
26-
/*
27-
[EDID_MODE_480x800_60Hz] = {
28-
.name = "480x800@60Hz", .pixel_clock = 32750, .refresh = 60,
29-
.hactive = 480, .hback_porch = 72, .hfront_porch = 24, .hsync_len = 48,
30-
.vactive = 800, .vback_porch = 18, .vfront_porch = 3, .vsync_len = 10,
31-
.hpol = 0, .vpol = 0,
32-
},
33-
*/
3426
[EDID_MODE_1024x768_60Hz] = {
3527
.name = "1024x768@60Hz", .pixel_clock = 57800, .refresh = 60,
3628
.hactive = 1024, .hback_porch = 80, .hfront_porch = 24, .hsync_len = 68, .hpol = 0,
@@ -46,4 +38,4 @@ struct envie_edid_mode envie_known_modes[NUM_KNOWN_MODES] = {
4638
.hactive = 1280, .hback_porch = 370, .hfront_porch = 110, .hsync_len = 40,
4739
.vactive = 720, .vback_porch = 30, .vfront_porch = 5, .vsync_len = 20,
4840
},
49-
};
41+
};

libraries/H7_Video/src/video_modes.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ struct envie_edid_mode {
1313
unsigned int voffset;
1414
unsigned int hpol : 1;
1515
unsigned int vpol : 1;
16-
};
16+
};
17+
18+
extern struct envie_edid_mode envie_known_modes[];

0 commit comments

Comments
 (0)