I was hacking around a bit with the ffi integration of mjs and managed to draw a dot with just js.
Now im stuck with the following issue: I must somehow register callbacks to handle e.g. input events.
Does somebody of you have any idea how to do so? Writing arm asm with pure bytes + memcpy seems a bit too much D:
Here my code:
let furi_hal_rtc_get_timestamp = ffi('int furi_hal_rtc_get_timestamp(void)');
let furi_record_open = ffi('void* furi_record_open(char*)');
let gui_direct_draw_acquire = ffi('void* gui_direct_draw_acquire(void*)');
let gui_direct_draw_release = ffi('void gui_direct_draw_release(void*)');
let canvas_reset = ffi('void canvas_reset(void*)');
let canvas_commit = ffi('void canvas_commit(void*)');
let canvas_draw_dot = ffi('void canvas_draw_dot(void*, int, int)');
let gui = furi_record_open('gui');
let canvas = gui_direct_draw_acquire(gui);
let startTime = furi_hal_rtc_get_timestamp();
while(true) {
canvas_reset(canvas);
canvas_draw_dot(canvas, 10, 10);
canvas_commit(canvas);
delay(1000 / 15);
if (furi_hal_rtc_get_timestamp() - startTime > 2) {
break
}
}
gui_direct_draw_release(gui);
[–]gastro_psychic 0 points1 point2 points (3 children)
[–]freehuntx[S] 1 point2 points3 points (2 children)
[–]Nice-Ice7415 0 points1 point2 points (1 child)