Article: Inside a Smartphone Accelerometer: PinePhone with NuttX RTOS
#21
Haha no worries @WhiteHexagon , I'm now working on something really interesting: Simulate PinePhone UI with Zig, LVGL and WebAssembly :-)
  Reply
#22
Nice! @lupyuen  btw when you are missing functions in Zig/WASM it is often easier to make a call into the javascript world, unless you are on a performance critical path.  For my wasm stuff I also keep the render loop on the JS side using requestAnimationFrame but with a custom callback into Zig (once per frame) passing over a frame number, timestamp and canvas2d context.


roughly:

     
Code:
  WebAssembly.instantiateStreaming(fetch('app.wasm'),{env}).then(wa=>{
            zex=wa.instance.exports;
            zmb=zex.memory.buffer;
            zex.run();
            let fn=0;      //frame number
            function frame(ts) {
                zex.drawFrame(ctx,fn,timestamp);
                fn++;
                globalThis.requestAnimationFrame(frame);
            }
            globalThis.requestAnimationFrame(frame);
        })
  Reply
#23
Thanks @WhiteHexagon for the tips, we now have LVGL rendering OK in the Web Browser, compiled with Zig yay! :-)

LVGL renders OK in WebAssembly with Zig Compiler
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 40 35,498 12-28-2024, 12:19 AM
Last Post: mara
  Office applications for the Pinephone Peter Gamma 2 698 09-05-2024, 09:22 AM
Last Post: Peter Gamma
  Struggle to install LibreOffice on the PinePhone Peter Gamma 50 38,317 07-26-2024, 10:35 PM
Last Post: Peter Gamma
  Why does Pine64 sabotage office on the Pinephone? Peter Gamma 5 1,354 07-04-2024, 07:34 AM
Last Post: Kevin Kofler
  Which word processor to choose for the Pinephone? Peter Gamma 16 6,367 06-22-2024, 07:28 AM
Last Post: Peter Gamma
  Samba share on the Pinephone? Peter Gamma 0 737 06-16-2024, 10:26 PM
Last Post: Peter Gamma
  Possible Free Backup Carrier for PinePhone PineFone 0 660 06-13-2024, 03:45 PM
Last Post: PineFone
  Using Signal on PinePhone in mid-2023? dante404 47 25,100 05-03-2024, 02:19 AM
Last Post: dragonhospital
Wink PINEPHONE not booting Touchwood 2 1,392 02-23-2024, 07:27 AM
Last Post: Touchwood
  Slack on PinePhone Adam Seline 5 6,764 12-20-2023, 07:20 AM
Last Post: nickolas

Forum Jump:


Users browsing this thread: 3 Guest(s)