Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Beginning touch support #134

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

Open
wants to merge 1 commit into
base: arduino
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 33 additions & 2 deletions loader/fixups.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,47 @@ SYS_INIT(disable_bootloader_mpu, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAU
SYS_INIT(disable_mpu_rasr_xn, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif

#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_VIDEO)

#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_INPUT_GT911_INTERRUPT)
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/logging/log.h>

#include <zephyr/input/input.h>

// experiment to try to capture touch screen events
void (*_giga_touch_callback)(struct input_event *evt, void *user_data) = 0;

void registerGigaTouchCallback(void (*cb)(struct input_event *evt, void *user_data)) {
_giga_touch_callback = cb;
}


void touch_event_callback(struct input_event *evt, void *user_data)
{
//printk("touch_event_callback(%p %p): %p %u %u %u %d\n", evt, user_data,
// evt->dev, evt->sync, evt->type, evt->code, evt->value);
if (_giga_touch_callback) {
(*_giga_touch_callback)(evt, user_data);
}
}

static const struct device *const touch_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_touch));
INPUT_CALLBACK_DEFINE(touch_dev, touch_event_callback, NULL);

#endif

#if (defined(CONFIG_BOARD_ARDUINO_GIGA_R1) || defined(CONFIG_BOARD_ARDUINO_PORTENTA_H7) ) && defined(CONFIG_VIDEO)
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/clock_control.h>

int camera_ext_clock_enable(void)
{
int ret;
uint32_t rate;

const struct device *cam_ext_clk_dev = DEVICE_DT_GET(DT_NODELABEL(pwmclock));

if (!device_is_ready(cam_ext_clk_dev)) {
Expand Down
3 changes: 3 additions & 0 deletions loader/llext_exports.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ FORCE_EXPORT_SYM(video_buffer_alloc);
FORCE_EXPORT_SYM(video_buffer_release);
FORCE_EXPORT_SYM(video_set_ctrl);
#endif
#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_INPUT_GT911_INTERRUPT)
FORCE_EXPORT_SYM(registerGigaTouchCallback);
#endif

#if defined(CONFIG_SHARED_MULTI_HEAP)
FORCE_EXPORT_SYM(shared_multi_heap_aligned_alloc);
Expand Down
9 changes: 9 additions & 0 deletions variants/arduino_giga_r1_stm32h747xx_m7/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@ void _on_1200_bps() {
*(__IO uint32_t *)tmp = (uint32_t)0xDF59;
NVIC_SystemReset();
}

#if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_INPUT_GT911_INTERRUPT)
extern "C" void registerGigaTouchCallback(void (*cb)(struct input_event *evt, void *user_data));
void initVariant(void) {
// Make sure to set to NULL in case previous sketch or pvevious build of sketch
// set a callback, whoes pointer may not be valid
registerGigaTouchCallback(nullptr);
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,11 @@

port {
gc2145_ep_out: endpoint {
remote-endpoint-label = "dcmi_ep_in";
remote-endpoint = <&dcmi_ep_in>;
};
};
};

ov7670: ov7670@21 {
compatible = "ovti,ov7670";
reg = <0x21>;

reset-gpios = <&gpioe 3 GPIO_ACTIVE_LOW>;
pwdn-gpios = <&gpiod 5 GPIO_ACTIVE_LOW>;

port {
ov7670_ep_out: endpoint {
remote-endpoint-label = "dcmi_ep_in";
};
};
};
};

&i2c1 {
Expand Down Expand Up @@ -139,12 +126,11 @@
pinctrl-names = "default";
dmas = <&dma1 0 75 (STM32_DMA_PERIPH_TO_MEMORY | STM32_DMA_PERIPH_NO_INC |
STM32_DMA_MEM_INC | STM32_DMA_PERIPH_32BITS | STM32_DMA_MEM_32BITS |
STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_FULL>; //FULL for 7670, default FIFO_1_4
STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_1_4>; //FULL for 7670, default FIFO_1_4

port {
dcmi_ep_in: endpoint {
remote-endpoint-label = "gc2145_ep_out";
// remote-endpoint-label = "ov7670_ep_out";
bus-width = <8>;
hsync-active = <0>;
vsync-active = <0>;
Expand Down