Skip to content

Refactor Video Library for STM32H7 boards #663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 78 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
eef4750
cosmetics anx7625 library
leonardocavagnis Mar 13, 2023
0a9ef8b
cosmetics dsi library
leonardocavagnis Mar 13, 2023
95949dd
cosmetics porting module in portenta_lvgl lib
leonardocavagnis Mar 13, 2023
94e3c56
Create Portenta_Video class
leonardocavagnis Mar 14, 2023
621a649
function to get current frame buffer addr in dsi
leonardocavagnis Mar 14, 2023
78b1e05
add functions to draw elements in portenta_video lib
leonardocavagnis Mar 14, 2023
b5b3752
refactoring arduinoLogo with new portenta_video apis
leonardocavagnis Mar 14, 2023
7c7af47
remove useless include
leonardocavagnis Mar 14, 2023
4f16d11
add define for colors
leonardocavagnis Mar 14, 2023
66ea3db
add function to draw pixel, line, rect, circle and fill circle
leonardocavagnis Mar 14, 2023
6750260
add function to draw not filled rectangle
leonardocavagnis Mar 14, 2023
e5de3b2
refactoring args and fun name in portenta_video
leonardocavagnis Mar 15, 2023
40b2950
add drawChar function
leonardocavagnis Mar 15, 2023
59bd8ae
add function to draw a text
leonardocavagnis Mar 15, 2023
9347c24
refactor arduinologo example with new apis
leonardocavagnis Mar 15, 2023
0215a00
add support for giga r1 and giga display shield
leonardocavagnis Mar 17, 2023
b6a2274
add video_driver lib and remove dependence to portenta_lvgl lib
leonardocavagnis Mar 17, 2023
47413d4
remove lvgl init procedure in video_driver lib
leonardocavagnis Mar 17, 2023
6c2b8c8
add LVGLDemo example project
leonardocavagnis Mar 17, 2023
b3fb0db
create a label with lvgl library in LVGLDemo.ino
leonardocavagnis Mar 17, 2023
91ebb03
add lvgl hello world example in LVGLDemo
leonardocavagnis Mar 20, 2023
df40a17
fix display init (ST7701)
leonardocavagnis Mar 21, 2023
4c37cfd
embed LVGL engine inside Portenta_Video library for LVGLDemo example
leonardocavagnis Mar 21, 2023
29cfef6
add support for LVGL lib v7.x
leonardocavagnis Mar 21, 2023
598f2a4
fix orientation in LVGL lib
leonardocavagnis Mar 21, 2023
d9a533f
remove compatibility with LVGL v7.x
leonardocavagnis Mar 21, 2023
928addb
manage landscape and portrait mode
leonardocavagnis Mar 22, 2023
57a39bb
Add H7_Video class as a child of ArduinoGraphics lib (first attempt)
leonardocavagnis Mar 23, 2023
a7051ec
add support for LVGL and portenta in H7_Video lib (arduinographics)
leonardocavagnis Mar 23, 2023
774f0a3
add landscape management for H7_Video + LVGL
leonardocavagnis Mar 23, 2023
96f3215
fix landscape mode in H7_Video lib
leonardocavagnis Mar 24, 2023
d1dce41
Add ArduinoLogo example (draw image with H7_Video lib)
leonardocavagnis Mar 24, 2023
8811e44
Add arduinologo_old example with Portenta_Video lib (to be removed)
leonardocavagnis Mar 24, 2023
cd9ff80
add ArduinoLogoDrawing empty example
leonardocavagnis Mar 24, 2023
d9867e4
modify LVGL demo with H7_Video library
leonardocavagnis Mar 24, 2023
929d833
add ArduinoLogoDrawing example
leonardocavagnis Mar 24, 2023
575ea51
use circle function to draw arduino logo in ArduinoLogoDrawing example
leonardocavagnis Mar 27, 2023
d2b75c0
remove Portenta_Video Library
leonardocavagnis Mar 27, 2023
37a2885
rename Portenta_Video library in H7_Video library
leonardocavagnis Mar 27, 2023
9e87a04
add touch management in LVGLDemo example
leonardocavagnis Mar 28, 2023
a8ad320
add touch management to LVGL Demo
leonardocavagnis Mar 28, 2023
f24f6f4
add support for PortentaH7+GIGA Display in H7_Video library
leonardocavagnis Mar 29, 2023
3601b83
embed LVGL touch management inside H7_Video library
leonardocavagnis Mar 30, 2023
a7926cf
remove not used include from H7_Video lib
leonardocavagnis Mar 31, 2023
f259cd6
fix problem of include lvgl when using primitive function in H7_Video…
leonardocavagnis Mar 31, 2023
18fe009
remove video_driver module
leonardocavagnis Apr 3, 2023
9ad94f3
refactor display module (rename in st7701 module)
leonardocavagnis Apr 3, 2023
ff0bd6f
cosmetics
leonardocavagnis Apr 3, 2023
8566076
refactoring dsi module
leonardocavagnis Apr 3, 2023
c38444b
remove mutual dependency between anx7625 module and dsi module
leonardocavagnis Apr 4, 2023
b6b5994
add DSI initialization inside ST7701 lib
leonardocavagnis Apr 4, 2023
e910ea9
cosmetics anx7625 module
leonardocavagnis Apr 4, 2023
1e44e29
cosmetics of all modules (add file header and sections)
leonardocavagnis Apr 5, 2023
454c852
rename H7_Video lib in Arduino_H7_Video library
leonardocavagnis Apr 6, 2023
9cf2cb5
auto manage of landscape and portrait mode in Arduino_H7_Video library
leonardocavagnis Apr 6, 2023
66e3ce2
add auto-detect of EDID mode for portenta H7+USB
leonardocavagnis Apr 11, 2023
12a7c6a
fix max display resolution supported for H7 microcontroller
leonardocavagnis Apr 11, 2023
837a82f
add LOG enable define for EDID and ANX7625 module
leonardocavagnis Apr 12, 2023
887288e
check malloc return in Arduino_H7_Video Lib
leonardocavagnis Apr 12, 2023
58cac74
Move image declaration to global scope
leonardocavagnis Apr 17, 2023
f64f392
Adding singleton classes to manage anx and st7701 controller
leonardocavagnis Apr 18, 2023
c325482
fix screen tearing issue when switch between frames
leonardocavagnis Apr 26, 2023
bdb2f2d
Use Arduino_GigaDisplayTouch library in LVGLDemo example
leonardocavagnis May 8, 2023
bd97eb5
dsi: add reload callback check for LTDC layer drawing
leonardocavagnis May 10, 2023
9a66a72
update LVGL_Demo example
leonardocavagnis May 17, 2023
4b25a81
remove LVGL touch handler (moved in touch library)
leonardocavagnis May 18, 2023
4f804e4
Remove hard dependency on ArduinoGraphics
leonardocavagnis May 19, 2023
358ca41
port doom to new video library
leonardocavagnis May 19, 2023
5422ed2
LVGL Demo example update
leonardocavagnis May 23, 2023
49d32b1
doc: add readme, library.properties, keywords
leonardocavagnis May 23, 2023
94e71fb
docs: add docs/README.md
leonardocavagnis May 24, 2023
ce239d2
doc: add api
leonardocavagnis May 24, 2023
0872171
doc: add doxygen comment
leonardocavagnis May 24, 2023
94316b2
video: allow other thread to execute while waiting for screen refresh
leonardocavagnis May 24, 2023
08ce02d
video: add isRotated() API
leonardocavagnis May 24, 2023
5cccd4b
Remove Portenta_LVGL library (examples moved in Arduino_H7_Video lib)
leonardocavagnis May 26, 2023
98465eb
ci: update compile-examples according to new video lib
leonardocavagnis May 26, 2023
880f9bb
Merge branch 'main' into stm32h7_video_lib
facchinm May 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions libraries/Arduino_H7_Video/examples/ArduinoLogo/ArduinoLogo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
ArduinoLogo

created 17 Apr 2023
by Leonardo Cavagnis
*/

#include "Arduino_H7_Video.h"

#include "img_arduinologo.h"
// Alternatively, any raw RGB565 image can be included on demand using this macro
// Online image converter: https://lvgl.io/tools/imageconverter (Output format: Binary RGB565)
/*
#define INCBIN_PREFIX
#include "incbin.h"
INCBIN(test, "/home/user/Downloads/test.bin");
*/

Arduino_H7_Video Display(800, 480, GigaDisplayShield);
//Arduino_H7_Video Display(1024, 768, USBCVideo);

Image img_arduinologo(ENCODING_RGB16, (uint8_t *) texture_raw, 300, 300);

void setup() {
Display.begin();

Display.beginDraw();
Display.image(img_arduinologo, (Display.width() - img_arduinologo.width())/2, (Display.height() - img_arduinologo.height())/2);
Display.endDraw();
}

void loop() { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
ArduinoLogoDrawing

created 17 Apr 2023
by Leonardo Cavagnis
*/

#include "Arduino_H7_Video.h"

Arduino_H7_Video Display(800, 480, GigaDisplayShield);
//Arduino_H7_Video Display(1024, 768, USBCVideo);

void setup() {
Display.begin();

Display.beginDraw();
Display.background(255, 255, 255);
Display.clear();
Display.fill(0x008184);
Display.circle(Display.width()/2, Display.height()/2, 300);
Display.stroke(255, 255, 255);
Display.noFill();
for (int i=0; i<30; i++) {
Display.circle((Display.width()/2)-55+5, Display.height()/2, 110-i);
Display.circle((Display.width()/2)+55-5, Display.height()/2, 110-i);
}
Display.fill(255, 255, 255);
Display.rect((Display.width()/2)-55-16+5, (Display.height()/2)-5, 32, 10);
Display.fill(255, 255, 255);
Display.rect((Display.width()/2)+55-16-5, (Display.height()/2)-5, 32, 10);
Display.fill(255, 255, 255);
Display.rect((Display.width()/2)+55-5-5, (Display.height()/2)-16, 10, 32);
Display.endDraw();
}

void loop() { }
56 changes: 56 additions & 0 deletions libraries/Arduino_H7_Video/examples/LVGLDemo/LVGLDemo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

/*
LVGLDemo

created 17 Apr 2023
by Leonardo Cavagnis
*/

#include "Arduino_H7_Video.h"

#include "lvgl.h"
#include "giga_touch.h"

Arduino_H7_Video Display(800, 480, GigaDisplayShield);
//Arduino_H7_Video Display(1024, 768, USBCVideo);

void my_touchpad_read(lv_indev_drv_t * indev, lv_indev_data_t * data) {
data->state = (touchpad_pressed) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
if(data->state == LV_INDEV_STATE_PR) {
data->point.x = giga_get_touch_x();
data->point.y = giga_get_touch_y();
touchpad_pressed = false;

Serial.print("Touch detected: ");
Serial.print(data->point.x);
Serial.print(",");
Serial.println(data->point.y);
}

return;
}

void setup() {
Serial.begin(115200);
giga_touch_setup();

Display.begin();
Display.attachLVGLTouchCb((void (*)(void*,void*))(my_touchpad_read));

/* Change the active screen's background color */
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x03989e), LV_PART_MAIN);

/* Create a white label, set its text and align it to the center */
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "Hello Arduino!");
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}

void loop() {
/* Touch handler */
giga_touch_handler();

/* Feed LVGL engine */
lv_timer_handler();
}
78 changes: 78 additions & 0 deletions libraries/Arduino_H7_Video/examples/LVGLDemo/giga_touch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include <Wire.h>
#include "Goodix.h" // Arduino_GT911_Library
#include "pinDefinitions.h"

Goodix touch = Goodix();

REDIRECT_STDOUT_TO(Serial);

#ifdef ARDUINO_GIGA
#define Wire Wire1
#define INT_PIN PinNameToIndex(PI_1)
#define RST_PIN PinNameToIndex(PI_2)
#endif

#ifdef ARDUINO_PORTENTA_H7_M7
#define INT_PIN PinNameToIndex(PD_4)
#define RST_PIN PinNameToIndex(PD_5)
#endif

uint16_t touchpad_x;
uint16_t touchpad_y;
bool touchpad_pressed;

void handleTouch(int8_t contacts, GTPoint *points) {
touchpad_pressed = true;
//printf("Contacts: %d\n", contacts);
for (uint8_t i = 0; i < contacts; i++) {
if (i == 0) {
touchpad_x = points[i].x;
touchpad_y = points[i].y;
}
//printf("C%d: #%d %d,%d s:%d\n", i, points[i].trackId, points[i].x, points[i].y, points[i].area);
yield();
}
}

void touchStart() {
if (touch.begin(Wire, INT_PIN, RST_PIN, 0xDD) != true) {
Serial.println("! Module reset failed");
} else {
Serial.println("Module reset OK");
}

Serial.print("Check ACK on addr request on 0x");
Serial.print(touch.i2cAddr, HEX);

Wire.beginTransmission(touch.i2cAddr);
Wire.write(0);
int error = Wire.endTransmission();
if (error == 0) {
Serial.println(": SUCCESS");
} else {
Serial.print(": ERROR #");
Serial.println(error);
}
}

void giga_touch_setup() {
Wire.setClock(400000);
Wire.begin();
delay(300);

touch.setHandler(handleTouch);
touchStart();
}

void giga_touch_handler() {
touch.loop();
delay(1);
}

uint16_t giga_get_touch_x() {
return touchpad_x;
}

uint16_t giga_get_touch_y() {
return touchpad_y;
}
7 changes: 7 additions & 0 deletions libraries/Arduino_H7_Video/examples/LVGLDemo/giga_touch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
void giga_touch_setup();
void giga_touch_handler();

uint16_t giga_get_touch_x();
uint16_t giga_get_touch_y();

extern bool touchpad_pressed;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Portenta_Video
name=Arduino_H7_Video
version=1.0
author=Arduino
maintainer=Arduino <[email protected]>
sentence=video primitives for Portenta H7 via USBC (to HDMI adapter)
sentence=video primitives for Portenta H7 and Giga R1
paragraph=
category=Display
url=https://github.com/arduino/ArduinoCore-mbed/tree/master/libraries/Portenta_Video
url=https://github.com/arduino/ArduinoCore-mbed/tree/master/libraries/Arduino_H7_Video
architectures=mbed,mbed_portenta,mbed_giga
Loading