You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I've been trying my hardest to figure out how to create a simple scrolling app with Bluetooth but failing. Basically all I want to create is an app just like the mouse clicker app, instead I would just need it to scroll upwards continuously upon toggle, is this possible?
Hello! I've been trying my hardest to figure out how to create a simple scrolling app with Bluetooth but failing. Basically all I want to create is an app just like the mouse clicker app, instead I would just need it to scroll upwards continuously upon toggle, is this possible?
Would the following code below help at all?
#include <furi.h>
#include <gui/gui.h>
#include <input/input.h>
#include <ble/ble.h>
#define TAG "ScrollToggleApp"
static bool is_scrolling = false;
static FuriThread* scroll_thread = NULL;
static void scroll_thread_callback(void* arg) {
UNUSED(arg);
while(is_scrolling) {
ble_hid_mouse_scroll(1); // Scroll up by 1 unit
furi_delay_ms(100); // Scroll every 100ms
}
}
static void input_callback(InputEvent* event, void* context) {
UNUSED(context);
if(event->type == InputTypePress) {
if(event->key == InputKeyOk) {
is_scrolling = !is_scrolling;
if(is_scrolling && !scroll_thread) {
scroll_thread = furi_thread_alloc_ex(TAG, 1024, scroll_thread_callback, NULL);
furi_thread_start(scroll_thread);
} else if(!is_scrolling && scroll_thread) {
furi_thread_free(scroll_thread);
scroll_thread = NULL;
}
} else if(event->key == InputKeyBack) {
is_scrolling = false;
if(scroll_thread) {
furi_thread_free(scroll_thread);
scroll_thread = NULL;
}
furi_record_close("gui");
ble_hid_service_stop();
}
}
}
int32_t scroll_toggle_app(void* p) {
UNUSED(p);
FURI_LOG_I(TAG, "Starting Scroll Toggle App");
}
The text was updated successfully, but these errors were encountered: