@@ -3,18 +3,15 @@ extern "C" {
3
3
#include " zbuffer.h"
4
4
#include " GL/gl.h"
5
5
}
6
- #include " Portenta_lvgl.h"
6
+ #include " Arduino_H7_Video.h"
7
+ #include " Arduino_GigaDisplayTouch.h"
7
8
#include " dsi.h"
9
+ #include " lvgl.h"
8
10
#include " SDRAM.h"
9
- #include " Goodix.h" // Arduino_GT911_Library
10
-
11
- void LCD_ST7701_Init ();
12
11
13
12
uint16_t touchpad_x;
14
13
uint16_t touchpad_y;
15
14
16
- void i2c_touch_setup ();
17
- void i2c_touch_loop ();
18
15
extern " C" void init_gears ();
19
16
extern " C" void draw_gears ();
20
17
extern " C" void idle_gears ();
@@ -26,11 +23,11 @@ extern "C" void tkSwapBuffers(void)
26
23
27
24
}
28
25
29
- GTPoint prev_points[3 ];
26
+ GDTpoint_t prev_points[3 ];
30
27
float zoom_scale = 1 .0f ;
31
28
uint32_t first_touch = 0 ;
32
29
33
- void handleTouch (int8_t contacts, GTPoint *points) {
30
+ void handleTouch (uint8_t contacts, GDTpoint_t *points) {
34
31
if (first_touch == 0 || millis () - first_touch > 500 ) {
35
32
first_touch = millis ();
36
33
goto save;
@@ -86,25 +83,28 @@ static void anim(lv_timer_t * timer) {
86
83
lv_obj_invalidate (canvas);
87
84
}
88
85
86
+ #ifdef ARDUINO_GIGA
87
+ #ifdef LANDSCAPE
88
+ Arduino_H7_Video display (800 , 480 , GigaDisplayShield);
89
+ #else
90
+ Arduino_H7_Video display (480 , 800 , GigaDisplayShield);
91
+ #endif
92
+ Arduino_GigaDisplayTouch touch;
93
+ #else
94
+ Arduino_H7_Video display (720 , 480 , USBCVideo);
95
+ #endif
96
+
89
97
void setup () {
90
98
Serial.begin (115200 );
91
- while (!Serial);
92
99
100
+ display.begin ();
93
101
#ifdef ARDUINO_GIGA
94
- i2c_touch_setup ();
95
- giga_init_video (LANDSCAPE);
96
- LCD_ST7701_Init ();
97
- #else
98
- portenta_init_video ();
102
+ touch.begin ();
103
+ touch.onDetect (handleTouch);
99
104
#endif
100
105
101
- if (LANDSCAPE) {
102
- WINDOWX = stm32_getYSize ();
103
- WINDOWY = stm32_getXSize ();
104
- } else {
105
- WINDOWX = stm32_getXSize ();
106
- WINDOWY = stm32_getYSize ();
107
- }
106
+ WINDOWX = display.width ();
107
+ WINDOWY = display.height ();
108
108
109
109
cbuf = (lv_color_t *)ea_malloc (WINDOWX * WINDOWY * 4 );
110
110
@@ -121,12 +121,9 @@ void setup() {
121
121
}
122
122
123
123
void loop () {
124
- #ifdef ARDUINO_GIGA
125
- i2c_touch_loop ();
126
- #endif
127
124
#if LVGL_VERSION_MAJOR > 7
128
125
lv_timer_handler ();
129
126
#else
130
127
lv_task_handler ();
131
128
#endif
132
- }
129
+ }
0 commit comments