Skip to content

Commit 8fe8487

Browse files
committed
Merge branch 'giga_display_callback' of https://github.com/kurte/ArduinoCore-zephyr into giga_display_callback
2 parents 13960d6 + a046e8d commit 8fe8487

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

libraries/Camera/src/camera.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
7070
}
7171

7272
// Get capabilities
73-
struct video_caps caps = {0};
74-
if (video_get_caps(this->vdev, VIDEO_EP_OUT, &caps)) {
73+
struct video_caps caps;
74+
if (video_get_caps(this->vdev, &caps)) {
7575
return false;
7676
}
7777

@@ -96,7 +96,7 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
9696
.pitch = width * 2,
9797
};
9898

99-
if (video_set_format(this->vdev, VIDEO_EP_OUT, &fmt)) {
99+
if (video_set_format(this->vdev, &fmt)) {
100100
Serial.println("Failed to set video format");
101101
return false;
102102
}
@@ -110,11 +110,11 @@ bool Camera::begin(uint32_t width, uint32_t height, uint32_t pixformat, bool byt
110110
Serial.println("Failed to allocate video buffers");
111111
return false;
112112
}
113-
video_enqueue(this->vdev, VIDEO_EP_OUT, this->vbuf[i]);
113+
video_enqueue(this->vdev, this->vbuf[i]);
114114
}
115115

116116
// Start video capture
117-
if (video_stream_start(this->vdev)) {
117+
if (video_stream_start(this->vdev, VIDEO_BUF_TYPE_OUTPUT)) {
118118
Serial.println("Failed to start capture");
119119
return false;
120120
}
@@ -127,7 +127,7 @@ bool Camera::grabFrame(FrameBuffer &fb, uint32_t timeout) {
127127
return false;
128128
}
129129

130-
if (video_dequeue(this->vdev, VIDEO_EP_OUT, &fb.vbuf, K_MSEC(timeout))) {
130+
if (video_dequeue(this->vdev, &fb.vbuf, K_MSEC(timeout))) {
131131
return false;
132132
}
133133

@@ -154,17 +154,19 @@ bool Camera::releaseFrame(FrameBuffer &fb) {
154154
return false;
155155
}
156156

157-
if (video_enqueue(this->vdev, VIDEO_EP_OUT, fb.vbuf)) {
157+
if (video_enqueue(this->vdev, fb.vbuf)) {
158158
return false;
159159
}
160160

161161
return true;
162162
}
163163

164164
bool Camera::setVerticalFlip(bool flip_enable) {
165-
return video_set_ctrl(this->vdev, VIDEO_CID_VFLIP, (void *) flip_enable) == 0;
165+
struct video_control ctrl = {.id = VIDEO_CID_VFLIP, .val = flip_enable};
166+
return video_set_ctrl(this->vdev, &ctrl) == 0;
166167
}
167168

168169
bool Camera::setHorizontalMirror(bool mirror_enable) {
169-
return video_set_ctrl(this->vdev, VIDEO_CID_HFLIP, (void *) mirror_enable) == 0;
170+
struct video_control ctrl = {.id = VIDEO_CID_HFLIP, .val = mirror_enable};
171+
return video_set_ctrl(this->vdev, &ctrl) == 0;
170172
}

loader/fixups.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,4 @@ int maybe_flash_bootloader(void)
220220

221221
SYS_INIT(maybe_flash_bootloader, POST_KERNEL, CONFIG_FILE_SYSTEM_INIT_PRIORITY);
222222

223-
#endif
223+
#endif

loader/llext_exports.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ FORCE_EXPORT_SYM(__stack_chk_fail);
129129
FORCE_EXPORT_SYM(video_buffer_aligned_alloc);
130130
FORCE_EXPORT_SYM(video_buffer_alloc);
131131
FORCE_EXPORT_SYM(video_buffer_release);
132+
FORCE_EXPORT_SYM(video_set_ctrl);
133+
#endif
134+
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_VIDEO)
135+
//FORCE_EXPORT_SYM(getVideoTouchEvent);
136+
FORCE_EXPORT_SYM(registerGigaTouchCallback);
137+
132138
#endif
133139
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_VIDEO)
134140
//FORCE_EXPORT_SYM(getVideoTouchEvent);

variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ CONFIG_VIDEO_BUFFER_SMH_ATTRIBUTE=2
4545
CONFIG_VIDEO_GC2145=y
4646

4747
CONFIG_DISPLAY=y
48-
CONFIG_INPUT=y
48+
CONFIG_INPUT=y
49+
CONFIG_STM32_LTDC_FB_USE_SHARED_MULTI_HEAP=y
50+
CONFIG_STM32_LTDC_FB_SMH_ATTRIBUTE=2

0 commit comments

Comments
 (0)