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 32 23,358 03-21-2024, 04:27 PM
Last Post: donchurch
Wink PINEPHONE not booting Touchwood 2 283 02-23-2024, 07:27 AM
Last Post: Touchwood
  Slack on PinePhone Adam Seline 5 5,158 12-20-2023, 07:20 AM
Last Post: nickolas
  Struggle to install LibreOffice on the PinePhone Peter Gamma 48 22,958 11-24-2023, 07:02 AM
Last Post: Peter Gamma
  Which word processor to choose for the Pinephone? Peter Gamma 8 1,717 11-23-2023, 01:06 AM
Last Post: Peter Gamma
  openSUSE for Pinephone Alefnode 75 99,988 11-17-2023, 08:37 AM
Last Post: Uturn
  Using Signal on PinePhone in mid-2023? dante404 45 11,767 11-17-2023, 04:23 AM
Last Post: Kevin Kofler
  Genode- Sculpt OS for the PinePhone (non Linux) Surehand53 1 818 11-04-2023, 07:23 PM
Last Post: tllim
  Abiword as a office mobile word processor for the Pinephone? Peter Gamma 11 1,841 10-24-2023, 08:57 AM
Last Post: Peter Gamma
  What File Manager Options Are There For The Pinephone? pinephoneuser22 7 2,120 10-18-2023, 08:37 AM
Last Post: luppivega

Forum Jump:


Users browsing this thread: 1 Guest(s)